You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Tom Ross (JIRA)" <ji...@apache.org> on 2017/11/03 08:44:00 UTC

[jira] [Created] (ARTEMIS-1497) Destroy message instead of sending it to DLQ

Tom Ross created ARTEMIS-1497:
---------------------------------

             Summary: Destroy message instead of sending it to DLQ
                 Key: ARTEMIS-1497
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1497
             Project: ActiveMQ Artemis
          Issue Type: New Feature
          Components: Broker
    Affects Versions: 2.3.0
         Environment: ActiveMQ 2.3
            Reporter: Tom Ross


Customer would like to have an option of destroying certain messages instead of sending them to DLQ in case message processing fails. 

Below is an example of what they think could happen:

{noformat}
public class HelloMDB implements MessageListener {

    MessageDrivenContext ctx;

    @Override
    public void onMessage(Message message) {
        
        try {
            
            doSomeInsertsButThenFailBecauseOfDataThatMakesNoSense();
            
        } catch (UnableToProcessMessageBecauseOfDataThatMakesNoSense e) {
            
            ctx.setRollbackOnly(); // we do not want to commit, because we do not know how many inserts we did before we failed
            
            try {
                message.setBooleanProperty("DESTROY_INSTEAD_OF_GOING_TO_ERROR_QUEUE", true);
            } catch (JMSException ex) {
                throw new RuntimeException("unable to set destroy property", e);
            }
        }
    }
{noformat}

In the case above they would like a message that was a rolled back and tagged with DESTROY_INSTEAD_OF_GOING_TO_ERROR_QUEUE property to be destroyed instead of send to DLQ. If that happens they would like the broker to log that instance in the server log file.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)