View Javadoc

1   /*
2    * $Id: MessageRedeliveredException.java 22159 2011-06-09 00:37:51Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.jms.redelivery;
12  
13  import org.mule.DefaultMuleEvent;
14  import org.mule.api.MessagingException;
15  import org.mule.api.MuleMessage;
16  import org.mule.api.construct.FlowConstruct;
17  import org.mule.api.endpoint.ImmutableEndpoint;
18  import org.mule.api.endpoint.InboundEndpoint;
19  import org.mule.session.DefaultMuleSession;
20  import org.mule.transport.jms.i18n.JmsMessages;
21  
22  public class MessageRedeliveredException extends MessagingException
23  {
24      /**
25       * Serial version
26       */
27      private static final long serialVersionUID = 9013890402770563931L;
28  
29      protected final transient ImmutableEndpoint endpoint;
30      
31      String messageId;
32      int redeliveryCount;
33      int maxRedelivery;
34  
35      public MessageRedeliveredException(String messageId, int redeliveryCount, int maxRedelivery, InboundEndpoint endpoint, FlowConstruct flow, MuleMessage muleMessage)
36      {        
37          super(JmsMessages.tooManyRedeliveries(messageId, redeliveryCount, maxRedelivery, endpoint), 
38              new DefaultMuleEvent(muleMessage, endpoint, new DefaultMuleSession(flow, endpoint.getMuleContext())));
39          this.messageId = messageId;
40          this.redeliveryCount = redeliveryCount;
41          this.maxRedelivery = maxRedelivery;
42          this.endpoint = endpoint;
43      }
44      
45      public String getMessageId()
46      {
47          return messageId;
48      }
49  
50      public int getRedeliveryCount()
51      {
52          return redeliveryCount;
53      }
54  
55      public int getMaxRedelivery()
56      {
57          return maxRedelivery;
58      }
59  
60      public ImmutableEndpoint getEndpoint()
61      {
62          return endpoint;
63      }
64  }