private void checkRemoteEventURI(final WonMessage message, final WonNodeInfo senderNodeInfo) { checkNodeConformance(senderNodeInfo, null, null, message.getCorrespondingRemoteMessageURI()); }
public ProposalEvent(Connection con, MessageEvent proposalEvent) { super(con); this.proposalEvent = proposalEvent; if(proposalEvent instanceof WonMessageReceivedOnConnectionEvent){ this.proposalUri = proposalEvent.getWonMessage().getCorrespondingRemoteMessageURI(); } else if(proposalEvent instanceof WonMessageSentOnConnectionEvent){ this.proposalUri = proposalEvent.getWonMessage().getMessageURI(); } else { throw new IllegalArgumentException("MessageEvent can only be of the instance WonMessageReceivedOnConnectionEvent or WonMessageSentOnConnectionEvent"); } }
private void logRouteStart(Exchange exchange) { //UnitOfWork -> getRouteContext -> Route -> Id. String routeId = exchange.getUnitOfWork().getRouteContext().getRoute().getId(); WonMessage message = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.MESSAGE_HEADER); if (message == null){ logger.debug("starting route {}: [no WoNMessage]", routeId); return; } logger.debug("starting route {}: {} type:{}, dir:{}, resp:{}, rem: {}", new String[]{ routeId, message.getMessageURI().toString(), message.getMessageType().toString(), message.getEnvelopeType().toString(), message.getIsResponseToMessageURI() == null ? "[not a response]" : message.getIsResponseToMessageURI().toString(), message.getCorrespondingRemoteMessageURI() == null ? "[no remote message uri]" : message.getCorrespondingRemoteMessageURI().toString() }); }
@Override protected void doRun(Event event, EventListener executingListener) throws Exception { if (!(event instanceof MessageFromOtherNeedEvent)) { return; } logger.debug("eagerly caching data in reaction to event {}", event); MessageFromOtherNeedEvent msgEvent = (MessageFromOtherNeedEvent) event; WonMessage wonMessage = msgEvent.getWonMessage(); LinkedDataSource linkedDataSource = context.getLinkedDataSource(); if (linkedDataSource instanceof CachingLinkedDataSource) { ((CachingLinkedDataSource) linkedDataSource).addToCache(wonMessage.getCompleteDataset(), wonMessage.getMessageURI(), wonMessage.getReceiverNeedURI()); URI requester = wonMessage.getReceiverNeedURI(); Set<URI> toLoad = new HashSet<URI>(); addIfNotNull(toLoad, wonMessage.getCorrespondingRemoteMessageURI()); List<URI> previous = WonRdfUtils.MessageUtils.getPreviousMessageUrisIncludingRemote(wonMessage); addIfNotNull(toLoad, previous); toLoad.forEach(uri -> linkedDataSource.getDataForResource(uri, requester)); } }
responseMsgUris.put(responseEvent.getMessage().getMessageURI(), responseEvent.getNeedURI()); if (responseEvent.isRemoteResponse()) { responseMsgUris.put(responseEvent.getMessage().getCorrespondingRemoteMessageURI(), responseEvent.getRemoteNeedURI()); URI remoteMessageURI = msg.getCorrespondingRemoteMessageURI(); msgSplitsBCD.get(remoteMessageURI.toString()).stop();
/** * Returns a property of the corresponding remote message (i.e. the object of the first triple ( * [corresponding-remote-message-uri] [property] X ) * found in one of the content graphs of the specified message. */ private static URI getObjectOfRemoteMessageProperty(final WonMessage message, final Property property) { List<String> contentGraphUris = message.getContentGraphURIs(); Dataset contentGraphs = message.getMessageContent(); URI messageURI = message.getCorrespondingRemoteMessageURI(); if (messageURI != null) { for (String graphUri : contentGraphUris) { Model contentGraph = contentGraphs.getNamedModel(graphUri); StmtIterator smtIter = contentGraph.getResource(messageURI.toString()).listProperties(property); if (smtIter.hasNext()) { return URI.create(smtIter.nextStatement().getObject().asResource().getURI()); } } } return null; }
public MessageEventPlaceholder(URI parentURI, WonMessage wonMessage, EventContainer eventContainer) { this.parentURI = parentURI; this.messageURI = wonMessage.getMessageURI(); this.messageType = wonMessage.getMessageType(); this.senderURI = wonMessage.getSenderURI(); this.senderNeedURI = wonMessage.getSenderNeedURI(); this.senderNodeURI = wonMessage.getSenderNodeURI(); this.receiverURI = wonMessage.getReceiverURI(); this.receiverNeedURI = wonMessage.getReceiverNeedURI(); this.receiverNodeURI = wonMessage.getReceiverNodeURI(); this.creationDate = new Date(); this.correspondingRemoteMessageURI = wonMessage.getCorrespondingRemoteMessageURI(); this.referencedByOtherMessage = false; this.innermostMessageURI = wonMessage.getInnermostMessageURI(); this.eventContainer = eventContainer; }
@Override protected void doRun(Event event, EventListener executingListener) throws Exception { WonMessage responseWonMessage = null; if (event instanceof SuccessResponseEvent) { responseWonMessage = ((SuccessResponseEvent)event).getMessage(); } else if (event instanceof FailureResponseEvent) { responseWonMessage = ((FailureResponseEvent)event).getMessage(); } else { //can't process any other events return; } logger.debug("eagerly caching data in reaction to event {}", event); //put received message into cache LinkedDataSource linkedDataSource = context.getLinkedDataSource(); if (linkedDataSource instanceof CachingLinkedDataSource) { URI requester = responseWonMessage.getReceiverNeedURI(); ((CachingLinkedDataSource) linkedDataSource).addToCache(responseWonMessage.getCompleteDataset(), responseWonMessage.getMessageURI(), requester); //load the original message(s) into cache, too Set<URI> toLoad = new HashSet<URI>(); addIfNotNull(toLoad, responseWonMessage.getIsRemoteResponseToMessageURI()); addIfNotNull(toLoad, responseWonMessage.getIsResponseToMessageURI()); addIfNotNull(toLoad, responseWonMessage.getCorrespondingRemoteMessageURI()); List<URI> previous = WonRdfUtils.MessageUtils.getPreviousMessageUrisIncludingRemote(responseWonMessage); addIfNotNull(toLoad, previous); toLoad.forEach(uri -> linkedDataSource.getDataForResource(uri, requester)); } }
logger.trace("Message Type: "+ (receivedMessage ? "RECEIVED" : "SENT")); logger.trace("MessageUri: "+ wonMessage.getMessageURI()); logger.trace("CorrespondingRemoteMessageURI: "+ wonMessage.getCorrespondingRemoteMessageURI()); logger.trace("NeedUri: " + needUri); logger.trace("remoteNeedUri: " + remoteNeedUri);
.setSenderNeedURI(originalMessage.getReceiverNeedURI()) .setSenderURI(originalMessage.getReceiverURI()) .setIsRemoteResponseToMessageURI(originalMessage.getCorrespondingRemoteMessageURI()); } else if (WonMessageDirection.FROM_OWNER == origDirection|| WonMessageDirection.FROM_SYSTEM == origDirection ){