@Override public void process(MessageExchange exchange) throws Exception { if (exchange.getRole() == Role.PROVIDER) { if (exchange.getStatus() == ExchangeStatus.ACTIVE) { //TODO: actually implement some control bus operations fail(exchange, new UnsupportedOperationException("No control bus operations available")); } } else { throw new MessagingException( "Unexpected exchange role: CamelContextEndpoint is not capable of handling " + exchange.getRole()); } }
public void process(MessageExchange exchange) throws Exception { if (exchange == null) { return; } // The component acts as a consumer, this means this exchange is // received because // we sent it to another component. As it is active, this is either an // out or a fault // If this component does not create / send exchanges, you may just // throw an // UnsupportedOperationException if (exchange.getRole() == Role.CONSUMER) { onConsumerExchange(exchange); } else if (exchange.getRole() == MessageExchange.Role.PROVIDER) { // The component acts as a provider, this means that another component // has requested our // service // As this exchange is active, this is either an in or a fault (out are // send by this // component) onProviderExchange(exchange); } else { // Unknown role throw new MessagingException("OSWorkflowEndpoint.onMessageExchange(): Unknown role: " + exchange.getRole()); } }
@Override public void process(MessageExchange exchange) throws Exception { if (exchange.getRole() == Role.CONSUMER) { onConsumerExchange(exchange); } else { onProviderExchange(exchange); } }
protected void processAsync(MessageExchange exchange) throws Exception { // This exchange comes from the consumer if (exchange.getRole() == MessageExchange.Role.PROVIDER) { processProviderAsync(exchange); // The exchange comes from a target } else { processConsumerAsync(exchange); } }
@Override public void process(MessageExchange exchange) throws Exception { // The component acts as a provider, this means that another component has requested our service // As this exchange is active, this is either an in or a fault (out are sent by this component) if (exchange.getRole() == MessageExchange.Role.PROVIDER) { // Exchange is finished if (exchange.getStatus() == ExchangeStatus.DONE) { return; // Exchange has been aborted with an exception } else if (exchange.getStatus() == ExchangeStatus.ERROR) { return; // Exchange is active } else { handleActiveProviderExchange(exchange); } // Unsupported role: this should never happen has we never create exchanges } else { throw new IllegalStateException("Unsupported role: " + exchange.getRole()); } }
protected void processAsync(MessageExchange exchange) throws Exception { // The exchange comes from the consumer if (exchange.getRole() == MessageExchange.Role.PROVIDER) { processAsyncProvider(exchange); // If the exchange comes from the transformer } else if (Boolean.TRUE.equals(exchange.getProperty(TRANSFORMER))) { processAsyncTransformerResponse(exchange); // The exchange comes from the target } else { processAsyncTargetResponse(exchange); } }
@Override public void send(final MessageExchange messageExchange) throws MessagingException { if (messageExchange.getEndpoint() == null) { resolveEndpoint(messageExchange); } final MessageExchangeWrapper msgExchange = (MessageExchangeWrapper) messageExchange; try { if (messageExchange.getRole().equals(Role.PROVIDER)) { this.responsesToClientQueue.put(msgExchange.getMessageExchange()); } else { this.requestsToServerQueue.put(msgExchange.getMessageExchange()); } } catch (final InterruptedException e) { throw new UncheckedException(e); } }
public void process(MessageExchange exchange) throws Exception { boolean txSync = exchange.isTransacted() && Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC)); if (txSync && exchange.getRole() == Role.PROVIDER && exchange.getStatus() == ExchangeStatus.ACTIVE) { processSync(exchange); } else { processAsync(exchange); } }
public void onMessageExchange(MessageExchange exchange) throws MessagingException { // Handle consumer exchanges && non-active RobustInOnly provider exchanges if (exchange.getRole() == MessageExchange.Role.CONSUMER || exchange.getProperty(correlation) != null) { processOngoingExchange(exchange); } else if (exchange.getStatus() == ExchangeStatus.ACTIVE) { processFirstExchange(exchange); } }
public void onMessageExchange(MessageExchange exchange) throws MessagingException { // Handle consumer exchanges && non-active RobustInOnly provider exchanges if (exchange.getRole() == MessageExchange.Role.CONSUMER || exchange.getProperty(correlation) != null) { processOngoingExchange(exchange); } else if (exchange.getStatus() == ExchangeStatus.ACTIVE) { processFirstExchange(exchange); } }
/** * Return a <code>MessageExchangeDecorator</code> for Consumer, as * <code>InOut</code>. * * @see javax.jbi.messaging.MessageExchangeFactory#createInOutExchange() * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public InOut createInOutExchange() throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createInOutExchange(); // Convert into fake message exchange InOut meF = (InOut) Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, Convert.IN_OUT_PATTERN); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
/** * Return a <code>MessageExchangeDecorator</code> for Consumer, as * <code>InOnlyExchange, InOutExchange,...</code> * * @see javax.jbi.messaging.MessageExchangeFactory#createExchange(java.net.URI) * @param pattern * the pattern * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public MessageExchange createExchange(final URI pattern) throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createExchange(pattern); // Convert into fake message exchange MessageExchange meF = Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, null); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
/** * Return a <code>MessageExchangeDecorator</code> for Consumer, as * <code>InOnly</code>. * * @see javax.jbi.messaging.MessageExchangeFactory#createInOnlyExchange() * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public InOnly createInOnlyExchange() throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createInOnlyExchange(); // Convert into fake message exchange InOnly meF = (InOnly) Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, Convert.IN_ONLY_PATTERN); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
public void onJbiMessageExchange(MessageExchange mex) throws MessagingException { if (mex.getRole().equals(javax.jbi.messaging.MessageExchange.Role.CONSUMER)) { _ode._consumer.onJbiMessageExchange(mex); } else if (mex.getRole().equals(javax.jbi.messaging.MessageExchange.Role.PROVIDER)) { if (OdeContext.PM_SERVICE_NAME.equals(mex.getEndpoint().getServiceName())) { if (_ode._processManagementProcessor == null) throw new IllegalStateException("Process Management API not initialized"); _ode._processManagementProcessor.onJbiMessageExchange(mex); return; } if (OdeContext.IM_SERVICE_NAME.equals(mex.getEndpoint().getServiceName())) { if (_ode._instanceManagementProcessor == null) throw new IllegalStateException("Instance Management API not initialized"); _ode._instanceManagementProcessor.onJbiMessageExchange(mex); return; } Endpoint endpoint = new Endpoint(mex.getEndpoint().getServiceName(), mex.getEndpoint().getEndpointName()); OdeService svc = _ode.getService(endpoint); if (svc == null) { __log.error("Received message exchange for unknown service: " + mex.getEndpoint().getServiceName()); return; } svc.onJbiMessageExchange(mex); } else { __log.debug("unexpected role: " + mex.getRole()); } }
/** * Return a <code>MessageExchangeDecorator</code> for Consumer, as * <code>RobustInOnly</code>. * * @see javax.jbi.messaging.MessageExchangeFactory#createRobustInOnlyExchange() * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public RobustInOnly createRobustInOnlyExchange() throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createRobustInOnlyExchange(); // Convert into fake message exchange RobustInOnly meF = (RobustInOnly) Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, Convert.ROBUST_IN_ONLY_PATTERN); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
/** * Return a <code>MessageExchangeDecorator</code> for Consumer, as * <code>InOptionalOut</code>. * * @see javax.jbi.messaging.MessageExchangeFactory#createInOptionalOutExchange() * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public InOptionalOut createInOptionalOutExchange() throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createInOptionalOutExchange(); // Convert into fake message exchange InOptionalOut meF = (InOptionalOut) Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, Convert.IN_OPTIONAL_OUT_PATTERN); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
/** * TODO find an endpoint for this parameteters. Return a * <code>MessageExchangeDecorator</code> for Consumer * * @see javax.jbi.messaging.MessageExchangeFactory#createExchange(javax.xml.namespace.QName, * javax.xml.namespace.QName) * @param serviceName * the service name * @param operationName * the operationName * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public MessageExchange createExchange( final QName serviceName, final QName operationName) throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createExchange(serviceName, operationName); // Convert into fake message exchange MessageExchange meF = Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, null); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
protected void onExchangeAccepted(ExchangeEvent event) { MessageExchange me = event.getExchange(); // This is a new exchange sent by a consumer if (me.getStatus() == ExchangeStatus.ACTIVE && me.getRole() == Role.PROVIDER && me.getMessage("out") == null && me.getFault() == null && me instanceof MessageExchangeImpl) { String source = EndpointSupport.getUniqueKey(me.getEndpoint()); EndpointStats stats = endpointStats.get(source); if (stats != null) { stats.incrementInbound(); } } }
public void send(MessageExchange messageExchange) throws MessagingException { try { Request req = getOrCreateCurrentRequest(messageExchange); if (messageExchange.getRole() == MessageExchange.Role.CONSUMER && messageExchange.getStatus() == ExchangeStatus.ACTIVE) { if (!(req.getBean() instanceof MessageExchangeListener)) { throw new IllegalStateException("A bean acting as a consumer and using the channel to send exchanges must implement the MessageExchangeListener interface"); } req.addExchange(messageExchange); } if (messageExchange.getStatus() != ExchangeStatus.ACTIVE) { checkEndOfRequest(req); } getChannel().send(messageExchange); } catch (MessagingException e) { throw e; } catch (Exception e) { throw new MessagingException(e); } }
&& me.getRole() == Role.CONSUMER && me.getMessage("out") == null && me.getFault() == null