use of io.tbd.tbdex.protocol.core.Message in project tbdex-protocol by TBD54566975.
the class OfferAcceptProcessor method process.
@Override
public Message process(Message message) {
String messageId = UUID.randomUUID().toString();
// TODO: send real schema
SettlementRequest settlementRequest = new SettlementRequest("schema");
return new Message.Builder(messageId, message.threadID(), message.to(), message.from()).build(settlementRequest);
}
use of io.tbd.tbdex.protocol.core.Message in project tbdex-protocol by TBD54566975.
the class HibernateMessageThreadStore method getThread.
@SuppressWarnings("unchecked")
@Override
public MessageThread getThread(String threadToken) {
Session session = HibernateUtil.getSession();
Transaction tx = session.getTransaction();
tx.begin();
Query query = session.createQuery(// TODO: add a message order field, using created_at is just temporary
"from DbMessage where thread_token=:t order by created_at asc").setParameter("t", threadToken);
LinkedList<Message> messages = (LinkedList<Message>) query.list().stream().map(m -> ((DbMessage) m).getMessage()).collect(Collectors.toCollection(LinkedList::new));
tx.commit();
session.close();
return new MessageThread(messages);
}
Aggregations