Author |
Message
|
arunprasa |
Posted: Tue Nov 28, 2017 2:40 am Post subject: Connecting to TCPservers dynamically |
|
|
Newbie
Joined: 08 Mar 2011 Posts: 4
|
I am unable to override the TCP Hostname and Port dynamically as our requirement is to hit different TCPIP Servers whose IP Address where read from Database based on the input message.
I am trying to override the value like
Code: |
SET OutputLocalEnvironment.Destination.TCPIP.Output.Hostname = ipAddress;
SET OutputLocalEnvironment.Destination.TCPIP.Output.Port = portNumber;
|
where ipAddress & portNumber where retrieved from the database based on the input message country code.
Please help me  |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 28, 2017 6:11 am Post subject: Re: Connecting to TCPservers dynamically |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
arunprasa wrote: |
Please help me  |
What happens when you try it? "Unable to" doesn't give us a lot to work with.
The obvious question is are you certain you've set the Compute node to pass the LocalEnvironment (containing your new values) forward as well as the Message? It's not the default behavior. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
arunprasa |
Posted: Wed Nov 29, 2017 1:04 am Post subject: |
|
|
Newbie
Joined: 08 Mar 2011 Posts: 4
|
Thanks Vitor for the reply.
I am setting the new value which is retrieved from the Database based on my input message and try to pass them in the OutputLocalEnvironment only and also I am sure I am setting the Compute Mode as LocalEnvironment & Message.
What happens is it always takes a default value which is set at the flow level i.e I have promoted the Connections Details and the timeout of TCPIPClientOutput node and the TCPIPClientReceive node
Please find the code snippet for reference :
Code: |
-- Setting Local Environment Variable
DECLARE ipAddress CHARACTER;
DECLARE portNumber INTEGER;
SET ipAddress = CacheDBLookup.DestinationData.COUNTRY_IP;
SET portNumber = CacheDBLookup.DestinationData.COUNTRY_PORT;
SET OutputLocalEnvironment.WrittenDestination.TCPIP.Output.ConnectionDetails.Hostname = ipAddress;
SET OutputLocalEnvironment.WrittenDestination.TCPIP.Output.ConnectionDetails.Port = portNumber;
|
Please help  |
|
Back to top |
|
 |
timber |
Posted: Wed Nov 29, 2017 4:16 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Next step is to prove (to us) that the LocalEnvironment settings really are getting propagated. Best way to do that is to use a Trace node. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Nov 29, 2017 6:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
arunprasa wrote: |
Please help  |
You need to help us by being consistent. Your original post had this
Code: |
SET OutputLocalEnvironment.Destination.TCPIP.Output.Hostname = ipAddress;
SET OutputLocalEnvironment.Destination.TCPIP.Output.Port = portNumber;
|
which is correct and leads us to the suspicion you're not passing the LocalEnvironment.
You then confirm you're passing LocalEnvironment but post this:
Code: |
SET OutputLocalEnvironment.WrittenDestination.TCPIP.Output.ConnectionDetails.Hostname = ipAddress;
SET OutputLocalEnvironment.WrittenDestination.TCPIP.Output.ConnectionDetails.Port = portNumber;
|
which is incorrect (WrittenDestination is the actual destination used & is output by the TCP node, Destination is the desired destination & is input to the TCP node). So this second code snippet won't work even if the Compute mode is set correctly.
So to help you:
- set the Compute mode correctly
- code the ESQL correctly
- post again once you've done that if you're still having trouble and include (as my worthy associate states) the output from a Trace node that shows the override details in the correct place, in the LocalEnvironment tree and a user trace showing them being passed to the TCP node and the node then using the default ones in it's connection. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
arunprasa |
Posted: Mon Dec 04, 2017 2:22 am Post subject: Update |
|
|
Newbie
Joined: 08 Mar 2011 Posts: 4
|
Apologies for the late reply, as I am not available last week.
As advised, I have added a trace node to check the value being set in the local environment, but I can still see the value we pass at the flow level is being taken and not the one which I am extracting from database.
Code: |
My Database Contains as follows (Ip Address and PortNumber)
COUNTRY_ISO COUNTRY_IP COUNTRY_PORT COUNTRY_NAME
UG 10.250.52.90 8774 UGANDA
|
Please find the trace logs generated while executing :
['MQROOT' : 0x228b46b0]
(0x01000000:Name):WrittenDestination = (
(0x01000000:Name):TCPIP = (
(0x01000000:Name):Output = (
(0x01000000:Name):ConnectionDetails = (
(0x03000000:NameValue):Type = 'Client' (CHARACTER)
(0x03000000:NameValue):Hostname = '10.250.52.86' (CHARACTER)
(0x03000000:NameValue):Port = 8774 (INTEGER)
(0x03000000:NameValue):Id = '793289:16007d8239d:-7fee' (CHARACTER)
(0x03000000:NameValue):ReplyId = NULL
(0x03000000:NameValue):OpenTimestamp = TIMESTAMP '2017-12-04 12:17:25.995' (TIMESTAMP)
(0x03000000:NameValue):CloseTimestamp = NULL
(0x01000000:Name ):SequenceNumber = (
(0x03000000:NameValue):InputRecord = 0 (INTEGER)
(0x03000000:NameValue):OutputRecord = 1 (INTEGER)
['MQROOT' : 0x228b2770]
(0x01000000:Name):TCPIP = (
(0x01000000:Name):Receive = (
(0x01000000:Name):ConnectionDetails = (
(0x03000000:NameValue):Type = 'Client' (CHARACTER)
(0x03000000:NameValue):Hostname = '10.250.52.86' (CHARACTER)
(0x03000000:NameValue):Port = 8774 (INTEGER)
(0x03000000:NameValue):Id = '793289:16007d8239d:-7fee' (CHARACTER)
(0x03000000:NameValue):ReplyId = NULL
(0x03000000:NameValue):OpenTimestamp = TIMESTAMP '2017-12-04 12:17:25.995' (TIMESTAMP)
(0x03000000:NameValue):CloseTimestamp = NULL
(0x01000000:Name ):SequenceNumber = (
(0x03000000:NameValue):InputRecord = 1 (INTEGER)
(0x03000000:NameValue):OutputRecord = 1 (INTEGER)
)
To summarise, the value I am setting in LocalEnvironment is not being taken and it always taking the value we set at the flow level (10.250.52.86:8774) and not from database (10.250.52.90:8774)
Thanks. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 04, 2017 6:02 am Post subject: Re: Update |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
arunprasa wrote: |
To summarise, the value I am setting in LocalEnvironment |
Setting in the wrong place. See my comments above. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
arunprasa |
Posted: Tue Dec 05, 2017 12:13 am Post subject: |
|
|
Newbie
Joined: 08 Mar 2011 Posts: 4
|
The issue is now resolved and now I can pass the TCPIPClientOutput Nodes (ConnectionDetails & Timeout Value) dynamically and it is taking the values which is extracted from the database based on the CountryISO in the input request XML.
Thanks to All for your guidance & Support in resolving this issue.
Resolution : As advised by Vitor I have set the OutputLocalEnvironment as follows and also changed the Compute Mode properties to consider both LocalEnvironment and Message
Code: |
SET OutputLocalEnvironment.Destination.TCPIP.Output.Hostname = ipAddress;
SET OutputLocalEnvironment.Destination.TCPIP.Output.Port = portNumber;
|
 |
|
Back to top |
|
 |
|