Simple EIP pattern hard to do?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Simple EIP pattern hard to do?

Pierce Wetter-2

  So I'm trying to do service composition in the ESB, where I publish an API using REST that internally will make multiple service calls and then produce a result at the end. But it seems harder than it needs to be. I can also do everything with a custom mediator, but I was wondering if its possible to get a super-simple version of Aggregate that just waits for the sent messages to return but doesn't try to parse them for me. 

  Here's a simple example:

public API:


 Internal API 1:

   /lookupUser/{magicCode}      (given a magic code, returns the user id)

  /dosSomethingWithuser/{userId}     (given a user id, do something)

So this seems like it should be simple to do, the steps are:

  1. Rewrite the incoming URL from /myapi/ to /lookupUser
  2. Send message to /lookupUser service. 
  3. Wait for answer. 
  4. Parse result (which is in JSON, not well formed for XML conversion!) set "userId" property. 
  5. Turn off "RESPONSE". 
  6. Rewrite URL again. 
  7. Send to /doSomethingWithUser URL. 
  8. Forward result back to original sequence. 

 At first blush, there are the clone and iterate mediators combined with the Aggregate mediator, but this is kind of complicated. What I really want is of a  "blockingSend" that would pause a sequence until the response comes in. Callout does this, but in a kind of cumbersome way, and it blocks the calling thread. 

 So I'm writing my own mediator at this point that does all the work, but I thought I would check with the list to see if I was just being stupid. 


Esb-java-user mailing list
[hidden email]