List of usage examples for org.springframework.integration.store MessageGroup getTimestamp
long getTimestamp();
From source file:iwein.samples.store.SimpleMessageGroup.java
public SimpleMessageGroup(MessageGroup template) { this.correlationKey = template.getCorrelationKey(); synchronized (lock) { this.marked.addAll(template.getMarked()); this.unmarked.addAll(template.getUnmarked()); }//from ww w .j a v a 2s. c o m this.timestamp = template.getTimestamp(); }
From source file:org.springframework.integration.jdbc.JdbcMessageStoreTests.java
@Test @Transactional/* www. j ava 2 s . c o m*/ public void testAddAndGetMessageGroup() throws Exception { String groupId = "X"; Message<String> message = MessageBuilder.withPayload("foo").setCorrelationId(groupId).build(); long now = System.currentTimeMillis(); messageStore.addMessageToGroup(groupId, message); MessageGroup group = messageStore.getMessageGroup(groupId); assertEquals(1, group.size()); assertTrue("Timestamp too early: " + group.getTimestamp() + "<" + now, group.getTimestamp() >= now); }
From source file:org.springframework.integration.store.AbstractMessageGroupStore.java
public int expireMessageGroups(long timeout) { int count = 0; long threshold = System.currentTimeMillis() - timeout; for (MessageGroup group : this) { long timestamp = group.getTimestamp(); if (this.isTimeoutOnIdle() && group.getLastModified() > 0) { timestamp = group.getLastModified(); }//from www . j a v a 2 s . c o m if (timestamp <= threshold) { count++; expire(group); } } return count; }