Difference between Producer and Consumer count in tibco admin - tibco

I have one doubt regarding difference between producer count and consumer count in TIBCO EMS which we see in TIBCO Admin --> all services instances --> ems now on selecting the specific ems server --> connections.
please can anybody help me in understanding both the terminologies.
please let me know if anything left from my side .

The count of the producers and consumer do not correlate to each other in any way.
The producer count is the amount of producers instantiated in your Java code. So each producer can send messages to the connected queue.
The consumer count is the amount of consumers instantiated in your Java code. So each consumer can receive messages from the connected queue.
So it is possible to have a client which simultaneously sends and receives messages, but this is purely based on your implementation.

Related

Multiple instances of the same Springboot application but only 1 instance consumes messages from ActiveMQ queue

I am running multiple instances of the same Spring Boot 2.0.4 Application, for scaling purposes, that consume messages from an ActiveMQ queue using the following:
#JmsListener(destination = "myQ")
Only the first consumer receives messages and if I stop the first consumer the second instance starts receiving the messages. I want each consumer to consume a message, not the same message, in a round robin fashion. But only the first consumer consumes messages.
It sounds like you want a JMS Topic rather than a Queue. You should also research durable subscriptions, shared subscriptions, and durable topics before you settle on the configuration you need for your setup.
See:
JMS API Programming Model (Search for JMS Message Consumers)
Queues vs Topics
Durable Queues and Topics

MessageGroups with Spring and Websphere MQ

I am looking options to implement feature like Active MQ message groups in my application. This application is based on Spring and uses Websphere MQ as JMS provider. I cannot change JMS provider to ActiveMQ due to client constraints.
Use Case : Messages arrive in bulks on queue 1 where they are picked by listener and split into chunks and en-queued to the queue 2. Queue 2 has a single threaded listener which processes messages one after another but this behavior is leading to performance issues where there are too many messages on Queue 2. Also since bulk can have some related messages i.e. Object Create and Object Update, simply having parallel consumers wont solve the problem. As messages need to be grouped based on order Id (or some other)attribute and then this group needs to be processed by exclusive consumer.
I cant find any feature in MQ or Spring JMS to implement this unlike Message Groups provided by Active MQ.

What does Spring JMS ActiveMQ use to determine when a broker should switch Exclusive Consumers?

An exclusive consumer in Activemq is one that is sent every message from a broker until the consumer dies or goes away, at which time the broker switches consumer.
What is it that defines when the switchover takes place? How do you configure this in Spring JMS/ActiveMQ?
It's not Spring JMS doing the checking; it's the JMS provider, ActiveMQ.
JMS is an API specification; an empty framework, essentially. ActiveMQ provides the implementation backing for managing connections, message brokering, load-balancing, fail-over, etc.
The ActiveMQ broker handles switching-over consumers based on queue properties (you don't need to do anything special in your code):
queue = new ActiveMQQueue("TEST.QUEUE?consumer.exclusive=true");
The switch-over takes place when either the consumer disconnects gracefully or the broker determines that the consumer has disappeared (via the wireFormat.maxInactivityDuration elapsing without any messages or keep-alives being received). You don't have to configure anything if you're happy with the default value of wireFormat.maxInactivityDuration (30 seconds), but you can tweak that if you want to change how long it takes before the broker gives up on a client.

How to monitor message queue message using JMX

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.

Queue consumer clusters with ActiveMQ

How to configure cluster of Consumers in ActiveMQ?
I created a simple embedded ActiveMQ application with two consumers of one Queue, consumers are working in separate threads. But when I send a message to the Queue, JMS delivers it to first consumer no matter how long it sleeps after receiving.
I think you're trying to explain that the first consumer is receiving all the messages. There is a FAQ entry for this type of problem available here:
http://activemq.apache.org/i-do-not-receive-messages-in-my-second-consumer.html
Bruce

Resources