Results 1 to 5 of 5

Thread: one-way send in publisher-subscriber

  1. #1
    Join Date
    Jun 2009
    Posts
    2

    Default 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. #2
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

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

  3. #3
    Join Date
    Jun 2009
    Posts
    2

    Default

    Thanks.

    I did the changes and it works.

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

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    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.

  5. #5
    Join Date
    Jun 2009
    Posts
    5

    Default 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 :mohanbhimineni@gmail.com

    its very very urgent
    ASAP

    Thanks
    Mohan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •