How to connect JMS queues from JBOSS 4 and 5?

丶灬走出姿态 提交于 2019-12-05 20:50:01

I think I found the solution for my problem. The JBOSS documentation has a chapter to migrate messages between JBOSS Messaging and JBOSS MQ: http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/5.0.0.BETA/html/JBoss_Messaging_User_Guide/inst-mqmessagemigration.html

I have 2 topics myTopicSend and myTopicReceive on my JBOSS 4.2 and I have 2 topics myTopicSend5 and myTopicReceive5 on JBOSS 5.1.

I wanted to bridge all messages from myTopicSend to myTopicReceive5 and from myTopicSend5 to MyTopicReceive.

Somehow the configuration didn't work at all first, but after some time of experimenting I have now the following config:

<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
       name="jboss.messaging:service=JMSProviderLoader,name=RemoteJBossMQProvider">
    <attribute name="ProviderName">RemoteXAConnectionFactory</attribute>
    <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
    <attribute name="FactoryRef">XAConnectionFactory</attribute>
    <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
    <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
    <attribute name="Properties">
        java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
        java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
        java.naming.provider.url=127.0.0.1:1099
    </attribute>
</mbean> 

<mbean code="org.jboss.jms.server.bridge.BridgeService"
       name="jboss.messaging:service=Bridge,name=LegayBridgeSend" xmbean-dd="xmdesc/Bridge-xmbean.xml">
    <depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=RemoteJBossMQProvider</depends>
    <depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
    <attribute name="SourceDestinationLookup">/topic/myTopicSend</attribute>
    <attribute name="TargetDestinationLookup">/topic/myTopicReceive5</attribute>
    <attribute name="QualityOfServiceMode">0</attribute>
    <attribute name="MaxBatchSize">1</attribute>
    <attribute name="MaxBatchTime">-1</attribute>
    <attribute name="FailureRetryInterval">5000</attribute>
    <attribute name="MaxRetries">-1</attribute>
    <attribute name="AddMessageIDInHeader">false</attribute>
</mbean>

<mbean code="org.jboss.jms.server.bridge.BridgeService"
       name="jboss.messaging:service=Bridge,name=LegayBridgeReceive" xmbean-dd="xmdesc/Bridge-xmbean.xml">
    <depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
    <depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=RemoteJBossMQProvider</depends>
    <attribute name="SourceDestinationLookup">/topic/myTopicSend5</attribute>
    <attribute name="TargetDestinationLookup">/topic/myTopicReceive</attribute>
    <attribute name="QualityOfServiceMode">0</attribute>
    <attribute name="MaxBatchSize">1</attribute>
    <attribute name="MaxBatchTime">-1</attribute>
    <attribute name="FailureRetryInterval">5000</attribute>
    <attribute name="MaxRetries">-1</attribute>
    <attribute name="AddMessageIDInHeader">false</attribute>
</mbean>

A important thing I realized was, to tweak the MaxBatchSize and MaxBatchTime parameters, because I want to deliver the messages immediately to the target queue.

A description of these parameters may be found at http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/5.0.0/html/JBoss_Messaging_1.4.6/index.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!