View Javadoc

1   /*
2      Copyright 2008 Ramon Servadei
3   
4      Licensed under the Apache License, Version 2.0 (the "License");
5      you may not use this file except in compliance with the License.
6      You may obtain a copy of the License at
7   
8          http://www.apache.org/licenses/LICENSE-2.0
9   
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15   */
16  package fulmine.distribution.events;
17  
18  import fulmine.distribution.connection.IConnection;
19  import fulmine.event.AbstractEvent;
20  import fulmine.event.listener.IEventListener;
21  
22  /**
23   * Represents when a {@link MessageEvent} has been consumed by all
24   * {@link IEventListener} instances.
25   * 
26   * @author Ramon Servadei
27   */
28  public class MessageConsumedEvent extends AbstractEvent
29  {
30      /** The message that was consumed */
31      private final MessageEvent message;
32  
33      /**
34       * Construct the message consumed event
35       * 
36       * @param connection
37       *            the connection the message was for
38       * @param message
39       *            the message that has been consumed
40       */
41      public MessageConsumedEvent(IConnection connection, MessageEvent message)
42      {
43          super();
44          setSource(connection);
45          this.message = message;
46      }
47  
48      public MessageEvent getMessage()
49      {
50          return this.message;
51      }
52  
53      @Override
54      protected String getAdditionalToString()
55      {
56          return "message=" + getMessage();
57      }
58  }