Example usage for org.springframework.integration.store MessageMetadata setTimestamp

List of usage examples for org.springframework.integration.store MessageMetadata setTimestamp

Introduction

In this page you can find the example usage for org.springframework.integration.store MessageMetadata setTimestamp.

Prototype

public void setTimestamp(long timestamp) 

Source Link

Usage

From source file:org.springframework.integration.jdbc.store.JdbcMessageStore.java

@Override
public MessageMetadata getMessageMetadata(UUID id) {
    List<MessageMetadata> list = this.jdbcTemplate.query(getQuery(Query.GET_MESSAGE), (rs, rn) -> {
        MessageMetadata messageMetadata = new MessageMetadata(UUID.fromString(rs.getString("MESSAGE_ID")));
        messageMetadata.setTimestamp(rs.getTimestamp("CREATED_DATE").getTime());
        return messageMetadata;
    }, getKey(id), this.region);
    if (list.isEmpty()) {
        return null;
    }//  www  .  j  a  v a 2s. co  m
    return list.get(0);
}

From source file:org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore.java

public MessageMetadata getMessageMetadata(UUID id) {
    Assert.notNull(id, "'id' must not be null");
    Query query = Query.query(Criteria.where(MessageDocumentFields.MESSAGE_ID).is(id));
    MessageDocument document = this.mongoTemplate.findOne(query, MessageDocument.class, this.collectionName);
    if (document != null) {
        MessageMetadata messageMetadata = new MessageMetadata(id);
        messageMetadata.setTimestamp(document.getCreatedTime());
        return messageMetadata;
    } else {//from w w w  . j a  v a 2s. c o m
        return null;
    }
}