/** * Adds a property to the message resource in the outermost envelope. * * @param property * @param value */ public synchronized void addMessageProperty(Property property, URI value) { addMessageProperty(property, value.toString()); }
@Override public WonMessage process(WonMessage message) throws WonMessageProcessingException { message.addMessageProperty(WONMSG.HAS_RECEIVED_TIMESTAMP, new Date().getTime()); return message; }
@Override public WonMessage process(WonMessage message) throws WonMessageProcessingException { message.addMessageProperty(RDF.type, direction.getResource()); return message; }
@Override public void process(Exchange exchange) throws Exception { WonMessage wonMessage = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.MESSAGE_HEADER); //prepare the message to pass to the remote node URI remoteMessageUri = wonNodeInformationService .generateEventURI(wonMessage.getReceiverNodeURI()); //add the information about the corresponding message to the local one wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageUri); //the persister will pick it up later //put the factory into the outbound message factory header. It will be used to generate the outbound message //after the wonMessage has been processed and saved, to make sure that the outbound message contains //all the data that we also store locally OutboundMessageFactory outboundMessageFactory = new OutboundMessageFactory(remoteMessageUri); exchange.getIn().setHeader(WonCamelConstants.OUTBOUND_MESSAGE_FACTORY_HEADER, outboundMessageFactory); }
/** * Adds a property to the message resource in the outermost envelope. * * @param property * @param value */ public synchronized void addMessageProperty(Property property, double value) { addMessageProperty(property, getOuterEnvelopeGraph().createTypedLiteral(value)); }
/** * Adds a property to the message resource in the outermost envelope. * * @param property * @param value */ public synchronized void addMessageProperty(Property property, long value) { addMessageProperty(property, getOuterEnvelopeGraph().createTypedLiteral(value)); }
/** * Adds a property to the message resource in the outermost envelope. * * @param property * @param value */ public synchronized void addMessageProperty(Property property, boolean value) { addMessageProperty(property, getOuterEnvelopeGraph().createTypedLiteral(value)); }
@Override public void process(Exchange exchange) throws Exception { WonMessage wonMessage = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.MESSAGE_HEADER); //prepare the message to pass to the remote node URI remoteMessageUri = wonNodeInformationService .generateEventURI(wonMessage.getReceiverNodeURI()); //add the information about the corresponding message to the local one wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageUri); //the persister will pick it up later //put the factory into the outbound message factory header. It will be used to generate the outbound message //after the wonMessage has been processed and saved, to make sure that the outbound message contains //all the data that we also store locally OutboundMessageFactory outboundMessageFactory = new OutboundMessageFactory(remoteMessageUri); exchange.getIn().setHeader(WonCamelConstants.OUTBOUND_MESSAGE_FACTORY_HEADER, outboundMessageFactory); }
/** * Adds a property to the message resource in the outermost envelope. * * @param property * @param uri the object of the property, assumed to be an uri */ public synchronized void addMessageProperty(Property property, String uri) { RDFNode valueAsRdfNode = getOuterEnvelopeGraph().createResource(uri); addMessageProperty(property, valueAsRdfNode); }
/** * Adds a property to the message resource in the outermost envelope. * * @param property * @param value */ public synchronized void addMessageProperty(Property property, int value) { addMessageProperty(property, getOuterEnvelopeGraph().createTypedLiteral(value)); }
/** * Adds a property to the message resource in the outermost envelope. * * @param property * @param value */ public synchronized void addMessageProperty(Property property, float value) { addMessageProperty(property, getOuterEnvelopeGraph().createTypedLiteral(value)); }
public void process(final Exchange exchange) throws Exception { Message message = exchange.getIn(); WonMessage wonMessage = (WonMessage) message.getHeader(WonCamelConstants.MESSAGE_HEADER); logger.debug("CLOSE received from the owner side for connection {}", wonMessage.getSenderURI()); Connection con = connectionRepository.findOneByConnectionURIForUpdate(wonMessage.getSenderURI()); ConnectionState originalState = con.getState(); con = dataService.nextConnectionState(con, ConnectionEventType.OWNER_CLOSE); //if the connection was in suggested state, don't send a close message to the remote need if (originalState != ConnectionState.SUGGESTED) { //prepare the message to pass to the remote node //create the message to send to the remote node URI remoteMessageURI = wonNodeInformationService .generateEventURI(wonMessage.getReceiverNodeURI()); OutboundMessageCreator outboundMessageCreator = new OutboundMessageCreator(remoteMessageURI); //put it into the 'outbound message' header (so the persister doesn't pick up the wrong one). message.setHeader(WonCamelConstants.OUTBOUND_MESSAGE_FACTORY_HEADER, outboundMessageCreator); //set the sender uri in the envelope TODO: TwoMsgs: do not set sender here wonMessage.addMessageProperty(WONMSG.SENDER_PROPERTY, con.getConnectionURI()); //add the information about the corresponding message to the local one wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageURI); //the persister will pick it up later from the header } }
public void process(final Exchange exchange) throws Exception { Message message = exchange.getIn(); WonMessage wonMessage = (WonMessage) message.getHeader(WonCamelConstants.MESSAGE_HEADER); URI connectionUri = wonMessage.getSenderURI(); if (connectionUri == null){ throw new MissingMessagePropertyException(URI.create(WONMSG.SENDER_PROPERTY.toString())); } Connection con = connectionRepository.findOneByConnectionURIForUpdate(connectionUri); if (con.getState() != ConnectionState.CONNECTED) { throw new IllegalMessageForConnectionStateException(connectionUri, "CONNECTION_MESSAGE", con.getState()); } URI remoteMessageUri = wonNodeInformationService .generateEventURI(wonMessage.getReceiverNodeURI()); if (wonMessage.getReceiverURI() == null){ //set the sender uri in the envelope TODO: TwoMsgs: do not set sender here wonMessage.addMessageProperty(WONMSG.RECEIVER_PROPERTY, con.getRemoteConnectionURI()); } //add the information about the remote message to the locally stored one wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageUri); //the persister will pick it up later //put the factory into the outbound message factory header. It will be used to generate the outbound message //after the wonMessage has been processed and saved, to make sure that the outbound message contains //all the data that we also store locally OutboundMessageFactory outboundMessageFactory = new OutboundMessageFactory(remoteMessageUri, con); exchange.getIn().setHeader(WonCamelConstants.OUTBOUND_MESSAGE_FACTORY_HEADER, outboundMessageFactory); }
public void process(final Exchange exchange) throws Exception { Message message = exchange.getIn(); WonMessage wonMessage = (WonMessage) message.getHeader(WonCamelConstants.MESSAGE_HEADER); URI connectionUri = wonMessage.getSenderURI(); if (connectionUri == null){ throw new MissingMessagePropertyException(URI.create(WONMSG.SENDER_PROPERTY.toString())); } Connection con = connectionRepository.findOneByConnectionURIForUpdate(connectionUri); if (con.getState() != ConnectionState.CONNECTED) { throw new IllegalMessageForConnectionStateException(connectionUri, "CONNECTION_MESSAGE", con.getState()); } URI remoteMessageUri = wonNodeInformationService .generateEventURI(wonMessage.getReceiverNodeURI()); if (wonMessage.getReceiverURI() == null){ //set the sender uri in the envelope TODO: TwoMsgs: do not set sender here wonMessage.addMessageProperty(WONMSG.RECEIVER_PROPERTY, con.getRemoteConnectionURI()); } //add the information about the remote message to the locally stored one wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageUri); //the persister will pick it up later //put the factory into the outbound message factory header. It will be used to generate the outbound message //after the wonMessage has been processed and saved, to make sure that the outbound message contains //all the data that we also store locally OutboundMessageFactory outboundMessageFactory = new OutboundMessageFactory(remoteMessageUri, con); exchange.getIn().setHeader(WonCamelConstants.OUTBOUND_MESSAGE_FACTORY_HEADER, outboundMessageFactory); }
private WonMessage processSelected(List<MessageAndPlaceholder> selected, WonMessage message) { Dataset messageDataset = message.getCompleteDataset(); URI outerEnvelopeGraphURI = message.getOuterEnvelopeGraphURI(); URI messageUri = message.getMessageURI(); selected.forEach((MessageAndPlaceholder m) -> { addSignatureReferenceToMessage(messageDataset, messageUri, outerEnvelopeGraphURI, m.getWonMessage()); }); WonMessage newMessage = new WonMessage(messageDataset); selected.forEach((MessageAndPlaceholder m) -> { newMessage.addMessageProperty(WONMSG.HAS_PREVIOUS_MESSAGE_PROPERTY, m.getMessageEventPlaceholder().getMessageURI()); }); return newMessage; }
public void process(final Exchange exchange) throws Exception { Message message = exchange.getIn(); WonMessage wonMessage = (WonMessage) message.getHeader(WonCamelConstants.MESSAGE_HEADER); logger.debug("CLOSE received from the system side for connection {}", wonMessage.getSenderURI()); Connection con = connectionRepository.findOneByConnectionURIForUpdate(wonMessage.getSenderURI()); ConnectionState originalState = con.getState(); //TODO: we could introduce SYSTEM_CLOSE here con = dataService.nextConnectionState(con, ConnectionEventType.OWNER_CLOSE); //if we know the remote connection, send a close message to the remote connection if (con.getRemoteConnectionURI() != null) { URI remoteNodeURI = wonNodeInformationService.getWonNodeUri(con.getRemoteConnectionURI()); URI remoteMessageUri = wonNodeInformationService.generateEventURI(remoteNodeURI); //put the factory into the outbound message factory header. It will be used to generate the outbound message //after the wonMessage has been processed and saved, to make sure that the outbound message contains //all the data that we also store locally OutboundMessageFactory outboundMessageFactory = new OutboundMessageFactory(remoteMessageUri, con); message.setHeader(WonCamelConstants.OUTBOUND_MESSAGE_FACTORY_HEADER, outboundMessageFactory); //set the sender uri in the envelope TODO: TwoMsgs: do not set sender here wonMessage.addMessageProperty(WONMSG.SENDER_PROPERTY, con.getConnectionURI()); //add the information about the corresponding message to the local one wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageUri); //the persister will pick it up later } //because the FromSystem message is now in the message header, it will be //picked up by the routing system and delivered to the owner. //the message for the remote connection is in the outbound message header and will be // sent to the remote connection. }
wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageUri);
wonMessage.addMessageProperty(WONMSG.RECEIVER_PROPERTY, con.getConnectionURI());
wonMessage.addMessageProperty(WONMSG.SENDER_PROPERTY, con.getConnectionURI()); wonMessage.addMessageProperty(WONMSG.HAS_CORRESPONDING_REMOTE_MESSAGE, remoteMessageUri);
wonMessage.addMessageProperty(WONMSG.RECEIVER_PROPERTY, con.getConnectionURI());