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

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

Introduction

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

Prototype

public MessageMetadata(UUID messageId) 

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;
    }/*  w w w .  j  a  v a2  s.c  o  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  ww  . j  a  va2 s. com*/
        return null;
    }
}