List of usage examples for org.springframework.messaging Message toString
public String toString()
From source file:org.thingsplode.server.bus.interceptors.LoggingInterceptor.java
@Override public Message<?> preSend(Message<?> message, MessageChannel channel) { if (logger.isDebugEnabled()) { logger.debug("On channel: " + channel.toString() + " -> Message: " + message.toString()); }//www. ja v a 2 s . c o m return message; // if (message == null) { // return; // } // // Object payload = message.getPayload(); // AbstractRequest req; // if (payload == null || !(payload instanceof AbstractRequest)) { // return; // } else { // req = (AbstractRequest) payload; // } // Device d = deviceRepo.findBydeviceId(req.getDeviceId()); // if (d != null) { // message.getHeaders().put(Device.MAIN_TYPE, d); // } // // message.getHeaders().put(AbstractMessage.MESSAGE_TYPE, req.getClass().getSimpleName()); }
From source file:ru.asmsoft.p2p.transaction.IncomingTransactionManager.java
@ServiceActivator(inputChannel = "incoming-update-me-channel", outputChannel = "outgoing-channel") public Message handeUpdateMeRequest(Message<UpdateMePacket> message) { logger.info("UpdateMe received: {}", message.toString()); // Switch state machine stateMachine.sendEvent(NodeEvents.UpdateMeRequestReceived); // Prepare response packet UpdateMeResponse packet = new UpdateMeResponse(messageRepository.getDbVersion(), messageRepository.getMessage(), message.getPayload()); // Switch state machine stateMachine.sendEvent(NodeEvents.UpdateByRequestSent); // Send response return prepareResponse(message, packet); }
From source file:ru.asmsoft.p2p.transaction.IncomingTransactionManager.java
@ServiceActivator(inputChannel = "incoming-update-transaction", outputChannel = "outgoing-channel") public Message handeIncomingUpdateTransaction(Message<MessagePacket> message) { logger.info("Incoming update received: {}", message.toString()); // Switch state machine stateMachine.sendEvent(NodeEvents.UpdateReceived); // Prepare response packet MessageReceivedPacket packet = new MessageReceivedPacket(message.getPayload()); // registerChangeset MessagePacket messagePacket = message.getPayload(); messageRepository.registerChangeset(messagePacket.getDbVersion(), messagePacket.getMessages()); // Send response return prepareResponse(message, packet); }
From source file:ru.asmsoft.p2p.transaction.IncomingTransactionManager.java
@ServiceActivator(inputChannel = "incoming-start-transaction", outputChannel = "outgoing-channel") public Message handeIncomingStartTransaction(Message<StartTransactionPacket> message) { logger.info("Incoming transaction received: {}", message.toString()); // Switch state machine stateMachine.sendEvent(NodeEvents.StartTransactionReceived); // Prepare response packet ConfirmTransactionStartedPacket packet = new ConfirmTransactionStartedPacket(message.getPayload()); // Send response return prepareResponse(message, packet); }
From source file:ru.asmsoft.p2p.transaction.IncomingTransactionManager.java
@ServiceActivator(inputChannel = "incoming-rollback-transaction") public void handleRollbackTransaction(Message<RollbackTransactionPacket> message) { logger.info("Rollback transaction received: {}", message.toString()); // rollback//from w w w .j ava2s. c o m RollbackTransactionPacket commitPacket = message.getPayload(); try { messageRepository.cancelChangeset(commitPacket.getDbVersion()); } catch (NoChangesetFoundException e) { logger.error(e.getMessage()); } // Switch state machine stateMachine.sendEvent(NodeEvents.RollbackReceived); }
From source file:ru.asmsoft.p2p.transaction.IncomingTransactionManager.java
@ServiceActivator(inputChannel = "incoming-commit-transaction") public void handleCommitTransaction(Message<CommitTransactionPacket> message) { logger.info("Commit transaction received: {}", message.toString()); stateMachine.sendEvent(NodeEvents.CommitReceived); // commit/*w w w. j a va 2s.com*/ CommitTransactionPacket commitPacket = message.getPayload(); try { messageRepository.applyChangeset(commitPacket.getDbVersion()); } catch (NoChangesetFoundException e) { // failed to update logger.error(e.getMessage()); // set wrong version to re-sync messageRepository.updateDbVersion(-1L); } // Switch state machine stateMachine.sendEvent(NodeEvents.CommitReceived); }