public MissingMessagePropertyException(Throwable cause, boolean enableSuppression, boolean writableStackTrace, URI missingProperty) { super(createExceptionMessage(missingProperty), cause, enableSuppression, writableStackTrace); this.missingProperty = missingProperty; } }
public void process(final Exchange exchange) throws Exception { Message message = exchange.getIn(); WonMessage wonMessage = (WonMessage) message.getHeader(WonCamelConstants.MESSAGE_HEADER); URI connectionUri = wonMessage.getReceiverURI(); if (connectionUri == null){ throw new MissingMessagePropertyException(URI.create(WONMSG.RECEIVER_PROPERTY.toString())); } Connection con = connectionRepository.findOneByConnectionURIForUpdate(connectionUri); if (con.getState() != ConnectionState.CONNECTED) { throw new IllegalMessageForConnectionStateException(connectionUri, "CONNECTION_MESSAGE", con.getState()); } }
@Override public void process(Exchange exchange) throws Exception { Message message = exchange.getIn(); WonMessage wonMessage = (WonMessage) message.getHeader(WonCamelConstants.MESSAGE_HEADER); URI receiverNeedURI = wonMessage.getReceiverNeedURI(); URI senderNeedURI = wonMessage.getSenderNeedURI(); if (receiverNeedURI== null){ throw new MissingMessagePropertyException(URI.create(WONMSG.RECEIVER_NEED_PROPERTY.toString())); } if (senderNeedURI == null){ throw new MissingMessagePropertyException(URI.create(WONMSG.SENDER_NEED_PROPERTY.toString())); } if (!receiverNeedURI.equals(senderNeedURI)) { throw new IllegalArgumentException("sender need uri " + senderNeedURI +" does not equal receiver need uri " + receiverNeedURI); } Need need = needRepository.findOneByNeedURI(senderNeedURI); if (need == null){ throw new IllegalArgumentException("need not found - cannot send need message to: " + senderNeedURI); } need.getEventContainer().getEvents().add(messageEventRepository.findOneByMessageURIforUpdate(wonMessage.getMessageURI())); need = needRepository.save(need); } }
@Override public void process(Exchange exchange) throws Exception { URI facetType = null; //first, try to extract the facet from the message WonMessage wonMessage = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.MESSAGE_HEADER); facetType = WonRdfUtils.FacetUtils.getFacet(wonMessage); if (facetType == null) { //not found.. look into the database. For that, we need to know the connection in question: URI conUri = (URI) exchange.getIn().getHeader(WonCamelConstants.CONNECTION_URI_HEADER); if (conUri == null) throw new MissingMessagePropertyException(URI.create(WONMSG.RECEIVER_PROPERTY.getURI().toString())); Connection con = connectionRepository.findOneByConnectionURI(conUri); facetType = con.getTypeURI(); } if (facetType == null){ throw new WonMessageProcessingException(String.format("Failed to determine connection " + "facet for message %s", wonMessage.getMessageURI())); } exchange.getIn().setHeader(WonCamelConstants.FACET_TYPE_HEADER, facetType); } }
public MissingMessagePropertyException(URI missingProperty) { super(createExceptionMessage(missingProperty)); this.missingProperty = missingProperty; }
@Override public void process(Exchange exchange) throws Exception { WonMessage wonMessage = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.MESSAGE_HEADER); URI receiverNeedURI = wonMessage.getReceiverNeedURI(); URI senderNeedURI = wonMessage.getSenderNeedURI(); if (receiverNeedURI== null){ throw new MissingMessagePropertyException(URI.create(WONMSG.RECEIVER_NEED_PROPERTY.toString())); } if (senderNeedURI == null){ throw new MissingMessagePropertyException(URI.create(WONMSG.SENDER_NEED_PROPERTY.toString())); } if (!receiverNeedURI.equals(senderNeedURI)) { throw new IllegalArgumentException("sender need uri " + senderNeedURI +" does not equal receiver need uri " + receiverNeedURI); } logger.debug("DEACTIVATING need. needURI:{}", receiverNeedURI); Need need = DataAccessUtils.loadNeed(needRepository, receiverNeedURI); need.getEventContainer().getEvents().add(messageEventRepository.findOneByMessageURIforUpdate(wonMessage.getMessageURI())); need.setState(NeedState.INACTIVE); need = needRepository.save(need); } }
WonMessageType origType = message.getIsResponseToMessageType(); if (origType == null) { throw new MissingMessagePropertyException(URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString())); WonMessageType origType = message.getIsResponseToMessageType(); if (origType == null) { throw new MissingMessagePropertyException( URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString()));
WonMessageType origType = message.getIsResponseToMessageType(); if (origType == null) { throw new MissingMessagePropertyException(URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString())); WonMessageType origType = message.getIsResponseToMessageType(); if (origType == null) { throw new MissingMessagePropertyException( URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString()));
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); }
if (remoteConnectionUri == null) throw new MissingMessagePropertyException(URI.create(WONMSG.SENDER_PROPERTY.getURI().toString()));