Is there way i can change the message visibility in activemq something like amazon SQS.
The ticket was raised but i guess closed without implementation(https://issues.apache.org/jira/browse/AMQ-3229).
I want activemq to retain the message after one consumption with session configured as ActiveMQSession.CLIENT_ACKNOWLEDGE but the visibilty of the message set to false so that no other consumer can consume it until the message is not deleted from the activemq(consume it with session ActiveMQSession.AUTO_ACKNOWLEDGE) or there is a timeout.
Regards,
Arijit
Apparently this is not required:
http://mail-archives.apache.org/mod_mbox/activemq-users/201204.mbox/%3C1333459897591-4528785.post#n4.nabble.com%3E
Related
Is it possible for a Mule message to expire (i.e. the container will discard the message) after a configured amount of time (like the JMS TTL property)?
If there is please can you point me to the documentation or example?
Can we use the attribute queueTimeout (see http://www.mulesoft.org/documentation/display/current/VM+Transport+Reference) to achieve this?
Cheers
No, the queueTimeout attribute does not control the TTL for messages on the queue. It is used when performing blocking operations on the queue (like dispatching a message or polling for a message).
This feature is not built into the VM transport. You might be able to accomplish the same idea by setting a message property with a timestamp before publishing it to the VM queue, and then filtering on the message age in the comsuming flow.
Is there any way I can achieve this:
Write a message to a queue
Block the producer process until there is a consumer on the other side
If there is no consumer after 10 seconds, raise an exception
If there is a consumer, unblock the producer process
When the 10sec timeout is reached and an exception is raised on the producer side, the message should be kept in the queue, so that a consumer can consume it later
I want to be able to notify a consumer in an asynchrone way.
Until now I'm sending a message. I want to know if there is an immediate consumer, but if there is not, the message should still be on the queue. It doesn't seem to be the behavior of the "immediate" amqp thing
Interesting problem, unfortunately there isn't an elegant solution.
From the RabbitMQ documentation the "immediate" flag works like this:
This flag tells the server how to react if the message cannot be routed to a queue consumer immediately. If this flag is set, the server will return an undeliverable message with a Return method. If this flag is zero, the server will queue the message, but with no guarantee that it will ever be consumed.
You could solve your problem in part using the immediate flag, I'm thinking something like this:
When the producer is ready to queue a message it fires it off with the immediate flag set
If the message is returned then start a timer and keep retrying for 10 seconds with the immediate flag set
If after 10 seconds of trying it has still failed to be picked up, then publish it with the immediate flag set to false (so that your consumer will pick it up when the consumer comes online)
When using ActiveMQ, some problems troubles me:
1. When broker crashed or stopped, messages from sender will be lost(I set timeout, because the sender have others to do).
2. Consumer receives all messages from broker, but how i know the consumer received all messages(zero lost).
3. If message is lost, i want to know it immediately.
In production, I want to monitor the activemq, and know which message is lost.
Can anyone give me a favor?
you can implement a listener that is called as soon as you producers/consumers lose contact with broker.
http://activemq.apache.org/maven/5.5.0/activemq-core/apidocs/org/apache/activemq/transport/TransportListener.html
If consumer crashes
use explicit ack: activemq.apache.org/should-i-use-transactions.html
you can use persistent messages to avoid losing messages if broker crashes:
activemq.apache.org/what-is-the-difference-between-persistent-and-non-persistent-delivery.html
Assuming that we only have one consumer and our redelivery policy will allow the message to be redelivered for a quite long time.
I've tried a scenario where I sent two messages(different type), one is designed to be redelivered and the other can be consumed normally.
It seems the normal message will be blocked if it is delivered later than the redelivered one.
It will not be consumed until the redelivered message has tried many times reaching the maximum redeliver times. That would lead to a situation where a easy-to-consumed message must wait a long time to be consumed..
I'm wondering how the AMQ redeliver work. When a message is redelivered in a consumer, the other message can be sent to this consumer until current message has been consumed or timeout(to DLQ).
Can someone help ? Thanks,
ActiveMQ's overriding concern when redelivering messages is to honour message ordering on a queue.
Given two messages A and B, which get sent to a queue with a defined redelivery policy as you describe: if a client fails processing A, that message will get placed back on the queue and no other messages will be consumed until A is consumed successfully.
Check out the ActiveMQ Message Redelivery and DLQ Handling section for further details.
Please remember to vote this response up if it answers your question.
For this case it is possible to set the ActiveConnectionFactory to onBlockingRedelivery.
Find details in de ActiveMq Api documentation:
I am using ActiveMQ as message Broker with something like 140 Topics.
I am facing a problem that the broker keeps old messages, instead of discarding them in order to send new messages (so clients gets old data instead of current data).
How do I configure the broker not to keep old messages? the important data is allways the last data, so if a consumer didn't get data, he will get next time the most updated.
I have configured on producer TTL as 250, but it doesn't seem to work...
One other thing,
How can I disable the creation of advisory topics?
Any help will be appreciated...
Advisory messages are required for
dynamic network broker topologies as
NetworkConnectors subscribe to
advisory messages. In the absence of
advisories, a network must be
statically configured.
Beware that using advisorySupport="false" will NOT work with dynamic network brokers as per this reference page: http://activemq.apache.org/advisory-message.html
Are you using a durable consumer to receive these messages from the topics concerned? If so, the broker will be holding on to all messages sent when you were disconnected. Switch to a regular consumer in order to only see "current" messages on the topic.
To prevent the creation of advisory topics and their associated messages add the advisorySupport="false" property to the <broker /> element of the ActiveMQ config file.