Examples of DeadLetterStrategy


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

    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);
                            if (context.getBroker() == null) {
                                context.setBroker(getRoot());
                            }
                            BrokerSupport.resendNoCopy(context, message, deadLetterDestination);
                            return true;
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

        Message message=node.getMessage();
        if(message!=null){
            // 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
            DeadLetterStrategy deadLetterStrategy=node.getRegionDestination().getDeadLetterStrategy();
            ActiveMQDestination deadLetterDestination=deadLetterStrategy.getDeadLetterQueueFor(message.getDestination());
            BrokerSupport.resend(context, message, deadLetterDestination);

        }
    }
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)){
                // 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");
              }
              // 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

    protected BrokerService createBroker() throws Exception {
        BrokerService broker = super.createBroker();

        PolicyEntry policy = new PolicyEntry();
        DeadLetterStrategy strategy = new IndividualDeadLetterStrategy();
        strategy.setProcessNonPersistent(true);
        policy.setDeadLetterStrategy(strategy);

        PolicyMap pMap = new PolicyMap();
        pMap.setDefaultEntry(policy);
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)){
                // 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");
              }
              // 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

            MessageReference node, Subscription subscription){
        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)){
                            // 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");
                            }
                            // 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);
                            if (context.getBroker()==null) {
                                context.setBroker(getRoot());
                            }
                            BrokerSupport.resendNoCopy(context,message,
View Full Code Here

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

        Message message=node.getMessage();
        if(message!=null){
            // 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
            DeadLetterStrategy deadLetterStrategy=node.getRegionDestination().getDeadLetterStrategy();
            ActiveMQDestination deadLetterDestination=deadLetterStrategy.getDeadLetterQueueFor(message.getDestination());
            BrokerSupport.resend(context, 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.