View Javadoc

1   /*
2    * $Id: IdempotentMessageIdStore.java 8986 2007-10-08 13:17:22Z holger $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.routing.inbound;
12  
13  /**
14   * <code>IdempotentMessageIdStore</code> is the main interface used by
15   * {@link IdempotentReceiver} for storing received message IDs.
16   * 
17   * @see {@link IdempotentInMemoryMessageIdStore}
18   */
19  public interface IdempotentMessageIdStore
20  {
21      /**
22       * Check whether the given ID is already registered with this store.
23       * 
24       * @param id the ID to check
25       * @return <code>true</code> if the ID is stored or <code>false</code> if it could
26       *         not be found
27       * @throws IllegalArgumentException if the given ID is <code>null</code>
28       * @throws Exception if any implementation-specific error occured, e.g. when the store
29       *             is not available
30       */
31      boolean containsId(Object id) throws IllegalArgumentException, Exception;
32  
33      /**
34       * Store the given ID.
35       * 
36       * @param id the ID to store
37       * @return <code>true</code> if the ID was stored properly, or <code>false</code>
38       *         if it already existed
39       * @throws IllegalArgumentException if the given ID cannot be stored or is
40       *             <code>null</code>
41       * @throws Exception if the store is not available or any other
42       *             implementation-specific error occured
43       */
44      boolean storeId(Object id) throws IllegalArgumentException, Exception;
45  }