Announcement Announcement Module
Collapse
No announcement yet.
one-way send in publisher-subscriber Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • one-way send in publisher-subscriber

    Hi guys,

    I have some problems with implement a simple publiser-subscriber patter using and ActiveMq topic.
    I want to implement a producer which sends a message ( in fire-and-forget style) and some consumers which consumes these messages.

    I've managed to implement both the producer and the consumer, but I cannot configure my producer be able to send one-way ( anych ) message without waiting for the response.

    The message sent by the producer arrives to the consumer, but the problem is that I get an ungly exception on producer side because the reply has timed out.

    INFO 2009-06-04 10:30:52,464 org.springframework.integration.gateway.SimpleMess agingGateway:87 [main] - started org.springframework.integration.gateway.SimpleMess agingGateway@16c9867
    Exception in thread "main" org.springframework.integration.message.MessageTim eoutException: failed to receive JMS response within timeout of: 5000ms

    Here is my client configuration:

    <amq:connectionFactory id="connectionFactory" brokerURL="tcp://localhost:61616"></amq:connectionFactory>
    <amq:topic id="testTopic" physicalName="testTopic"/>

    <siublish-subscribe-channel id="myChannel" />

    <jms:outbound-gateway id="jmsGateway" request-destination="testTopic"
    request-channel="myChannel" />
    <si:gateway id="client" service-interface="com.test.pubsub.Producer" />

    The problem is in "<jms:outbound-gateway" which can handle only synchronouse calls.

    What else I can try, except using the low level progrmatic JMS api.

    I guess spring should have some support for handling this problem, because it is a common use case ?

  • #2
    Try code tags and jms:*-channel-adapter instead of gateways. Gateways are for bidirectional communication, channel adapters for unidirectional.

    Comment


    • #3
      Thanks.

      I did the changes and it works.

      <jms:outbound-channel-adapter id="jmsGateway" destination="testTopic" channel="myChannel" />

      Comment


      • #4
        Glad to hear that it's working. I just wanted to clarify what that triggered the original error. When using outbound-gateway, it expects a response Message (e.g. the other side could be a Spring Message-Driven POJO with a non-void return type on the adapted method). The outbound-gateway is therefore a synchronous request/reply operation itself. The timeout was occurring while waiting for that response. When all you want to do is send a message and return immediately, then use the outbound-channel-adapter. The same general idea applies to other gateway vs. channel-adapter components in Spring Integration.

        Comment


        • #5
          producer and consumer example using JMS with spring and activeMQ

          Hi,
          This is MOhan
          can anybody have idea about "producer and consumer example using JMS with spring and activeMQ"

          if you have any example related to that please mail me :[email protected]

          its very very urgent
          ASAP

          Thanks
          Mohan

          Comment

          Working...
          X