Spring Integration

org.springframework.integration.store
Class MessageGroupQueue

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<Message<?>>
          extended by org.springframework.integration.store.MessageGroupQueue
All Implemented Interfaces:
Iterable<Message<?>>, Collection<Message<?>>, BlockingQueue<Message<?>>, Queue<Message<?>>

public class MessageGroupQueue
extends AbstractQueue<Message<?>>
implements BlockingQueue<Message<?>>

A BlockingQueue that is backed by a MessageGroupStore. Can be used to ensure guaranteed delivery in the face of transaction rollback (assuming the store is transactional) and also to ensure messages are not lost if the process dies (assuming the store is durable). To use the queue across process re-starts, the same group id must be provided, so it needs to be unique but identifiable with a single logical instance of the queue.

Since:
2.0
Author:
Dave Syer

Constructor Summary
MessageGroupQueue(MessageGroupStore messageGroupStore, Object groupId)
           
MessageGroupQueue(MessageGroupStore messageGroupStore, Object groupId, int capacity)
           
 
Method Summary
 int drainTo(Collection<? super Message<?>> c)
           
 int drainTo(Collection<? super Message<?>> c, int maxElements)
           
 Iterator<Message<?>> iterator()
           
 boolean offer(Message<?> e)
           
 boolean offer(Message<?> e, long timeout, TimeUnit unit)
           
 Message<?> peek()
           
 Message<?> poll()
           
 Message<?> poll(long timeout, TimeUnit unit)
           
 void put(Message<?> e)
           
 int remainingCapacity()
           
 int size()
           
 Message<?> take()
           
 
Methods inherited from class java.util.AbstractQueue
add, addAll, clear, element, remove
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.BlockingQueue
add
 
Methods inherited from interface java.util.Queue
element, remove
 
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

MessageGroupQueue

public MessageGroupQueue(MessageGroupStore messageGroupStore,
                         Object groupId)

MessageGroupQueue

public MessageGroupQueue(MessageGroupStore messageGroupStore,
                         Object groupId,
                         int capacity)
Method Detail

iterator

public Iterator<Message<?>> iterator()
Specified by:
iterator in interface Iterable<Message<?>>
Specified by:
iterator in interface Collection<Message<?>>
Specified by:
iterator in class AbstractCollection<Message<?>>

size

public int size()
Specified by:
size in interface Collection<Message<?>>
Specified by:
size in class AbstractCollection<Message<?>>

offer

public boolean offer(Message<?> e)
Specified by:
offer in interface BlockingQueue<Message<?>>
Specified by:
offer in interface Queue<Message<?>>

peek

public Message<?> peek()
Specified by:
peek in interface Queue<Message<?>>

poll

public Message<?> poll()
Specified by:
poll in interface Queue<Message<?>>

drainTo

public int drainTo(Collection<? super Message<?>> c)
Specified by:
drainTo in interface BlockingQueue<Message<?>>

drainTo

public int drainTo(Collection<? super Message<?>> c,
                   int maxElements)
Specified by:
drainTo in interface BlockingQueue<Message<?>>

offer

public boolean offer(Message<?> e,
                     long timeout,
                     TimeUnit unit)
              throws InterruptedException
Specified by:
offer in interface BlockingQueue<Message<?>>
Throws:
InterruptedException

poll

public Message<?> poll(long timeout,
                       TimeUnit unit)
                throws InterruptedException
Specified by:
poll in interface BlockingQueue<Message<?>>
Throws:
InterruptedException

put

public void put(Message<?> e)
         throws InterruptedException
Specified by:
put in interface BlockingQueue<Message<?>>
Throws:
InterruptedException

remainingCapacity

public int remainingCapacity()
Specified by:
remainingCapacity in interface BlockingQueue<Message<?>>

take

public Message<?> take()
                throws InterruptedException
Specified by:
take in interface BlockingQueue<Message<?>>
Throws:
InterruptedException

Spring Integration

Copyright © 2010. All Rights Reserved.