Author |
Message
|
cutejigs |
Posted: Tue Mar 26, 2013 10:34 pm Post subject: Synchronous messaging |
|
|
Novice
Joined: 20 Jan 2010 Posts: 20
|
hi gurus,
i have requirement to make an asynchronous messaging into synchronous messaging. the flow works like this:
Flow 1
MQInput Node -> JavaCompute Node -> TCPIPServer Input
Flow 2
TCPIPServer Output -> JavaCompute Node -> MQOutput Node
Flow 1 gets, transforms and sends the request message to the TCPIP.
Flow 2 gets the response and add the response to the original request (from Flow 1) and send this to MQOutput Node.
my challenge is now is i can not use any database to store the original request from Flow 1. aside from this, the response that i will be sending for Flow 2 should include the original headers (basically the whole request plus an additional element coming from the response).
i already tried using static Java objects to store the original request (putting the MbMessage as an object and as a bitstream) but still no success. i also saw on the InfoCenter that caching MbMessage and MbElement objects are not supported.
what i basically tried to do is save the original request including the headers for later retrieval when a response was receieved from TCPIPServer output. could you guys help me in resolving this problem?
thanks! |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Mar 27, 2013 12:42 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Aggregation!
Read, learn, experiment, learn and away you go. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Esa |
Posted: Wed Mar 27, 2013 12:49 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
check what I just replied in the other thread where you asked the same questions. |
|
Back to top |
|
 |
cutejigs |
Posted: Wed Mar 27, 2013 3:22 pm Post subject: |
|
|
Novice
Joined: 20 Jan 2010 Posts: 20
|
thanks esa! sorry for double posting, i just thought i might not be really clear on what objective i am trying to achieve.
@smdavies i tried to use that approach but notice that some responses are being sent on the incorrect requestor (which i am still investigating). |
|
Back to top |
|
 |
McueMart |
Posted: Thu Mar 28, 2013 4:10 am Post subject: |
|
|
 Chevalier
Joined: 29 Nov 2011 Posts: 490 Location: UK...somewhere
|
Firstly can we clarify a few things:
Is your broker flow initiating the connection to an external application over TCP? If so I would have expected you should be using the TCPIPClient nodes. (TCPIPServer nodes are when an external application initiates a connecting into the Broker).
So if im correct your flows would actually look like:
Flow 1:
MQInput -> JavaCompute -> TCPIPClient Output
Flow 2:
TCPIPClient Input -> JavaCompute -> MQOutput
So what you could do, without actually changing the data you are sending over TCP (in order to insert a unique ID in it), is do something like this:
Flow 1:
MQInput -> JavaCompute -> TCPIPClient Output --> JavaCompute (1) --> MQOutput
Flow 2:
TCPIPClient Input -> JavaCompute (2) -> MQGet -> JavaCompute -> MQOutput
In javaCompute (1) you would use the LocalEnvironment to read in the connection ID (which I *think* is relatively unique!), and then use that to put the original message on a queue (setting the CorrelId equal to the TCPIP connection ID).
In JavaCompute (2) you would do the reverse, and use the connection ID (from the LocalEnvironment) to set up the CorrelID in order to do a MQGet to retrieve the original message.
This all seems quite convoluted but I reckon it would work!
(Or of course you could learn how to use Aggregation and send an Echo message to the Fan-In! ) |
|
Back to top |
|
 |
cutejigs |
Posted: Mon Apr 01, 2013 10:31 pm Post subject: |
|
|
Novice
Joined: 20 Jan 2010 Posts: 20
|
thanks McueMart! I will try it now.
As for the TCP connection, I am using TCPIP Server nodes as the external application is initiating the connection.
Cheers. |
|
Back to top |
|
 |
Esa |
Posted: Mon Apr 01, 2013 11:56 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
cutejigs wrote: |
As for the TCP connection, I am using TCPIP Server nodes as the external application is initiating the connection.
|
cutejigs wrote: |
Flow 1
MQInput Node -> JavaCompute Node -> TCPIPServer Input
|
You cannot have a flow like that. TCPIPServerInput is an input node: it doesn't have any input terminals. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 02, 2013 4:47 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Go find a whiteboard. Ideally one that has a lot of writing on it and says "Do not erase".
Erase it. You have my permission.
Draw on it a box. Label this box "external application". Draw another box, labeled "broker". Draw lines between these two boxes that indicate what data is flowing in what direction.
Draw a bigger box, labeled "message flow". Draw lines coming into that box that correspond to lines coming into the box labeled "Broker" on the other picture. Draw lines going out of this "message flow" box that correspond to lines coming out of the box labeled "broker" on the other picture.
Each line that comes into the "message flow" box must end at an Input node of some kind.
Each line that leaves the "message flow box" must start at an Output node of some kind.
Now figure out the bits in the middle. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Apr 02, 2013 5:05 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
cutejigs |
Posted: Tue Apr 02, 2013 4:04 pm Post subject: |
|
|
Novice
Joined: 20 Jan 2010 Posts: 20
|
@esa sorry, my mistake. it should have been:
Flow 1
MQInput Node -> JavaCompute Node -> TCPIPServer Output
Flow 2
TCPIPServer Input -> JavaCompute Node -> MQOutput Node
@mqjeff/lancelotlinc you guys are genius! it did solve my problems! you are such a big help! i cant thank you enough for that contribution!  |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 02, 2013 4:46 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
cutejigs wrote: |
@mqjeff/lancelotlinc you guys are genius! it did solve my problems! you are such a big help! i cant thank you enough for that contribution!  |
The boys live to help. Glad to hear you got it all sorted.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 03, 2013 6:34 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
cutejigs wrote: |
@esa sorry, my mistake. it should have been:
Flow 1
MQInput Node -> JavaCompute Node -> TCPIPServer Output
Flow 2
TCPIPServer Input -> JavaCompute Node -> MQOutput Node
@mqjeff/lancelotlinc you guys are genius! it did solve my problems! you are such a big help! i cant thank you enough for that contribution!  |
I'd have been more directly helpful if I were able to understand what the problem being asked about really was.
Since it seemed you were either having difficulty understanding it yourself or explaining it, I chose to indicate my confusion by asking you to at least clarify it for yourself.
Also, I'm glad that you understood that I was making fun of myself when I acted pompous and authoritative!
Every time I speak like that, I am making fun of myself. |
|
Back to top |
|
 |
|