public VMMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (VMConnector) endpoint.getConnector(); }
public MuleEvent process(MuleEvent event) throws MuleException { return endpoint.process(event); }
public MessageExchangePattern getExchangePattern() { return endpoint.getExchangePattern(); }
public FileMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (FileConnector) endpoint.getConnector(); if (endpoint.getProperty("outputAppend") != null) { throw new IllegalArgumentException("Configuring 'outputAppend' on a file endpoint is no longer supported. You may configure it on a file connector instead."); } }
public StdioMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (StdioConnector) endpoint.getConnector(); // apply connector-specific properties if (connector instanceof PromptStdioConnector) { PromptStdioConnector ssc = (PromptStdioConnector)connector; String outputMessage = (String) endpoint.getProperties().get("outputMessage"); if (outputMessage != null) { ssc.setOutputMessage(outputMessage); } } }
if (!endpoint.getConnector().isStarted()) logger.warn("Endpoint not started: " + endpoint.getEndpointURI() + ". Cannot dispatch notification: " + e); return; && (e.getSource()).equals(endpoint.getConnector())) if (endpoint.getFilter() != null && !endpoint.getFilter().accept(msg)) logger.info("Message not accepted with filter: " + endpoint.getFilter()); MuleEvent event = new DefaultMuleEvent(msg, endpoint.getExchangePattern(), (FlowConstruct) null); event.setEnableNotifications(false); endpoint.process(event);
public MuleEvent process(MuleEvent event) throws MessagingException { try { return endpoint.process(new DefaultMuleEvent(event.getMessage(), endpoint.getExchangePattern(), flow, event.getSession())); } catch (MessagingException e) { throw e; } catch (MuleException e) { throw new MessagingException(e.getI18nMessage(), event, e, endpoint); } }
public EndpointMessageNotification createBeginNotification(MuleEvent event) { AbstractConnector connector = (AbstractConnector) endpoint.getConnector(); if (connector.isEnableMessageEvents(event)) { int notificationAction; if (endpoint.getExchangePattern().hasResponse()) { notificationAction = EndpointMessageNotification.MESSAGE_SEND_BEGIN; } else { notificationAction = EndpointMessageNotification.MESSAGE_DISPATCH_BEGIN; } return new EndpointMessageNotification(event.getMessage(), endpoint, event.getFlowConstruct(), notificationAction); } return null; }
MuleMessage request = new DefaultMuleMessage(StringUtils.EMPTY, outboundEndpoint.getProperties(), muleContext); if (etag != null && checkEtag) MuleEvent event = new DefaultMuleEvent(request, outboundEndpoint.getExchangePattern(), flowConstruct); MuleEvent result = outboundEndpoint.process(event); MuleMessage message = null; if (result != null && !VoidMuleEvent.getInstance().equals(result))
wireFormat.write(out, serializeMessage, serverEndpoint.getEncoding()); byte[] payload = out.toByteArray(); MuleEvent event = new DefaultMuleEvent(message, serverEndpoint.getExchangePattern(),(FlowConstruct) null); event.setTimeout(timeout); if (logger.isDebugEnabled()) MuleEvent resultEvent = serverEndpoint.process(event); if (resultEvent != null && !VoidMuleEvent.getInstance().equals(resultEvent))
public MuleContext getMuleContext() { return prototypeEndpoint.getMuleContext(); }
DefaultMuleEvent event = new DefaultMuleEvent(message, endpoint.getExchangePattern(), service); RequestContext.setEvent(event); if (endpoint.getTransformers() != null) message.applyTransformers(event, endpoint.getTransformers()); endpoint.process(new DefaultMuleEvent(message, endpoint.getExchangePattern(), service));
public HttpClientMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.httpConnector = (HttpConnector) endpoint.getConnector(); List<Transformer> ts = httpConnector.getDefaultOutboundTransformers(null); if (ts.size() == 1) { this.sendTransformer = ts.get(0); } else if (ts.size() == 0) { this.sendTransformer = new ObjectToHttpClientMethodRequest(); this.sendTransformer.setMuleContext(getEndpoint().getMuleContext()); this.sendTransformer.setEndpoint(endpoint); } else { this.sendTransformer = new TransformerChain(ts); } }
protected MuleMessage handleRedirect(HttpMethod method, MuleEvent event) throws HttpResponseException, MuleException, IOException { String followRedirects = (String)endpoint.getProperty("followRedirects"); if (followRedirects==null || "false".equalsIgnoreCase(followRedirects)) { if (logger.isInfoEnabled()) { logger.info("Received a redirect, but followRedirects=false. Response code: " + method.getStatusCode() + " " + method.getStatusText()); } return getResponseFromMethod(method, null); } Header locationHeader = method.getResponseHeader(HttpConstants.HEADER_LOCATION); if (locationHeader == null) { throw new HttpResponseException(method.getStatusText(), method.getStatusCode()); } OutboundEndpoint out = new EndpointURIEndpointBuilder(locationHeader.getValue(), getEndpoint().getMuleContext()).buildOutboundEndpoint(); MuleEvent result = out.process(event); if (result != null && !VoidMuleEvent.getInstance().equals(result)) { return result.getMessage(); } else { return null; } }
requestChainBuilder.setName("OutboundEndpoint '" + endpoint.getEndpointURI().getUri() + "' request chain"); requestChainBuilder.chain(endpoint.getMessageProcessors()); requestChainBuilder.chain(target); if (!endpoint.getExchangePattern().hasResponse()) responseChainBuilder.setName("OutboundEndpoint '" + endpoint.getEndpointURI().getUri() + "' response chain"); responseChainBuilder.chain(endpoint.getResponseMessageProcessors()); compositeChainBuilder.setName("OutboundEndpoint '" + endpoint.getEndpointURI().getUri() + "' composite request/response chain"); compositeChainBuilder.chain(requestChainBuilder.build(), responseChainBuilder.build()); return compositeChainBuilder.build();
/** Override this method to change the default MessageProcessors. */ protected List<MessageProcessor> createOutboundMessageProcessors(OutboundEndpoint endpoint) throws MuleException { Connector connector = endpoint.getConnector(); List<MessageProcessor> list = new ArrayList<MessageProcessor>(); // Log but don't proceed if connector is not started list.add(new OutboundLoggingMessageProcessor()); list.add(new ProcessIfStartedMessageProcessor(connector, connector.getLifecycleState())); // Everything is processed within ExecutionTemplate list.add(new EndpointTransactionalInterceptingMessageProcessor(endpoint.getTransactionConfig())); list.add(new OutboundEventTimeoutMessageProcessor()); list.add(new OutboundSessionHandlerMessageProcessor(connector.getSessionHandler())); list.add(new OutboundEndpointPropertyMessageProcessor(endpoint)); list.add(new OutboundRootMessageIdPropertyMessageProcessor()); list.add(new OutboundResponsePropertiesMessageProcessor(endpoint)); list.add(new OutboundEndpointMimeTypeCheckingMessageProcessor(endpoint)); return list; }
if (!supportsProtocol(endpoint.getConnector().getProtocol())) this.getProtocol(), endpoint.getEndpointURI().toString()).getMessage()); logger.debug("Borrowing a dispatcher for endpoint: " + endpoint.getEndpointURI()); logger.debug("Borrowed a dispatcher for endpoint: " + endpoint.getEndpointURI() + " = " + dispatcher.toString());
if (!lastEndpoint && !endpoint.getExchangePattern().hasResponse()) if (endpoint.getExchangePattern().hasResponse()) resultMessage.applyTransformers(result, endpoint.getResponseTransformers()); logger.info("Failed to send/dispatch to endpoint: " + endpoint.getEndpointURI().toString() + ". Error was: " + e.getMessage() + ". Trying next endpoint");
@Override public MuleEvent doCatchMessage(MuleEvent event) throws RoutingException { if (getEndpoint() == null) { throw new RoutingException(CoreMessages.noCatchAllEndpointSet(), event, getEndpoint()); } try { OutboundEndpoint endpoint = getEndpoint(); if (sendTransformed && endpoint.getTransformers() != null) { event.getMessage().applyTransformers(event, endpoint.getTransformers()); } MuleEvent result = endpoint.process(event); if (statistics != null && statistics.isEnabled()) { statistics.incrementRoutedMessage(getEndpoint()); } return result; } catch (Exception e) { throw new RoutingException(event, getEndpoint(), e); } }
public EndpointURI getEndpointURI() { if (dynamicEndpointURI != null) { return dynamicEndpointURI; } else { return endpoint.getEndpointURI(); } }