Monday, March 5, 2012

JMS bridge between Weblogic and MQ series example






Some Advantages of having a JMS bridge between Weblogic and MQ series listener is even though the destination application is down, bridge will manage the messages by its built in capacity.
  • Bridge has capacity of retry, transaction management.
  • When destination application has some downtime bridge will cache the messages and re-send it when the destination application comes up.
  • It will automatically detect start/stop of destination application.
  • It is guaranteed delivery pattern

Process for creating the JMS bridge.
  1.  Login to Weblogic console through browser
  2. Create a queue required for collection of messages from source end(QueueJndi).
  3.  navigate Services → Messaging → Bridges → JMS Bridge Destinations(click new)
  4. first time you will get few properties only, fill them and then edit the destination again to refill the remaining properties.
  5.  Name                                             Value
     Name                                             sourceDestinationQueue
     Adapter JNDI Name                    eis.jms.WLSConnectionFactoryJNDIXA
     Classpath
     Connection                                     URL t3://[host]:[port]{ex t3://localhost:7001}
     Initial Context Factory                  weblogic.jndi.WLInitialContextFactory
     Connection Factory JNDI Name  JMSCF_JNDI
     Destination JNDI Name               QueueJndi
     Destination Type                            Queue
     User Name                                     [weblogic username]
     User Password                               [password for the user]
     Confirm User Password                 [same as above password
  6. Click Save
  7.  navigate Services → Messaging → Bridges → JMS Bridge Destinations(click new)
  8.  first time you will get few properties only, fill them and then edit the destination again to refill the remaining properties.
  9.  Name                                             Value
     Name                                              targetDestinationQueue
     Adapter JNDI Name                     eis.jms.WLSConnectionFactoryJNDIXA
     Classpath
     Connection                                     [JMS.BROKER.URL]from destination→ configuration
     Initial Context Factory           org.apache.activemq.jndi.ActiveMQInitialContextFactory
     Connection Factory JNDI Name  QueueConnectionFactory
     Destination JNDI Name               dynamicQueues/daEventQueue
     Destination Type                           Queue
     User Name                                     [tomcat username]
     User Password                               [tomcat password for the user]
     Confirm User Password                [same as above password]
  10. Click save
  11. navigate Services → Messaging → Bridges
  12. click new
  13. Name                                   Value
    Name                                   
    JMS-MQ-Bridge
    selector
    Quality Of Service              
    Atmost-once
    Started                                
    checked
  14. Click next
  15. select source Destination : sourceDestinationQueue
  16. click next
  17. select Messaging provider : Weblogic server 7.0 or higher
  18. click next
  19. select target Destination :targetDestinationQueue
  20. click next
  21. select Messaging provider : Other JMS
  22. click next
  23. myserver should be checked
  24. click next
  25. click finish
    Now bridge is created and deployed to Weblogic
  26. Add following jars into Weblogic CLASSPATH
    slf4j-api-1.6.4.jar
    activemq-core-5.5.0.jar
  27. Once it is sure the above jars are in the Weblogic CLASSPATH
  28. restart Weblogic.

5 comments:

  1. I have WLS 10.3 and an ActiveMQ broker (embedded in a Tomcat 7)
    My source destination is @ WLS and my target destination is @ ActiveMQ.

    Don't I need some setup at Tomcat/ActiveMq side? Like jndi, other.
    I use Spring DI to construct my activeMQ broker.

    Using you conf I get the following.
    <Bridge MyBridgeTest failed to connect to the source destination and will try again in 45 seconds. This could be a temporary condition unless the messages repeat several times. (java.lang.Exception: weblogic.jms.bridge.TemporaryResourceException
    at weblogic.jms.adapter.JMSBaseConnection.throwTempResourceException(JMSBaseConnection.java:1636)

    ReplyDelete
  2. Sorry for delay not updates blog from long back. but now I am active. is your issue resolved?

    ReplyDelete
  3. I am using the same approach to setup bridge between ActiveMQ5 and Weblogic10.3. The given below is the Configuration:

    Source: has no problem.

    Target:
    Adapter JNDI Name: eis.jms.WLSConnectionFactoryJNDIXA
    Connection URL: tcp://127.0.0.1:61616
    Initial Context Factory: org.apache.activemq.jndi.ActiveMQInitialContextFactory
    Connection Factory JNDI Name: amqConnectionFactory
    Destination JNDI Name: queue/DestinationQueue
    Destination Type: Queue
    User Name: admin
    User Password: xxxxxxx
    Confirm User Password: xxxxxxx

    I have place the "activemq-all-5.8.0.jar and slf4j-api-1.6.6.jar" but it was unable to connect to the ActiveMQ. I tried with "activeio-core-3.1.4.jar" also, but getting the given below exception:

    #### <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1380800833216> <Bridge "JMS-ActiveMQ-Bridge" failed to get one of the adapters from JNDI (javax.naming.NameNotFoundException: Unable to resolve 'eis.jms.WLSConnectionFactoryJNDIXA'. Resolved 'eis.jms'; remaining name 'WLSConnectionFactoryJNDIXA').
    javax.naming.NameNotFoundException: Unable to resolve 'eis.jms.WLSConnectionFactoryJNDIXA'. Resolved 'eis.jms'; remaining name 'WLSConnectionFactoryJNDIXA'
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)

    Can you please help me on the same?

    --

    Thanks

    ReplyDelete
  4. What will be the scenario if I don't have bridge?? Is it possible to write MDB classes to listen messages in IBM MQs.??

    ReplyDelete