Package org.mule.transport

Examples of org.mule.transport.AbstractConnector


    }

    @Override
    protected Connector getConnector() throws EndpointException
    {
        AbstractConnector c = (AbstractConnector) super.getConnector();
        EndpointURI endpointURI = uriBuilder.getEndpoint();
        if(!c.supportsProtocol(endpointURI.getFullScheme()))
        {
            c.registerSupportedMetaProtocol(endpointURI.getSchemeMetaInfo());
        }
        return c;
    }
View Full Code Here


        assertTrue(c.isStarted());
        assertFalse(c.isPaused());
        assertFalse(c.isStopped());

        // The listeners should be registered and started.
        AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.mule.default");
        assertNotNull(connector);
        assertTrue(connector.isStarted());
        MessageReceiver[] receivers = connector.getReceivers("*default*");
        assertEquals(1, receivers.length);
        assertTrue(receivers[0].isConnected());
    }
View Full Code Here

        assertFalse(c.isStarted());
        assertTrue(c.isStopped());
        assertFalse(c.isPaused());

        // The connector should be started, but with no listeners registered.
        AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.mule.default");
        assertNotNull(connector);
        assertTrue(connector.isStarted());
        MessageReceiver[] receivers = connector.getReceivers("*stopped*");
        assertEquals(0, receivers.length);

        // Start the service.
        c.start();
        assertTrue(c.isStarted());
        assertFalse(c.isStopped());
        assertFalse(c.isPaused());

        // The listeners should now be registered and started.
        assertTrue(connector.isStarted());
        receivers = connector.getReceivers("*stopped*");
        assertEquals(1, receivers.length);
        assertTrue(receivers[0].isConnected());
    }
View Full Code Here

        assertTrue(c.isStarted());
        assertFalse(c.isStopped());
        assertFalse(c.isPaused());

        // The listeners should be registered and started.
        AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.mule.default");
        assertNotNull(connector);
        assertTrue(connector.isStarted());
        MessageReceiver[] receivers = connector.getReceivers("*started*");
        assertEquals(1, receivers.length);
        assertTrue(receivers[0].isConnected());

        // Stop service
        c.stop();
        assertFalse(c.isStarted());
        assertFalse(c.isPaused());
        assertTrue(c.isStopped());

        // Connector is still started, but no more receivers.
        assertTrue(connector.isStarted());
        receivers = connector.getReceivers("*started*");
        assertEquals(0, receivers.length);
    }
View Full Code Here

        assertFalse(c.isStarted());
        assertTrue(c.isPaused());
        assertFalse(c.isStopped());

        // The listeners should be registered and started.
        AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.mule.default");
        assertNotNull(connector);
        assertTrue(connector.isStarted());
        MessageReceiver[] receivers = connector.getReceivers("*paused*");
        assertEquals(1, receivers.length);
        assertTrue(receivers[0].isConnected());
    }
View Full Code Here

        this.endpoint = endpoint;
    }

    public MuleEvent process(MuleEvent event) throws MuleException
    {
        AbstractConnector connector = (AbstractConnector) endpoint.getConnector();
        if (connector.isEnableMessageEvents())
        {
            connector.fireNotification(new EndpointMessageNotification(event.getMessage(), endpoint,
                event.getFlowConstruct().getName(), EndpointMessageNotification.MESSAGE_RECEIVED));
        }

        return event;
    }
View Full Code Here

        handleException(ex, null);
    }
   
    protected void handleReconnection(ConnectException ex)
    {
        AbstractConnector connector = (AbstractConnector) ex.getFailed();

        // Make sure the connector is not already being reconnected by another receiver thread.
        if (connector.isConnecting())
        {
            return;
        }
           
        logger.info("Exception caught is a ConnectException, attempting to reconnect...");
       
        // Disconnect
        try
        {
            logger.debug("Disconnecting " + connector.getName());
            connector.stop();
            connector.disconnect();
        }
        catch (Exception e1)
        {
            logger.error(e1.getMessage());
        }

        // Reconnect (retry policy will go into effect here if configured)
        try
        {
            logger.debug("Reconnecting " + connector.getName());
            connector.connect();
            connector.start();
        }
        catch (Exception e2)
        {
            logger.error(e2.getMessage());
        }
View Full Code Here

        if (epData.getEncoding() != null)
        {
            endpointBuilder.setEncoding(parsePlaceholderValues(epData.getEncoding()));
        }

        AbstractConnector connector;
        if (epData.getConnectorName() != null)
        {
            connector = (AbstractConnector) muleContext.getRegistry().lookupConnector(parsePlaceholderValues(epData.getConnectorName()));
        }
        else if (epData.getConnector() != null)
        {
            connector = (AbstractConnector) epData.getConnector();
        }
        else
        {
            //We always create a new connecotr for annotations when one has not been configured
            MuleEndpointURI uri = new MuleEndpointURI(parsePlaceholderValues(epData.getAddress()), muleContext);

            connector = (AbstractConnector) transportFactory.createConnector(uri);
            //The ibeans transport factory will not always create a new connector, check before registering
            if (muleContext.getRegistry().lookupConnector(connector.getName()) == null)
            {
                muleContext.getRegistry().registerConnector(connector);
            }
        }
        endpointBuilder.setConnector(connector);

        //Set threading for this connector. Note we simplify by setting all profiles with a single value 'threads'
        //that can be set by the user
        String threadsString = (String) epData.getProperties().get("threads");
        if (threadsString != null)
        {
            int threads = Integer.valueOf(threadsString);
            connector.setMaxDispatchersActive(threads);
            connector.setMaxRequestersActive(threads);
            connector.getReceiverThreadingProfile().setMaxThreadsActive(threads);
            connector.getReceiverThreadingProfile().setMaxThreadsIdle(threads);
        }

        if (epData.getName() != null)
        {
            endpointBuilder.setName(parsePlaceholderValues(epData.getName()));
View Full Code Here

    }

    public void start() throws MuleException
    {
        InboundEndpoint endpoint = (InboundEndpoint) muleContext.getRegistry().lookupObject(this.inboundPollingEndpointName);
        AbstractConnector connector = (AbstractConnector) endpoint.getConnector();
        receiver = (AbstractPollingMessageReceiver) connector.getReceiver(null, endpoint);
        receiver.disableNativeScheduling();
    }
View Full Code Here

        if (connectorName == null)
        {
            throw new JobExecutionException(QuartzMessages.connectorNotInJobDataMap().getMessage());
        }

        AbstractConnector connector = (AbstractConnector) muleContext.getRegistry().lookupConnector(connectorName);
        if (connector == null)
        {
            throw new JobExecutionException(QuartzMessages.noConnectorFound(connectorName).getMessage());
        }

        AbstractMessageReceiver receiver = (AbstractMessageReceiver)connector.lookupReceiver(receiverKey);
        if (receiver == null)
        {
            throw new JobExecutionException(
                QuartzMessages.noReceiverInConnector(receiverKey, connectorName).getMessage());
        }
View Full Code Here

TOP

Related Classes of org.mule.transport.AbstractConnector

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.