Package org.mule.api.endpoint

Examples of org.mule.api.endpoint.OutboundEndpoint


     */
    public OutboundEndpoint getOutboundEndpoint(String uri,
                                                   MessageExchangePattern mep,
                                                   Long responseTimeout) throws MuleException
    {
        OutboundEndpoint endpoint = (OutboundEndpoint) outboundEndpointCache.get(uri + ":" + mep.toString()
                                                                                 + ":" + responseTimeout);
        if (endpoint == null)
        {
            EndpointBuilder endpointBuilder = muleContext.getRegistry()
                .lookupEndpointFactory()
                .getEndpointBuilder(uri);
            endpointBuilder.setExchangePattern(mep);
            if (responseTimeout != null && responseTimeout > 0)
            {
                endpointBuilder.setResponseTimeout(responseTimeout.intValue());
            }
            endpoint = muleContext.getEndpointFactory().getOutboundEndpoint(endpointBuilder);
            OutboundEndpoint concurrentlyAddedEndpoint = (OutboundEndpoint) outboundEndpointCache.putIfAbsent(
                uri + ":" + mep.toString() + ":" + responseTimeout, endpoint);
            if (concurrentlyAddedEndpoint != null)
            {
                return concurrentlyAddedEndpoint;
            }
View Full Code Here


            endpointBuilder);

        EndpointBuilder endpointBuilder2 = new EndpointURIEndpointBuilder(getOutDest(), muleContext);
        endpointBuilder2.setName("testOut");
        endpointBuilder2.setConnector(connector);
        OutboundEndpoint outProvider = muleContext.getEndpointFactory().getOutboundEndpoint(
            endpointBuilder2);
       
        service.setOutboundMessageProcessor(new DefaultOutboundRouterCollection());
        OutboundPassThroughRouter router = new OutboundPassThroughRouter();
        router.addRoute(outProvider);
View Full Code Here

        return (InboundEndpoint) registerEndpoint(endpoint);
    }

    public OutboundEndpoint getOutboundEndpoint(EndpointBuilder builder) throws MuleException
    {
        OutboundEndpoint endpoint = builder.buildOutboundEndpoint();
        return (OutboundEndpoint) registerEndpoint(endpoint);
    }
