We are using Solace as messaging broker. How can I get the number of times a message is delivered from broker? In Jboss, there is a property called JMSXDeliveryCount. Is there anything similar in Solace?
The Solace JMS API is compliant with JMS1.1.
Unfortunately, JMSXDeliveryCount is an optional property in the JMS1.1 specification that is not implemented by the Solace JMS API.
For now, you can keep track of redelivered messages with JMSRedelivered, which does not provide the count.
If you are worried about application handling of "poisonous" messages - messages which cannot be consumed for some reason and need to be redelivered, you can make use of the "Max Redelivery" feature on the Solace endpoints. Messages will be moved to the Dead Message Queue or even configured to be discarded, when the message has been redelivered above the "Max Redelivery" count.
Support for JMSXDeliveryCount is in Solace's feature candidate list, and is likely to be implemented in a future release.
Related
For a Spring Framework app working with ActiveMQ and with/without WebSocket
The requirement is prior to send any message to a Topic a check should be done about Number Of Consumers, if it returns 1 the message can be sent safely. If it returns 0, the message can't be sent.
The clients could be come from websocket and consider there is no durable subscription. Thus if a message is sent, and there are no clients, the message arrives to the Topic and practically is lost (never consumed) and Messages Enqueued increments +1
I already did a research and I have read the following:
JMSTemplate check if topic exists and get subscriber count
Notify ActiveMQ producer if consumer on the destination is down
ActiveMQ get number of consumers listening to a topic from java
Detect change in Consumers of an ActiveMQ topic
Practically all is based on Advisory Message. I already have read:
Advisory Message
Handling Advisory Messages
Apache ActiveMQ Advisory Example
I understand that if exists a Topic named abc.xyz then ActiveMQ creates ActiveMQ.Advisory.Consumer.Topic.abc.xyz, until here I am ok with this pattern. I can confirm this approach through ActiveMQ Web Console
What is confuse for me is that practically all the examples available from the previous links works around creating a Session and uses mostly the onMessage method. For the latter I know it works how a listener.
Question 01: Thus who is expected to call that ActiveMQ.Advisory.Consumer.Topic.abc.xyz? It to trigger that onMessage method? That is my confusion.
What I need is work with the Spring Framework API (The app is already working and running with a CachingConnectionFactory, thus a Connection can be retrieved and other #Beans about infrastructure about ActiveMQ) and get access to that ActiveMQ.Advisory.Consumer.Topic.abc.xyz destination and retrieve the Number Of Consumers value.
Note: even when exists ActiveMQTopic declared with #Bean and is possible to retrieve that Destination for some #Component, sadly the API does not offer a method such getConsumers().
Question 02: How can be accomplished this?
I am assuming the JMS API for 2.0.x could help perhaps in someway.
We have a queue in ActiveMQ which is consumed by ~50 instances (sessions) of the same MDB.
The problem is that sometimes the queue receive a lot of messages and keep receiving lot of messages for various minutes. And the consumers is pulling the newer messages. So the older messages aren't pulled ultil the queue is almost empty. If the queue remain full (lot more messages than consumers) the older messages aren't consumed at all.
Is there a way to configure the ActiveMQ Artemis or MDB (Wildfly 10) to prefer pull the older messages from the queue first?
It sounds like the MDBs who may be consuming the older messages are slow compared to the MDBs consuming the newer messages. If the MDBs are consuming the messages locally you can set the "consumerWindowSize" to "0" to disable buffering.
Could I search any particular message in solace JMS queue and then process in prior to other messages? Do we have such functionality w.r.t to solace queue.
There isn't such a functionality to search a solace queue for messages. These are designed for messages to be processed in the order in which the are received.
You can use a QueueBrowser to get a static snapshot of the messages and process those messages you want prior to others. Using selectors might help too, if it is applicable for your search use-case. But only the native Java implementation of the Solace API can delete messages; a JMS QueueBrowser doesn't provide that.
We develop NMS product that has been deployed by couple of telecom operators. Our application (uses ActiveMQ) will publish Fault notifications to the Fault Queue, the messages are set to be persistent. These messages are consumed by third party JMS clients. Not all the customers will have a notification client to consume the events(some of the deployments will not have any subscriptions). The question is, does ActiveMQ persist the messages if the queue never had a subscriber connected to the Queue?.
The Broker will persist messages to a Queue regardless of the presence of consumers when the message is tagged as persistent. That is the general contract of the Queue model.
I am developing an application in which I have jms message queue.
There is a producer which enqueue message to the queue and a consumer to dequeue the message.
There might be cases when consumer is not running. If a message is not consumed by the consumer within a certain amount of time I need to catch that from producer.
I want to use JMX to monitor message queue's message whether it is expired.
Any suggestion or sample code how to this.....
It depends on the JMX implementer... Some servers provide JMX implementations to monitor its resources. If its not provided, then you will need to write the JMX implementation that uses the API provided by the MQ implementer.
An easier way to solve this problem is to use the request-response pattern with expiry. The consumer needs to respond in a specified internal of time. If it can't then the message on the queue can expire. If the response is not received the producer can take further action. JMS selector with correlation ID can be used to relate the responses with the request.