IBM Integration Bus - TCP Nodes - Request Response Mismatch - ibm-integration-bus

I have a sample message flow where a TCP Output Node communicates to an external system and receives response to a TCP Client receive node. My issue is, is there a way whether I can ensure that the TCP request and TCP response are correctly mapped and processed. We have observed in certain circumstances few request and responses getting mismatched. I understand there is a $LocalEnvironment/Destination/TCPIP/Output/Id property in the TCP IP Client Output Node and $LocalEnvironment/TCPIP/Receive/Id in the TCP IP Client receive Node. Should these be same for a single request and response? Should I write an ESQL check to ensure the request and response are correlated? Any advice would be very much helpful.

Related

How to initiate route discovery before data transmission in multihop network?

I am studying X-MAC in multihop sensor network. I am using AODV as a routing protocol. During run time, at the beginning, I can see that the sensor node starts sending preambles before any route discovery. So, until any route is established these preambles are sent for nothing.
I also studied the same network with csma/ca, in which the route is established first and then the node initiate transmission.
As per suggestions given in OmNET++ group, I tried the following, but it did not resolve the issue.
**.useHelloMessages = true
Would anyone please advice how to configure X-MAC so that when the simulation starts, a node will first establish a route and then it will send preambles for data communication?
Thank you.
At the start of the simulation, there are no routes. So when one of the nodes have some data to send (they contain a TCP app that generates a TCP packet, for example), the AODV initiates route discovery to the destination of the data (the TCP packet).
Aodv does this route discovery by sending an Aodv route request message (AodvRreq). The message indicates that the node wants to discover a route to the destination of the data.
Aodv is implemented as an app in INET, and it sends its route request (and other) messages encapsulated in UDP packets.
The packets (aodv or data) go down the protocol stack to the XMAC for transmission.
So, from the point of view of the XMAC, the Aodv route request message (which is triggered by the node wanting to send TCP data) is itself treated as data (since it uses UDP). In order to send data, the XMAC first sends preambles.
(Answer edited for more details)

Spring TCP Integration only reads every 30+ seconds

I'm having an issue making a TCP Server using Spring-Integration.
I've set my server up to accept TCP Connections from a black box client. The client will connect to the server and start periodically sending it string data.
What I'm seeing is after the connection is established (I get confirmation from the client side) I don't receive a print statement on the server until about 30 seconds have passed, where I get 5 messages all at once.
I've monitored incoming data over wireshark and the client is sending data at regular intervals, but the server doesn't read from the incomingStream frequently enough. Is there a way to configure the TcpServer that it reads data from incoming clients more frequently?
fun flow() = IntegrationFlows.from(
Tcp.inboundAdapter(Tcp.nioServer(port).serializer(ByteArrayRawSerializer()).deserializer(ByteArrayRawSerializer()))
.errorChannel(errorChannel())
)
.transform(ObjectToStringTransformer())
.handle { payload: String, headers: MessageHeaders ->
println(payload)
}
.get()
The ByteArrayRawSerializer uses the socket close to detect the end of a message.
TCP is a streaming protocol and, if you want to send multiple messages over the socket, you need to delimit the data somehow so the server can determine when one message ends and the next one starts. See the documentation.
TCP is a streaming protocol. This means that some structure has to be provided to data transported over TCP so that the receiver can demarcate the data into discrete messages. Connection factories are configured to use serializers and deserializers to convert between the message payload and the bits that are sent over TCP. This is accomplished by providing a deserializer and a serializer for inbound and outbound messages, respectively. Spring Integration provides a number of standard serializers and deserializers.
...
The ByteArrayRawSerializer, converts a byte array to a stream of bytes and adds no additional message demarcation data. With this serializer (and deserializer), the end of a message is indicated by the client closing the socket in an orderly fashion. When using this serializer, message reception hangs until the client closes the socket or a timeout occurs.
My guess is the client is not closing the connection after sending the message and there is a 30 second SO timeout (either on the client or server - you don't show your connection factory configuration).

Are TCP Packets Received when Requested

I have a server process running that listens on a port. I can establish the connection with this port, but when I try to send data, the client reports that data has been sent, while the server never receives it.
I am using WireShark to trace the data, and I can't find the data packet I sent, which means it was never received. So here's my question. Does this mean that:
The packet has never reached the network adapter on the server side?
or,
The server process never called the receiving API (recv() or equivalent)?
In other words, are TCP packets transmitted only when the receiving side calls the receiving API, or are they transmitted automatically whenever they are sent, and the receiving API only reads the buffered data?

TCP state for a given slanger/pusher channel?

We are building a large slanger cluster and would like to use websocket TCP as client connectivity indicator, so whenever a client is offline we could tell from the channel state. Is there an API to check online/offline status of a channel?
Besides that, is there a way to get the TCP fd of the websocket beneath a channel? So I can grab some statistics of that long connection.
OK after reading through Slanger's source code I have concluded that it is not possible. I modified slanger/lib/subscription.rb to have my own customized tcp status exposed via http api.

How can I know if the message sent by websocket success or not

I developed a chat server using websocket in cowboy, but I want to know if the message sent by server to client success.How can I know?
Websocket is a rather thin abstraction layer on top of a conventional TCP socket. After the initial handshake the difference is minimal. So, the question is: how do I know if a data chunk was received by the remote peer? The short answer: only if the peer acknowledges it explicitly by the means of application-level protocol. Remote client will send TCP ACK packets for every data packet you will send it, but this fact is well hidden from the application for good reasons. Receiving ACK packet only means that remote TCP stack has dealt with it, but says nothing about how (and if) the client application has processed it.
Add a special "acknowledge receive" message type to your chat protocol. Include a monotonically increasing sequence number in all of your outgoing messages, and include the SN of the received message in the ACK message to know exactly how much data the client has already processed.

Resources