View Full Code Here

     * @throws ApplicationEventException if the event cannot be dispatched i.e. if
     *             the underlying transport throws an exception
     */
    protected void dispatchEvent(MuleApplicationEvent applicationEvent) throws ApplicationEventException
    {
        OutboundEndpoint endpoint;
        try
        {
            endpoint = muleContext.getEndpointFactory().getOutboundEndpoint(
                applicationEvent.getEndpoint());
        }
        catch (MuleException e)
        {
            throw new ApplicationEventException("Failed to get endpoint for endpointUri: "
                                                + applicationEvent.getEndpoint(), e);
        }
        if (endpoint != null)
        {
            try
            {
                // if (applicationEvent.getEndpoint() != null) {
                // endpoint.setEndpointURI(applicationEvent.getEndpoint());
                // }

                DefaultMuleMessage message = new DefaultMuleMessage(applicationEvent.getSource(),
                    applicationEvent.getProperties(), muleContext);
                // has dispatch been triggered using beanFactory.publish()
                // without a current event
                if (applicationEvent.getMuleEventContext() != null)
                {
                    // tell mule not to try and route this event itself
                    applicationEvent.getMuleEventContext().setStopFurtherProcessing(true);
                    applicationEvent.getMuleEventContext().dispatchEvent(message, endpoint);
                }
                else
                {
                    MuleSession session = new DefaultMuleSession(service, muleContext);
                    DefaultMuleEvent event = new DefaultMuleEvent(message, endpoint.getExchangePattern(),
                        session);
                    RequestContext.setEvent(event);
                    // transform if necessary
                    if (endpoint.getTransformers() != null)
                    {
                        message = new DefaultMuleMessage(applicationEvent.getSource(),
                            applicationEvent.getProperties(), muleContext);
                        message.applyTransformers(event, endpoint.getTransformers());
                    }
                    endpoint.process(new DefaultMuleEvent(message, endpoint.getExchangePattern(), session));
                }
            }
            catch (Exception e1)
            {
                throw new ApplicationEventException("Failed to dispatch event: " + e1.getMessage(), e1);
View Full Code Here

    protected void processOutbound(Class componentFactoryClass, org.mule.api.service.Service service) throws MuleException
    {
        OutboundRouter router = processOutboundRouter(componentFactoryClass);

        OutboundEndpoint outboundEndpoint;
        List<AnnotationMetaData> annotations = AnnotationUtils.getClassAndMethodAnnotations(componentFactoryClass);
        for (AnnotationMetaData annotation : annotations)
        {
            outboundEndpoint = tryOutboundEndpointAnnotation(annotation, ChannelType.Outbound);
            if (outboundEndpoint != null)
View Full Code Here

        final EndpointURI uri = getEndpointURIForMessage(event);

        builder.setURIBuilder(new URIBuilder(uri));
        endpoint = builder.buildOutboundEndpoint();

        final OutboundEndpoint outboundEndpoint = new DynamicURIOutboundEndpoint(endpoint, uri);

        return outboundEndpoint.process(event);
    }
View Full Code Here

    public void testEndpoint3Config() throws Exception
    {
        Service service = muleContext.getRegistry().lookupService("testService3");
        assertNotNull(service);

        OutboundEndpoint ep = (OutboundEndpoint) ((AbstractOutboundRouter)getOutboundRouterCollection(service).getRoutes().get(0)).getRoute("qEP3");
        assertNotNull(ep.getProperty("jobConfig"));
        assertTrue(ep.getProperty("jobConfig") instanceof CustomJobFromMessageConfig);
        CustomJobFromMessageConfig config = (CustomJobFromMessageConfig)ep.getProperty("jobConfig");
        assertEquals("header", config.getEvaluator());
        assertEquals("jobConfig", config.getExpression());
        assertNull(config.getCustomEvaluator());
        //Test grabbing the Job instance
    }
View Full Code Here

    public void testEndpoint4Config() throws Exception
    {
        Service service = muleContext.getRegistry().lookupService("testService4");
        assertNotNull(service);

        OutboundEndpoint ep = (OutboundEndpoint) ((AbstractOutboundRouter)getOutboundRouterCollection(service).getRoutes().get(0)).getRoute("qEP4");

        assertNotNull(ep.getProperty("jobConfig"));
        assertTrue(ep.getProperty("jobConfig") instanceof CustomJobConfig);
        CustomJobConfig config = (CustomJobConfig)ep.getProperty("jobConfig");
        assertTrue(config.getJob() instanceof EventGeneratorJob);
    }
View Full Code Here

    public void testEndpoint6Config() throws Exception
    {
        Service service = muleContext.getRegistry().lookupService("testService6");
        assertNotNull(service);

        OutboundEndpoint ep = (OutboundEndpoint) ((AbstractOutboundRouter) getOutboundRouterCollection(
            service).getRoutes().get(0)).getRoute("qEP6");
       
        assertNotNull(ep.getProperty("jobConfig"));
        assertTrue(ep.getProperty("jobConfig") instanceof ScheduledDispatchJobConfig);
        ScheduledDispatchJobConfig config = (ScheduledDispatchJobConfig)ep.getProperty("jobConfig");
        assertEquals(ScheduledDispatchJob.class, config.getJobClass());
        assertEquals("scheduledDispatchEndpoint", config.getEndpointRef());
    }
View Full Code Here

        }
        //TODO MULE-4952 what is the strategy here for proxy components?
        endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE);

        OutboundEndpoint endpoint = endpointBuilder.buildOutboundEndpoint();

        MuleEvent responseEvent = endpoint.process(event);

        if (responseEvent != null)
        {
            return responseEvent.getMessage();
        }
View Full Code Here

TOP

Related Classes of org.mule.api.endpoint.OutboundEndpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.