activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vince Cole <the.vince.c...@gmail.com>
Subject Can ActiveMQ reject a message on send?
Date Wed, 29 Mar 2017 12:51:12 GMT
A similar question was asked at the beginning of last year. 
http://stackoverflow.com/questions/29919469/intercept-incoming-jms-messages-to-activemq-reject-approve-based-on-rules

However, I'm not convinced it was answered with a definite yes or no. 
Can anyone clear this up, one way or another, please? 

Note: 
* This behaviour absolutely must be SYNCHRONOUS. 
* It has absolutely nothing to do with anything happening on the consumer
side. 
* Interestingly, it looks exactly like a PRODUCER's version of the 'Message
level Authorization' plugin (which is only available for consumers) detailed
at the bottom of http://activemq.apache.org/security.html  

Is it possible, or not, to implement the following scenario: 

1. A JMS producer (using AMQP 1.0) sends a message, syncronously, to
ActiveMQ, for it to be enqueued. 
2. ActiveMQ VALIDATES the message - it checks if the message is allowed
(according to business-defined rules, relating to the message content) to be
sent to the queue which the producer requested. 
3a. If the message is allowed in that queue, ActiveMQ enqueues in the usual
manner, and the JMS producer's (send) method returns normally. 
3b. If the message is NOT allowed in that queue, ActiveMQ rejects the
message, and the JMS producer's (send) method throws an exception: 
*** This needs to work in the same way as a JMS exception being thrown, from
within the send method, if a producer tries to send a message to a
non-existent queue (which they aren't authorized to create). *** 

This is to allow the producer to know, AT THE TIME OF SENDING, whether or
not their message was actually enqueued in the broker or not. 

The producer application must NOT discard its copy of the message until the
copy which was sent to the broker has been enqueued. 

If an exception is thrown from the producer's send method, the message must
NOT be considered as 'sent'. The application which calls the producer can
then make the appropriate decision WRT what to do with the (as yet, still
'not sent') message. If re-attempted later, the send may succeed later,
because the business may subsequently modify the validation rules. 

Thanks! 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Can-ActiveMQ-reject-a-message-on-send-tp4724274.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message