JMSCorrelationID capture in OSB 12c flow - jms

I have a scenario where I am invoking a JMS adapter in OSB 12.2.1.4 and want to capture both request and response JMSCorrelationID as a message to ensure its coorilation matching..
I am able to capture the inbound ID with help of $inbound/ctx:transport/ctx:request/tp:headers/jms:JMSCorrelationID)
but when I truy to capture response side, it never captured in varaible. I am using
$outbound/ctx:transport/ctx:response/tp:headers/jms:JMSCorrelationID expression..
any help here please.

Related

Websocket from UI connecting to one of the instances for Spring boot application for streaming the data coming on a queue

I have an UI application (displays streaming) which makes a WebSocket connection to the Spring Boot microservice (multiple JVM'S) and this service forwards the request to one of the upstream servers and listens to the responses on a JMS queue coming from upstream server, which then response messages had to be returned to the socket.
Issue we are facing is since the socket is point to point, and the Spring Boot application is running on multiple instances which all are listening to the same JMS queue we are unable to serve the data back to the WebSocket when a message is received on a instance which the request to upstream wasn't made.
Here's the basic flow:
WebSocket -> instance1, instance2, instance3 -> Data provider
Instance1 made the request to data provider.
Data provider sends the data back to the queue
Instance 3 receives the message, but it doesn't have the socket connection to send the data back.
We had an interim solution using correlation id in JMS headers and selectors on the queue however now the data publisher is not able to provide the correlation id to depend on.
Does anybody have a better suggestion to address this?
Since you're using a request/reply pattern with JMS you must either use a correlation ID or a unique temporary queue for the response.
You indicated that, "the data publisher is not able to provide the correlation id to depend on." However, your application actually provides the correlation ID. The "data provider" in this case just needs to take it from the message it receives and put it into the response message. The process only requires 2 method calls by the "data provider" - javax.jms.Message.getJMSCorrelationID and javax.jms.Message.setJMSCorrelationID.
If the "data provider" can't do this then it's doubtful they will be able to accomplish the other option of using a unique temporary queue for the response. However, it's worth explaining in any case. When one of your "instance" servers sends the request message it first needs to use javax.jms.Session.createTemporaryQueue to create a temporary queue and then take the return parameter of that method and set it on the request message using javax.jms.Message.setJMSReplyTo. When the "data provider" receives the message they will get this value using javax.jms.Message.getJMSReplyTo and then send the response to this queue where the "instance" will then retrieve it.
These are the two generally accepted ways to implement a request/response pattern with JMS. I don't know of any other ways to implement such a pattern.

Error while trying to send the message over websocket connection in Jmeter | WebSocket Samplers by Peter Doornbosch

I am using a plugin (WebSocket Samplers by Peter Doornbosch) to establish the WebSocket connection in JMeter and trying to send the request message over it but receiving below error in logs
ERROR - eu.luminis.jmeter.wssampler.RequestResponseWebSocketSampler: Unexpected frame type received in sampler 'WebSocket request-response Sampler': Close frame with status code null and close reason 'null'
My test plan consists of "WebSocket Open Connection", "Web-socket request-response sampler" and "web-socket ping/pong frame filter". And I feel there is no issue in establishing the connection but something is wrong while sending the request or receiving a response.
Also, tried checking the logs from the server but didn't find any requests which were sent using JMeter.
Implemented another available plugin too in Jmeter to test the WebSocket but seeing similar behavior. Any help would be highly appreciated.
It looks like you're using the wrong sampler type, looking into the error you're getting it makes more sense to use single-write sampler which is designed for sending one (text or binary) WebSocket frame.
You might want to use a sniffer tool like Fiddler or Wireshark to capture the traffic between your browser (or application) and the backend and see what types of frames are going, which direction, is single connection re-used or each time new one is established, etc.
You may also find the following links useful:
Example scripts collection
JMeter WebSocket Samplers - A Practical Guide
The problem is that your server is actively closing the connection. Usually, this is caused by the client sending a request that the server does not understand. In your case, it's very likely that the request you are sending in the request-response sampler is not accepted by the server. As Dmitri suggests, the best way to find out how a "normal" client communicates with the server is to capture a session with WireShark and model your testplan accordingly.
Hth.

How to Send Bytes Message to JMS Queue via Jmeter JMS point to point

I want to send my request XML in BytesFormat to my request queue via jmeter. How to achieve that?.
Looking into underlying JMSSampler class source code it is not possible to send a BytesMessage using JMS Point-to-Point sampler, you will either have to go for
JMS Publisher sampler which is capable of sending an ObjectMessage
or implement your own Message sending logic using JSR223 Sampler and Groovy language.
Or you can use a tool like JMSToolBox where you can automate the sending of ByteMessages based on message templates
(I'm biaised, I'm the author of JMSToolBox)

Nats.io QueueSubscribe behavior on timeout

I'm evaluating NATS for migrating an existing msg based software
I did not find documentation about msg timeout exception and overload.
For Example:
After Subscriber has been chosen , Is it aware of timeout settings posted by Publisher ? Is it possible to notify an additional time extension ?
If the elected subscriber is aware that some DBMS connection is missing and cannot complete It could be possible to bounce the message
NATS server will pickup another subscriber and will re-post the same message ?
Ciao
Diego
For your first question: It seems to me that you are trying to publish a request message with a timeout (using the nc.Request). If so, the timeout is managed by the client. Effectively the client publishes the request message and creates a subscription on the reply subject. If the subscription doesn't get any messages within the timeout it will notify you of the timeout condition and unsubscribe from the reply subject.
On your second question - are you using a queue group? A queue group in NATS is a subscription that specifies a queue group name. All subscriptions having the same queue group name are treated specially by the server. The server will select one of the queue group subscriptions to send the message to rotating between them as messages arrive. However the responsibility of the server is simply to deliver the message.
To do what you describe, implement your functionality using request/reply using a timeout and a max number of messages equal to 1. If no responses are received after the timeout your client can then resend the request message after some delay or perform some other type of recovery logic. The reply message should be your 'protocol' to know that the message was handled properly. Note that this gets into the design of your messaging architecture. For example, it is possible for the timeout to trigger after the request recipient received the message and handled it but before the client or server was able to publish the response. In that case the request sender wouldn't be able to tell the difference and would eventually republish. This hints that such type of interactions need to make the requests idempotent to prevent duplicate side effects.

when using Jmeter to test websocket stomp, cannot send connect message correctly

I installed websocket stomp sampler plugin to Jmeter, and new a stomp sampler to test the server. but when I filled the connect message as the message
I got from the developer:
CONNECT
accept-version:1.1,1.0
heart-beat:10000,10000
host: qa.so.aws.mxj.mx
^#
The Jmeter gave 400 error and said
"- Connect or Subscribe Paylod Message are empty"
When I saw the request from Jmeter, it said:
["CONNECT\n\n\u0000"]
I don't know how to let Jmeter to get the correct connect message, please help me with this problem.
Try by giving both Connect Message and subscribe message.
Example:
Connect Message
CONNECT\naccept-version:1.1\nheart-beat:0,0
Subscribe Message
SUBSCRIBE\nid:sub-0\ndestination:/topic/queue
Select both the check boxes Streaming connection and stomp protocol along with other details (host, port, protocol, path, connection and response timeout).

Resources