Announcement Announcement Module
Collapse
No announcement yet.
Asynchronous Transitive Processes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Asynchronous Transitive Processes

    I would like to implement a process using Spring Integration where Component A (Ca) and Component B (Cb) publish messages to Component C (Cc) who delegates processing to Component D (Cd):

    Ca ->
    ..........Cc -> Cd
    Cb ->
    Sorry for the above cheap drawing... :.)

    All components must process in an asynchronous way, and all request must be replied to, no thread must block. Basically Cd will reply to Cc which will reply to Ca or Cb depending on where the request was originally coming from. The point is to design a high throughput application.

    I assume that my request has to be cached at each component until the reply returns and gets correlated against the original request.

    Since the reply address is dynamic and depends on information contained in the message, it cannot be defined as a component's static channel.

    How can I invoke dynamically a channel?

    So, (sorry for my complex setup... :.) How should I go about, using Spring Integration, to do the above! :.)

    How can I receive a Message at an Endpoint given a certain payload type without loosing the Message? Currently all examples I have seen show how easy it is to get the payload but they don't show how to also keep the Message so that we can corrolate a future asynchronous response!

    Given my problem what would you recommend to address such an issue?

    Any code sample would be greatly appreciated.

    Thanks,

    Simon

  • #2
    First of all no reason to apologize for the ascii art. Works fine for me.

    You asked three questions, I'll answer two.

    How can I invoke dynamically a channel?
    You can create a router. The router can use any strategy you like to return a string with the channel name. It could get it from the message header, or get it from storage based on the payload hashcode or guess it from the stars if you have an algorithm for that. The easiest way to create a router is to put a MessageEndpoint in the context that has a method annotated with @Router. The cafe demo has an example of that.

    How can I receive a Message at an Endpoint given a certain payload type without loosing the Message?
    Methods can either accept payload or message. Spring Integration will unwrap and toss the message if your method wants the payload, or just pass you the message if your method wants the message.
    Code:
    @Router public String routeMessage(Message m); //will get the message
    @Router public String routePayload(your.domain.Payload m); //will get the payload
    (note that I haven't compiled any of my samples, so they're just for illustration)
    Last edited by iwein; Jul 11th, 2008, 12:40 PM. Reason: typo

    Comment


    • #3
      Thanks

      Thanks for the pointers. It should get me started. So now, given your advice I should be able to have access to the message and using a MessageSelector I should be able to configure the type of payload I am expecting in my message.

      No I only have to decide on the best way to architect my asynchronous request reponse handling strategy...

      Anyone has a pattern or something to recommend for this kind of issue? (maybe this is off topic...)

      Comment

      Working...
      X