I would like to measure the time with JMeter test scenario from enqueuing a message into an ActiveMQ Queue and until it ends up in a different Queue. In between I have Apache Camel logic which does message transformation and enrichments.
I tried Jmeter Point-to-Point Sampler, where I filled my input and output queues in the "JNDI Name Request Queue" and "JNDI Name Response Queue" text fields. Also used JMS Message ID as Correlation ID. Camel receives the message, processes it and submits it to the output queue. But JMeter doesn't consumes it. I see following error message:
Response message: No reply message received
Any idea what I'm doing wrong?
Thanks
Yusuf
Related
Using Mule 4.4 on premise along with Apache ActiveMQ. I am trying to get a better understanding of how Mule handles messaging.
I tried searching the internet but am not finding any details about the same.
I have a jms:listener:
<jms:listener doc:name="Listener" config-ref="JMS_Config" destination="Consumer.mine2.VirtualTopic.mine.test">
<jms:consumer-type >
<jms:queue-consumer />
</jms:consumer-type>
</jms:listener>
and I have a jms:consume:
<jms:consume doc:name="Consume" config-ref="JMS_Config" destination="Consumer.mine1.VirtualTopic.mine.test">
<jms:consumer-type >
<jms:queue-consumer />
</jms:consumer-type>
</jms:consume>
To me both seem to be doing the same job i.e. consume messages from a queue / topic. So why do we have these two components in Mule?
jms listener is a source, so using it you can trigger a flow whenever there is a new message in queue.
jms consume is an operation, so you can use it anywhere within a flow's execution, i.e. like a http request component that you put in the middle of a flow.
Both of them will consume a message from the queue/topic. However, when you are using a listener you are basically saying that "There is a queue, I do not know when a new message will come in, but whenever it comes I need to perform these actions"
When you use a consume operation, you are saying "I am expecting some message soon and with that I will to these actions".
Now in both cases a message may not come at all, and both have there own way to deal with it. A listener, since it is a source, will just not simply trigger the flow and keep on waiting. A consume will block your execution until a message is there, or you can configure a time out to not be blocked fore ever.
A common use case can be reprocessing messages from a DLQ. Generally when you use a queue, you also have a DLQ so that the messages that failed during processing, from the "main" queue, can be sent to the DLQ and reprocessed later.
Now, in this architecture, you will typically use the jms listener only with the main queue for the processing of the messages. And you will have a separate flow that can have a http listener so that you can trigger an HTTP Endpoint whenever you are ready to reprocess the messages from the DLQ. This flow with http listener with consume all the messages (probably in a loop) from the DLQ and publish them back to the main queue
I've written a RabbitMq listener application using spring-boot and want to know the status whether it is processing the messages or idle.
I've been through the rabbitMq HTTP API doc and found /api/queues/vhost/name/get endpoint gives the message count and message body. I see an opportunity in that, decided to compare the message count and message body for two successive responses. If both responses are same then the listener is idle else it's processing.
I used RestTemplate's postForEntity() with {"count":1,"requeue":true,"encoding":"auto"} as request body. But strangely rabbitmq-server isn't responding for this API, however its responding for other API endpoint in the doc.
If there's any way to get the status of the listener, please share the details. Thanks in advance.
Spring AMQP listener containers emit a ListenerContainerIdleEvent objects when there is no messages during some interval.
See docs for more info: https://docs.spring.io/spring-amqp/docs/2.1.7.RELEASE/reference/html/#idle-containers
For the RabbitMQ REST API, there is a Java wrapper - Hop: https://github.com/rabbitmq/hop
So, consider to use its Client.getQueue(String vhost, String name) for your goal, if a ListenerContainerIdleEvent doesn't fit your requirements.
Hi I am new to Camel and have a design question related to JMS queues.
I am receiving set of data. These data have a reference date. These data are sent every 15 minutes by a batch process.
I have to process the received data and forward them to another route.
If a given data cannot be processed, I need to reprocess it. And I have to ensure it is processed before the next data set is processed.
So I was thinking of creating a JMS route to receive these data before processing. Then process it. Then send it to another queue.
FTP --> Process data rows (A) --> JMS Queue --> Processor (B) --> direct:call
If processor B fails I want the data to be processed before the next data set is sent by FTP. (because second data set may contain an update of the data of the first dataset)
So I was thinking using a queue, to make sure they are always processed in the order they are being received.
But my experience with JMS, without Camel, is that once the object is consumed from the queue it is not in the queue anymore.
Is it also the case with Camel?
In this case to I have to retry to process the data, or put them back in the queue?
This "recovery" part is not clear to me and I'd like to understand the patterns that do support this.
Many thanks for your help
Gilles
This part "once the object is consumed from the queue it is not in the queue anymore." is not fully correct. Actually, when you are subscribing to the queue and getting a message you need to process it and send acknowledge back to the JMS broker. If acknowledge is successful then the message will be removed from the queue. But if acknowledge will be not successful or if your process will die and connection to the broker will break then the message will not be removed from the queue and will be passed to another consumer.
Often most of the JMS libraries are using mode when acknowledgement is sent right when message was received by consumer but you always have possibility to change this mode and send acknowledgement manually when your processing part will be finished successfully.
What about camel jms (http://camel.apache.org/jms.html) you can use endpoint option "acknowledgementModeName" which has some different possible values like:
AUTO_ACKNOWLEDGE (default) - acknowledgement will be sent right after corresponded "from" in your route
CLIENT_ACKNOWLEDGE - allows the application to control when the acknowledgment is sent and if there are no exceptions will be thrown during exchange processing then message will be acknowledged and removed from queue.
I have a list of stores with both Incoming and Outgoing Failed Message Queues. It uses Message Driven Beans (to read and write) into those Queues (Java Message Service(JMS) in WildFly 8.0)
I want to know
how to pinpoint (from the application) how and where these messages are written into the Queues
how to reduce the number of failed messages to a minimum
Messages fail because they timeout, increase the timetolive config value to avoid the messages ending up in the error queue.
To answer your first question, I dont have a specific answer, you may have to use logging statements just before you send the message to the queue along with the time. If your message has time also, later in the future you can cross verify the logs to that of the error messages.
I want to make an application where:
Users will send a message to queue
Listener will listen messages of
queue After processing of message in
listener, listener
will create a new response message
and send it to another success or
failure queue.
Questions:
Should I use activemq as storage of processed messages?
Will I be able to retrieve all messages of one queue without listing to them?
Do we have any other solution for keeping all processed messages? I want to make a report of all processed messages present in success and failure queue.
You can find a minimalistic sample here and here for using ActiveMQ with Spring. About persistence options, read ActiveMQ docs. Also you might want to check out these slides, to get a general overview on Spring JMS with ActiveMQ.
ActiveMQ is not a storage facility, it is a message-passing facility.
If you want to store the messages after processing them then use a database. For example, create a table that has a status flag for success or failure, then for reporting query that table.