Example usage for org.springframework.integration.store MessageGroupQueue put

List of usage examples for org.springframework.integration.store MessageGroupQueue put

Introduction

In this page you can find the example usage for org.springframework.integration.store MessageGroupQueue put.

Prototype

@Override
    public void put(Message<?> message) throws InterruptedException 

Source Link

Usage

From source file:org.springframework.integration.store.MessageGroupQueueTests.java

@Test
public void testPutAndPoll() throws Exception {
    MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), "FOO");
    queue.put(new GenericMessage<String>("foo"));
    Message<?> result = queue.poll(100, TimeUnit.MILLISECONDS);
    assertNotNull(result);/*from  w  ww  .j a va  2 s .  c  o m*/
}

From source file:org.springframework.integration.store.MessageGroupQueueTests.java

@Test
public void testSize() throws Exception {
    MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), "FOO");
    queue.put(new GenericMessage<String>("foo"));
    assertEquals(1, queue.size());//from   w ww. j  a  v  a  2s .c  o  m
    queue.poll(100, TimeUnit.MILLISECONDS);
    assertEquals(0, queue.size());
}

From source file:org.springframework.integration.store.MessageGroupQueueTests.java

@Test
public void testCapacityAfterExpiry() throws Exception {
    SimpleMessageStore messageGroupStore = new SimpleMessageStore();
    MessageGroupQueue queue = new MessageGroupQueue(messageGroupStore, "FOO", 2);
    queue.put(new GenericMessage<String>("foo"));
    assertEquals(1, queue.remainingCapacity());
    queue.put(new GenericMessage<String>("bar"));
    assertEquals(0, queue.remainingCapacity());
    Message<?> result = queue.poll(100, TimeUnit.MILLISECONDS);
    assertNotNull(result);/*from w  w  w. j  a  va2s  . co  m*/
    assertEquals(1, queue.remainingCapacity());
}

From source file:org.springframework.integration.store.MessageGroupQueueTests.java

@Test
public void testCapacityExceeded() throws Exception {
    SimpleMessageStore messageGroupStore = new SimpleMessageStore();
    MessageGroupQueue queue = new MessageGroupQueue(messageGroupStore, "FOO", 1);
    queue.put(new GenericMessage<String>("foo"));
    assertFalse(queue.offer(new GenericMessage<String>("bar"), 100, TimeUnit.MILLISECONDS));
}

From source file:org.springframework.integration.store.MessageGroupQueueTests.java

@Test
public void testPutAndTake() throws Exception {
    MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), "FOO");
    queue.put(new GenericMessage<String>("foo"));
    Message<?> result = queue.take();
    assertNotNull(result);/*from  ww w.j  a v a 2 s.c  o m*/
}