Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I hold a message from flowing until a dependant service completes
    text
    copied!<p>I have a message channel through which one endpoint can send a message to the other. Now, whenever a message comes to the channel I want an internal business service be invoked, lets suppose the service counts the number of messages passing through the channel. However, what I don't want is to let the message pass through until the service method returns.</p> <p>What sort of channel and endpoint configuration can make this happen?</p> <p>A couple of points to note:</p> <ul> <li>A periodic poller on the receiving end doesn't fulfil the requirement as the poller is neither aware of the arrival of a message into the channel, nor it knows when the service method returns</li> <li>The service method is not interested in the content of the message.<br> It just needs to be invoked (with no args) as soon as a message<br> arrives. Neither it returns anything. This is why using a filter won't be an ideal solution (where the filter simply carries forward any incoming message and invokes the service method in between)</li> </ul> <p><strong>Edit:</strong> One possible thing that could happen with the service method is it may throw an exception. In such a scenario the message shouldn't be let go and something else needs to be done. But the reason of exception is not related to the message payload as it doesn't do anything with the payload. It just increments a message counter, for example. That is why I mentioned the message itself should not (ideally) be sent to the service method, it just needs to be triggered appropriately and the channel should allow the message to be dispatched to the final endpoint once the service method has successfully returned. (I am just thinking, rather than the service method having the possibility of throwing an exception you may consider returning a boolean value instead; i.e. true if passed and false otherwise)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload