1 2 3 4 Previous Next 46 Replies Latest reply: Dec 7, 2009 11:37 PM by Matthew Li Go to original post RSS
  • 15. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    Yes, that was my first attempt, too. But the problem was that using the plain jndi lookup caused classcasts between jboss and activemq. I don't have the actual stacktrace before me, but I can get back to you on that.

    BTW, ActiveMQ standalone does not include a fully functional jndi server, that may be what caused the problem in the first place.

  • 16. Re: Remote replyto functionality - Bridge configuration in p
    Tim Fox Master

    Did you add the active mq jar file in jboss?

  • 17. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    Yes, I have activemq in the classpath. The stacktrace you get when doing things as you suggest is this:

  • 18. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    08:50:08,328 WARN [Bridge] Failed to send + acknowledge batch, closing JMS objects
    javax.jms.InvalidDestinationException: Destination cannot be foreign
    at org.jboss.jms.message.JBossMessage.setJMSDestination(JBossMessage.java:469)
    at org.jboss.jms.message.MessageProxy.setJMSDestination(MessageProxy.java:198)
    at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1507)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:465)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:356)
    at org.jboss.jms.server.bridge.Bridge.sendBatch(Bridge.java:1201)
    at org.jboss.jms.server.bridge.Bridge.access$1600(Bridge.java:64)
    at org.jboss.jms.server.bridge.Bridge$SourceListener.onMessage(Bridge.java:1422)
    at org.jboss.jms.client.remoting.MessageCallbackHandler.callOnMessage(MessageCallbackHandler.java:153)
    at org.jboss.jms.client.remoting.MessageCallbackHandler$ListenerRunner.run(MessageCallbackHandler.java:884)
    at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)

  • 19. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    My take on this stack is that you are attempting to resend a JBossMessage (it is a JBossMessageProxy) using an ActiveMQ session. Please enlighten me if you still feel this should work out of the box.

  • 20. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    Please ignore the line number on Bridge.java since I have commented the class locally (but it is functionally untouched).

  • 21. Re: Remote replyto functionality - Bridge configuration in p
    Tim Fox Master

     

    "thomasra" wrote:
    08:50:08,328 WARN [Bridge] Failed to send + acknowledge batch, closing JMS objects
    javax.jms.InvalidDestinationException: Destination cannot be foreign
    at org.jboss.jms.message.JBossMessage.setJMSDestination(JBossMessage.java:469)
    at org.jboss.jms.message.MessageProxy.setJMSDestination(MessageProxy.java:198)
    at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1507)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:465)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:356)
    at org.jboss.jms.server.bridge.Bridge.sendBatch(Bridge.java:1201)
    at org.jboss.jms.server.bridge.Bridge.access$1600(Bridge.java:64)
    at org.jboss.jms.server.bridge.Bridge$SourceListener.onMessage(Bridge.java:1422)
    at org.jboss.jms.client.remoting.MessageCallbackHandler.callOnMessage(MessageCallbackHandler.java:153)
    at org.jboss.jms.client.remoting.MessageCallbackHandler$ListenerRunner.run(MessageCallbackHandler.java:884)
    at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)


    Please can you post your bridge config.


  • 22. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    This is from JBM to ActiveMQ. The "outbound" queue is mapped in the Properties section of my ProviderLoader (attached below the bridge xml).

    <?xml version="1.0" encoding="UTF-8"?>
    
    <!--
     Example Message Bridge configurations
    
     $Id: destinations-service.xml 1930 2007-01-09 18:16:04Z timfox $
     -->
    
    <server>
    
     <mbean code="org.jboss.jms.server.bridge.BridgeService"
     name="com.nordpool:service=Bridge,name=BridgeToOM"
     xmbean-dd="xmdesc/Bridge-xmbean.xml">
    
     <attribute name="SourceProviderLoader">jboss.mq:service=JMSProviderLoader,name=JMSProvider</attribute>
    
     <attribute name="TargetProviderLoader">jboss.mq:service=JMSProviderLoader,name=ActiveMQJMSProvider</attribute>
    
     <attribute name="SourceDestinationLookup">topic/out</attribute>
    
     <attribute name="TargetDestinationLookup">outbound</attribute>
    
     <attribute name="SourceUsername">test</attribute>
    
     <attribute name="SourcePassword">test</attribute>
    
     <attribute name="TargetUsername">test</attribute>
    
     <attribute name="TargetPassword">test</attribute>
    
     <attribute name="QualityOfServiceMode">0</attribute>
    
     <attribute name="Selector">SERVICE='om'</attribute>
    
     <attribute name="MaxBatchSize">1</attribute>
    
     <attribute name="MaxBatchTime">1</attribute>
    
     <attribute name="SubName">bridge</attribute>
    
     <attribute name="ClientID">bridge-id</attribute>
    
     <attribute name="FailureRetryInterval">1000</attribute>
    
     <attribute name="MaxRetries">2</attribute>
    
     </mbean>
    
    
    </server>
    


    The provider ds.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <connection-factories>
    
     <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
     name="jboss.mq:service=JMSProviderLoader,name=ActiveMQJMSProvider">
     <attribute name="ProviderName">ActiveMQJMSProvider</attribute>
     <attribute name="ProviderAdapterClass">
     org.jboss.jms.jndi.JNDIProviderAdapter
     </attribute>
     <!-- The combined connection factory -->
     <attribute name="FactoryRef">ConnectionFactory</attribute>
     <!-- The queue connection factory -->
     <attribute name="QueueFactoryRef">ConnectionFactory</attribute>
     <!-- The topic factory -->
     <attribute name="TopicFactoryRef">ConnectionFactory</attribute>
     <attribute name="Properties">
     java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
     java.naming.provider.url=tcp://externalhost:61616
     queue.inbound=OM.from
     queue.outbound=OM.to
     </attribute>
    
     </mbean>
    
    </connection-factories>
    


  • 23. Re: Remote replyto functionality - Bridge configuration in p
    Tim Fox Master

    What version of ActiveMQ are you running?

  • 24. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    The version of ActiveMQ is vanilla 4.1.1.

    Like I said earlier: using a connectionfactory and a rar file, along with actually creating a new Message from the ActiveMQ session, copying the content to the new message _does_ work.

  • 25. Re: Remote replyto functionality - Bridge configuration in p
    Tim Fox Master

     

    "thomasra" wrote:
    The version of ActiveMQ is vanilla 4.1.1.

    Like I said earlier: using a connectionfactory and a rar file, along with actually creating a new Message from the ActiveMQ session, copying the content to the new message _does_ work.


    That shouldn't be necessary. Part of the JMS spec says a JMS 1.1 compliant provider *must* be able to to accept messages from another JMS provider for sending (this is called a foreign message).

    I'm not sure if ActiveMQ is JMS compliant - I shall take a look at their source and see....

  • 26. Re: Remote replyto functionality - Bridge configuration in p
    Thomas Roka-Aardal Newbie

    Actually, what also works is to not use a rar (just use a providerloader) but still create a new message on the target session.

    Please note that the class throwing the exception is JBossMessage on the setDestination...if the spec claims that 1.1 compliant providers should allow foreign messages doesn't this really mean that it is JBM that is not compliant? ;)

  • 27. Re: Remote replyto functionality - Bridge configuration in p
    Tim Fox Master

    Looking at the ActiveMQ 4.1.1 code it seems it does have code that transforms foreign messages into its own format, but the transformation code is called *after* ActiveMQ has set the destination on the foreign message.

    What it should be doing is calling setDestination() on the message *after* it has been transformed (then it will be an ActiveMQ message). (This is what JBM does)

  • 28. Re: Remote replyto functionality - Bridge configuration in p
    Tim Fox Master

     

    "thomasra" wrote:
    .if the spec claims that 1.1 compliant providers should allow foreign messages doesn't this really mean that it is JBM that is not compliant? ;)


    How does that make JMS non compliant?

    The spec says a JMS provider must be able to take a foreign message for sending, not that a message implementation must be able to allow a foreign destination to be set on it.

  • 29. Re: Remote replyto functionality - Bridge configuration in p
    Tim Fox Master

    Anyway, it would be easy to make a small code change to workaround the ActiveMQ behaviour.

    I don't have ActiveMQ set up here, so maybe you could try this:

    Remove this code from JBossMessage::setDestination()

    if (!(destination instanceof JBossDestination))
     {
     throw new InvalidDestinationException("Destination cannot be foreign");
     }
    


    Also we should probably add a sanity check in ProducerAspect::handleSend() to check if the destination is actually a JBossDestination, in case someone is actually stupid enough to try and send a message to JBM with a foreign destination set.