Como conectar filas JMS de JBoss 4 e 5?
Pergunta
Eu tenho um servidor no qual um JBoss 4.2.2 e um JBoss 5.1.0 são executados. O problema é que uma terceira parte não é capaz de atualizar sua aplicação para o JBoss 5.1.0 em um futuro próximo, para nós é uma questão simples. Infelizmente, precisamos enviar e receber algumas mensagens JMS do aplicativo de terceiros em execução no JBoss 4.2.2.
Qual é a maneira mais fácil de permitir a transferência de mensagens JMS entre JBossMQ e JBossMessaging?
Solução
Acho que encontrei a solução para o meu problema. A documentação do JBoss tem um capítulo para migrar mensagens entre as mensagens JBoss e o 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
Eu tenho 2 tópicos mytopicsnd e MyTopicReceive no meu jboss 4.2 e eu tenho 2 tópicos mytopicsend5 e mytopicreceive5 no jboss 5.1.
Eu queria preencher todas as mensagens do mytopicsnd para mytopicreceive5 e do mytopicsnd5 para o mytopicceive.
De alguma forma, a configuração não funcionou em primeiro lugar, mas depois de algum tempo de experimento, agora tenho a seguinte configuração:
<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>
Uma coisa importante que eu percebi foi, para ajustar o MaxbatchSize e MaxbatchTime Parâmetros, porque quero entregar as mensagens imediatamente à fila de destino.
Uma descrição desses parâmetros pode ser encontrada em http://www.redhat.com/docs/en-us/jboss_enterprise_application_platform/5.0.0/html/jboss_messaging_1.4.6/index.html