Examples of DeadLetterStrategy


Examples of org.apache.activemq.broker.region.policy.DeadLetterStrategy

        removeMessage(context, m);
        messagesLock.writeLock().lock();
        try {
            messages.rollback(m.getMessageId());
            if (isDLQ()) {
                DeadLetterStrategy stratagy = getDeadLetterStrategy();
                stratagy.rollback(m.getMessage());
            }
        } finally {
            messagesLock.writeLock().unlock();
        }
        return true;
View Full Code Here

Examples of org.apache.activemq.broker.region.policy.DeadLetterStrategy

    public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference node, Subscription subscription, Throwable poisonCause) {
        try {
            if (node != null) {
                Message message = node.getMessage();
                if (message != null && node.getRegionDestination() != null) {
                    DeadLetterStrategy deadLetterStrategy = ((Destination) node.getRegionDestination()).getDeadLetterStrategy();
                    if (deadLetterStrategy != null) {
                        if (deadLetterStrategy.isSendToDeadLetterQueue(message)) {
                            // message may be inflight to other subscriptions so do not modify
                            message = message.copy();
                            message.getMessageId().setFutureOrSequenceLong(null);
                            stampAsExpired(message);
                            message.setExpiration(0);
                            if (!message.isPersistent()) {
                                message.setPersistent(true);
                                message.setProperty("originalDeliveryMode", "NON_PERSISTENT");
                            }
                            if (poisonCause != null) {
                                message.setProperty(ActiveMQMessage.DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY,
                                        poisonCause.toString());
                            }
                            // The original destination and transaction id do
                            // not get filled when the message is first sent,
                            // it is only populated if the message is routed to
                            // another destination like the DLQ
                            ActiveMQDestination deadLetterDestination = deadLetterStrategy.getDeadLetterQueueFor(message, subscription);
                            ConnectionContext adminContext = context;
                            if (context.getSecurityContext() == null || !context.getSecurityContext().isBrokerContext()) {
                                adminContext = BrokerSupport.getConnectionContext(this);
                            }
                            BrokerSupport.resendNoCopy(adminContext, message, deadLetterDestination);
View Full Code Here

Examples of org.apache.activemq.broker.region.policy.DeadLetterStrategy

    protected BrokerService createBroker() throws Exception {
        BrokerService broker = new BrokerService();
        broker.setPersistent(false);
        PolicyEntry policy = new PolicyEntry();
        DeadLetterStrategy defaultDeadLetterStrategy = policy.getDeadLetterStrategy();
        if(defaultDeadLetterStrategy!=null) {
            defaultDeadLetterStrategy.setProcessNonPersistent(true);
        }
        PolicyMap pMap = new PolicyMap();
        pMap.setDefaultEntry(policy);
        broker.setDestinationPolicy(pMap);
        return broker;
View Full Code Here

Examples of org.apache.activemq.broker.region.policy.DeadLetterStrategy

          MessageReference node){
    try{
      if(node!=null){
        Message message=node.getMessage();
        if(message!=null&&node.getRegionDestination()!=null){
          DeadLetterStrategy deadLetterStrategy=node
                  .getRegionDestination().getDeadLetterStrategy();
          if(deadLetterStrategy!=null){
            if(deadLetterStrategy.isSendToDeadLetterQueue(message)){
              long expiration=message.getExpiration();
              message.setExpiration(0);
              message.setProperty("originalExpiration",new Long(
                      expiration));
              if(!message.isPersistent()){
                message.setPersistent(true);
                message.setProperty("originalDeliveryMode",
                        "NON_PERSISTENT");
              }
              // The original destination and transaction id do
              // not get filled when the message is first
              // sent,
              // it is only populated if the message is routed to
              // another destination like the DLQ
              ActiveMQDestination deadLetterDestination=deadLetterStrategy
                      .getDeadLetterQueueFor(message
                              .getDestination());
              if (context.getBroker()==null) {
                context.setBroker(getRoot());
              }
View Full Code Here

Examples of org.apache.activemq.broker.region.policy.DeadLetterStrategy

        removeMessage(context, m);
        messagesLock.writeLock().lock();
        try {
            messages.rollback(m.getMessageId());
            if (isDLQ()) {
                DeadLetterStrategy stratagy = getDeadLetterStrategy();
                stratagy.rollback(m.getMessage());
            }
        } finally {
            messagesLock.writeLock().unlock();
        }
        return true;
View Full Code Here

Examples of org.apache.activemq.broker.region.policy.DeadLetterStrategy

        }
        super.send(producerExchange, message);
    }

    private boolean isDestinationDLQ(Message message) {
        DeadLetterStrategy deadLetterStrategy;
        Message tmp;

        Destination regionDestination = (Destination) message.getRegionDestination();
        if (message != null && regionDestination != null) {
            deadLetterStrategy = regionDestination.getDeadLetterStrategy();
            if (deadLetterStrategy != null && message.getOriginalDestination() != null) {
                // Cheap copy, since we only need two fields
                tmp = new ActiveMQMessage();
                tmp.setDestination(message.getOriginalDestination());
                tmp.setRegionDestination(regionDestination);

                // Determine if we are headed for a DLQ
                ActiveMQDestination deadLetterDestination = deadLetterStrategy.getDeadLetterQueueFor(tmp, null);
                if (deadLetterDestination.equals(message.getDestination())) {
                    return true;
                }
            }
        }
View Full Code Here

Examples of org.apache.activemq.broker.region.policy.DeadLetterStrategy

    public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference node, Subscription subscription, Throwable poisonCause) {
        try {
            if (node != null) {
                Message message = node.getMessage();
                if (message != null && node.getRegionDestination() != null) {
                    DeadLetterStrategy deadLetterStrategy = ((Destination) node.getRegionDestination()).getDeadLetterStrategy();
                    if (deadLetterStrategy != null) {
                        if (deadLetterStrategy.isSendToDeadLetterQueue(message)) {
                            // message may be inflight to other subscriptions so do not modify
                            message = message.copy();
                            stampAsExpired(message);
                            message.setExpiration(0);
                            if (!message.isPersistent()) {
                                message.setPersistent(true);
                                message.setProperty("originalDeliveryMode", "NON_PERSISTENT");
                            }
                            if (poisonCause != null) {
                                message.setProperty(ActiveMQMessage.DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY,
                                        poisonCause.toString());
                            }
                            // The original destination and transaction id do
                            // not get filled when the message is first sent,
                            // it is only populated if the message is routed to
                            // another destination like the DLQ
                            ActiveMQDestination deadLetterDestination = deadLetterStrategy.getDeadLetterQueueFor(message, subscription);
                            ConnectionContext adminContext = context;
                            if (context.getSecurityContext() == null || !context.getSecurityContext().isBrokerContext()) {
                                adminContext = BrokerSupport.getConnectionContext(this);
                            }
                            BrokerSupport.resendNoCopy(adminContext, message, deadLetterDestination);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.