Announcement Announcement Module
Collapse
No announcement yet.
message-driven sending to JMS queue? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • message-driven sending to JMS queue?

    Is there any way to do message driven sending to a JMS queue? Using an outbound-channel-adapter appears to set up a queue which is then polled, whereas I want to send the message to JMS synchronously so that any failure to send can roll back the transaction on the original thread.

    I've got a simple chain that uses a message-driven-channel-adapter to receive a message, pass it through a couple of transformations, and then send it to another JMS queue. If sending to the outbound queue fails, I need the entire message delivery to roll back, but, as I understand it, if any channel in the chain uses a polled queue, then traversing that channel breaks the transactional chain. It seems as though the only message-driven mechanism for sending to JMS is an outbound gateway, but that expects a response. I couldn't figure out a way to use an outbound-gateway to send a message and then just immediately return. Instead, I get an exception about response timeout.

    Is there some way to force an outbound-channel-adapter to operate synchronously (or am I mistaken about its function? If there is no poller configured, spring complains, and enabling debug logging shows rapid polling happening)? Or is there some way to use outbound-gateway to do message-driven send without waiting for a non-existent response?

    Code:
      <jms:message-driven-channel-adapter
        id="pssIn" 
        destination="pssQueue" 
        channel="pssInputChannel"
        max-concurrent-consumers="1" 
        acknowledge="transacted" />
    
      <channel id="pssInputChannel" />
    
      <chain id="listenerChain" input-channel="pssInputChannel">
        <int-xml:unmarshalling-transformer unmarshaller="jmsMarshaller"/>
        <header-enricher>
          <header name="JMSXGroupID" ref="messageGrouper" method="addGroupHeader" />
        </header-enricher>
        <int-xml:marshalling-transformer marshaller="jmsMarshaller" result-transformer="resultTransformer"/>    
        <jms:outbound-channel-adapter destination="workQueue" header-mapper="headerMapper" />    
      </chain>

  • #2
    It is not at all clear what you are asking. With your configuration above (you don't have any queue channels), the send to the outbound adapter will happen on the inbound adapter's thread and will participate in the same transaction as the inbound message.

    Comment


    • #3
      Originally posted by Gary Russell View Post
      It is not at all clear what you are asking. With your configuration above (you don't have any queue channels), the send to the outbound adapter will happen on the inbound adapter's thread and will participate in the same transaction as the inbound message.
      That's what I was asking. Thanks

      Comment

      Working...
      X