This discussion is archived
7 Replies Latest reply: Feb 28, 2013 7:42 AM by 679068 RSS

Do we have something like a deployment plan for OCEP JMS adapter?

679068 Newbie
Currently Being Moderated
We have the requirement to deploy our app to oracle cep where we are using JMS adapter. How can we overwrite the URL of OCEP JMS adapter during deployment? We'd like to avoid having 3 packages with different endpoints, one for each environment.
  • 1. Re: Do we have something like a deployment plan for OCEP JMS adapter?
    alexalves Explorer
    Currently Being Moderated
    Hi,

    I would suggest using Spring's property placeholder configurer: http://forum.springsource.org/showthread.php?63695-How-to-read-properties-file-in-spring-xml

    You would have to do it in the EPN, using instance-properties for the JMS adapter.

    In the upcoming release, we would also support a better way of doing this directly in the application configuration file.

    Thanks
    Alex
  • 2. Re: Do we have something like a deployment plan for OCEP JMS adapter?
    679068 Newbie
    Currently Being Moderated
    Hi Alex,

    Thanks for the response.

    I tested this approach, however I did not succeed making wlevs:instance-property to work with a property exposed by the PropertyPlaceholderConfigurer. I did a test with a normal Spring Bean in the same project and it worked just fine but when I use the wlevs:instance-property it does not resolve the property, just try to use the value verbatim.

    Sample XML trying to externalize the connectionFactory JNDI name:

         <wlevs:adapter id="TestTopicSubscriber" provider="jms-inbound">
              <wlevs:listener ref="inputChannel" />
              <wlevs:instance-property name="converterBean"
                   ref="jmsMessageConverter" />
              <wlevs:instance-property name="jndiProviderUrl"
                   value="t3://localhost:7001" />
              <wlevs:instance-property name="destinationJndiName"
                   value="jms.myTestTopic" />
              <wlevs:instance-property name="connectionJndiName"
                   value="${cep1.connectionFactory}" />
              <wlevs:instance-property name="destinationType"
                   value="TOPIC" />     
              <wlevs:instance-property name="concurrentConsumers"
                   value="10" />
         </wlevs:adapter>

    Should this work? If so, I'll file a bug as it's very important for us to have this flexibility as we are wondering using WLS partitioned topics to have multiple consuming threads and still receive 1 message per OCEP instance (we have to specify a client ID for each CEP Server for this to work and the solution I've found would be to create a connection factory for each one with a ClientID configured).

    Thanks,
    Daniel
  • 3. Re: Do we have something like a deployment plan for OCEP JMS adapter?
    679068 Newbie
    Currently Being Moderated
    Alex,

    I managed a way to make it work. I defined a constant in Spring pointing to a static field which is not really a constant as I value it from a properties file, then I make a reference to the constant bean and now the ref works.

         <util:constant id="CONN_FACTORY_JNDI_NAME"
              static-field="com.acme.ConstantsProvider.CONN_FACTORY_JNDI_NAME" />

         <wlevs:adapter id="TestTopicSubscriber" provider="jms-inbound"
              depends-on="projectPropertyConfigurer">
              <wlevs:listener ref="inputChannel" />
              <wlevs:instance-property name="converterBean"
                   ref="jmsMessageConverter" />
              <wlevs:instance-property name="jndiProviderUrl"
                   value="t3://localhost:7001" />
              <wlevs:instance-property name="destinationJndiName"
                   value="jms.myTestTopic" />
              <wlevs:instance-property name="connectionJndiName"
                   ref="CONN_FACTORY_JNDI_NAME" />
              <wlevs:instance-property name="destinationType"
                   value="TOPIC" />
              <wlevs:instance-property name="concurrentConsumers"
                   value="10" />
         </wlevs:adapter>

    Well, this solved my problem but I believe the property placeholder should work. If you need, I can file an ER for that...

    Thanks for your help!
  • 4. Re: Do we have something like a deployment plan for OCEP JMS adapter?
    alexalves Explorer
    Currently Being Moderated
    Hi,

    Clever...

    Now that I think about it a bit more, I think you should have used our PropertyPlaceholderConfigurer:

    http://docs.oracle.com/cd/E17904_01/apirefs.1111/e14303/com/bea/wlevs/spring/support/ConfigurationPropertyPlaceholderConfigurer.html

    Give it a try when you get a chance.

    Thanks
    Alex
  • 5. Re: Do we have something like a deployment plan for OCEP JMS adapter?
    679068 Newbie
    Currently Being Moderated
    Hi Alex,

    Worked just fine.

    Thanks
  • 6. Re: Do we have something like a deployment plan for OCEP JMS adapter?
    887796 Newbie
    Currently Being Moderated
    Hi,

    I read the:
    http://docs.oracle.com/cd/E17904_01/apirefs.1111/e14303/com/bea/wlevs/spring/support/ConfigurationPropertyPlaceholderConfigurer.html

    but I don't understand where to put my custom config elements?

    I added to the context.xml file:
    <bean class="com.bea.wlevs.spring.support.ConfigurationPropertyPlaceholderConfigurer"/>

    and to the stage in the EPN:
         <wlevs:adapter id="InboundCsv" provider="csvgen">
              <wlevs:listener ref="InboundChannel" />
              <wlevs:instance-property name="port" value="${myprop.port}" />
              <wlevs:instance-property name="eventTypeName" value="MyInboundEvent" />
              <wlevs:instance-property name="eventPropertyNames" value="stringData,id,eventTime" />
         </wlevs:adapter>


    and I tried to add custom lines to the server config.xml file:

    <myprop>
         <name>MyPort</name>
         <port>9050</port>
    </myprop>

    but the server won't start because it rejected them because it is not recognized by the schema:

    <23:13:06 IST 05/02/2013> <Warning> <Ede> <BEA-000000> <Error parsing configuration with validation enabled, file C:\Oracle\Middleware\cep_11.1.1.6\user_projects\domains\autostrada\server1\config\config.xml at line 171 column 15 for application WLEvSServer_Application_: cvc-complex-type.2.4.a: Invalid content was found starting with element 'myprop'. One of '{domain, rmi, jndi-context, exported-jndi-context, jmx, transaction-manager, work-manager, logging-service, log-stdout, log-file, jetty-web-app, netio, jetty, glassfish-ws, netio-client, debug, data-source, http-pubsub, event-store, cluster, bdb-config, rdbms-event-store-provider, user-event-store-provider, ssl, weblogic-rmi-client, weblogic-jta-gateway, use-secure-connections, show-detail-error-message, cql, event-inspector}' is expected. Please check that your configuration validates and that your application imports the JAXB packages implied by the schema that it is using.>
    <23:13:06 IST 05/02/2013> <Error> <com.bea.wlevs.spring.extender.SystemContextErrorHandler> <BEA-000000> <System-level error in bundle [com.bea.wlevs.configuration]
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configuration' defined in URL [bundleentry://192.fwk33646088/META-INF/spring/configuration.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: com.bea.core.configuration.simpleprovider.ConfigurationProviderException: Do not recognize the tag "myprop"
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    ...

    I tried to put it in a separate config file in the server config folder but when I deploy the application I get:

    <23:18:29 IST 05/02/2013> <Error> <Deployment> <BEA-2045016> <The application context "test.patternMatch" could not be started. Could not initialize component "InboundCsv": Could not resolve placeholder 'myprop.port'>

    What am I missing here?
  • 7. Re: Do we have something like a deployment plan for OCEP JMS adapter?
    679068 Newbie
    Currently Being Moderated
    What I'm doing to specify values to these properties is using java system properties -Dmyprop=myvalue

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points