Package org.mule.component

Examples of org.mule.component.SimpleCallableJavaComponent


        ChainedThreadingProfile threadingProfile = (ChainedThreadingProfile) muleContext.getDefaultServiceThreadingProfile();
        threadingProfile.setMaxThreadsActive(1);
        threadingProfile.setThreadWaitTimeout(200);
        threadingProfile.setPoolExhaustedAction(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
        service.setThreadingProfile(threadingProfile);
        final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new Callable()
        {

            public Object onCall(MuleEventContext eventContext) throws Exception
            {
                latch.countDown();
                return null;
            }
        });
        component.setMuleContext(muleContext);
        service.setComponent(component);
        muleContext.getRegistry().registerService(service);

        service.dispatchEvent(MuleTestUtils.getTestEvent("test", service, muleContext));
View Full Code Here


        service.setName(serviceName);
        ChainedThreadingProfile threadingProfile = (ChainedThreadingProfile) muleContext.getDefaultServiceThreadingProfile();
        threadingProfile.setDoThreading(false);
        service.setThreadingProfile(threadingProfile);
        final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new Callable()
        {
            public Object onCall(MuleEventContext eventContext) throws Exception
            {
                assertEquals(mainThread, Thread.currentThread());
                latch.countDown();
                return null;
            }
        });
        component.setMuleContext(muleContext);
        service.setComponent(component);
        muleContext.getRegistry().registerService(service);

        service.dispatchEvent(MuleTestUtils.getTestEvent("test",
            getTestInboundEndpoint(MessageExchangePattern.ONE_WAY), muleContext));
View Full Code Here

        service.setName(serviceName);
        ChainedThreadingProfile threadingProfile = (ChainedThreadingProfile) muleContext.getDefaultServiceThreadingProfile();
        threadingProfile.setDoThreading(true);
        service.setThreadingProfile(threadingProfile);
        final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new Callable()
        {
            public Object onCall(MuleEventContext eventContext) throws Exception
            {
                assertTrue(Thread.currentThread().getName().startsWith("seda." + serviceName));
                latch.countDown();
                return null;
            }
        });
        component.setMuleContext(muleContext);
        service.setComponent(component);
        muleContext.getRegistry().registerService(service);

        service.dispatchEvent(MuleTestUtils.getTestEvent("test",
            getTestInboundEndpoint(MessageExchangePattern.ONE_WAY), muleContext));
View Full Code Here

        return component(new DefaultJavaComponent(objectFactory));
    }

    public SimpleServiceBuilder component(Callable callable)
    {
        return component(new SimpleCallableJavaComponent(callable));
    }
View Full Code Here

            Map props = new HashMap();
            props.put("wireFormat", wireFormat);
            props.put("encoding", encoding);
            props.put("synchronousEventTimeout", new Integer(eventTimeout));
            final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new PrototypeObjectFactory(RemoteDispatcherComponent.class, props));
            component.setMuleContext(muleContext);
            service.setComponent(component);


            if (!(service.getMessageSource() instanceof CompositeMessageSource))
            {
View Full Code Here

            service.setName(MANAGER_COMPONENT_NAME);
            service.setModel(muleContext.getRegistry().lookupSystemModel());

            RemoteDispatcherComponent rdc = new RemoteDispatcherComponent(endpoint, wireFormat, encoding, new Integer(eventTimeout));
           
            final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(
                new SingletonObjectFactory(rdc));
            component.setMuleContext(muleContext);
            service.setComponent(component);


            if (!(service.getMessageSource() instanceof CompositeMessageSource))
            {
View Full Code Here

        return component(new DefaultJavaComponent(objectFactory));
    }

    public SimpleServiceBuilder component(Callable callable)
    {
        return component(new SimpleCallableJavaComponent(callable));
    }
View Full Code Here

        ChainedThreadingProfile threadingProfile = (ChainedThreadingProfile) muleContext.getDefaultServiceThreadingProfile();
        threadingProfile.setMaxThreadsActive(1);
        threadingProfile.setThreadWaitTimeout(200);
        threadingProfile.setPoolExhaustedAction(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
        service.setThreadingProfile(threadingProfile);
        final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new Callable()
        {
            @Override
            public Object onCall(MuleEventContext eventContext) throws Exception
            {
                latch.countDown();
                return null;
            }
        });
        component.setMuleContext(muleContext);
        service.setComponent(component);
        muleContext.getRegistry().registerService(service);

        service.process(MuleTestUtils.getTestEvent("test", service, muleContext));
        assertTrue(latch.await(200, TimeUnit.MILLISECONDS));
View Full Code Here

        ChainedThreadingProfile threadingProfile = (ChainedThreadingProfile) muleContext.getDefaultServiceThreadingProfile();
        threadingProfile.setDoThreading(false);
        service.setThreadingProfile(threadingProfile);
        final Thread mainThread = Thread.currentThread();

        final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new Callable()
        {
            @Override
            public Object onCall(MuleEventContext eventContext) throws Exception
            {
                assertEquals(mainThread, Thread.currentThread());
                latch.countDown();
                return null;
            }
        });
        component.setMuleContext(muleContext);
        service.setComponent(component);
        muleContext.getRegistry().registerService(service);

        service.process(MuleTestUtils.getTestEvent("test",
            getTestInboundEndpoint(MessageExchangePattern.ONE_WAY), muleContext));
View Full Code Here

        service.setName(serviceName);
        ChainedThreadingProfile threadingProfile = (ChainedThreadingProfile) muleContext.getDefaultServiceThreadingProfile();
        threadingProfile.setDoThreading(true);
        service.setThreadingProfile(threadingProfile);
        final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new Callable()
        {
            @Override
            public Object onCall(MuleEventContext eventContext) throws Exception
            {
                System.out.println(Thread.currentThread().getName());
                assertTrue(Thread.currentThread().getName().startsWith(serviceName));
                latch.countDown();
                return null;
            }
        });
        component.setMuleContext(muleContext);
        service.setComponent(component);
        muleContext.getRegistry().registerService(service);

        service.process(MuleTestUtils.getTestEvent("test",
            getTestInboundEndpoint(MessageExchangePattern.ONE_WAY), muleContext));
View Full Code Here

TOP

Related Classes of org.mule.component.SimpleCallableJavaComponent

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.