Examples of AbstractConnector

  • org.mortbay.jetty.AbstractConnector
    Abstract Connector implementation. This abstract implemenation of the Connector interface provides: @author gregwTODO - allow multiple Acceptor threads
  • org.mule.transport.AbstractConnector
    AbstractConnector provides base functionality for all connectors provided with Mule. Connectors are the mechanism used to connect to external systems and protocols in order to send and receive data.

    The AbstractConnector provides getter and setter methods for endpoint name, transport name and protocol. It also provides methods to stop and start connectors and sets up a dispatcher threadpool which allows deriving connectors the possibility to dispatch work to separate threads. This functionality is controlled with the doThreading property on the threadingProfiles for dispatchers and receivers. The lifecycle for a connector is -

    1. Create
    2. Initialise
    3. Connect
    4. Connect receivers
    5. Start
    6. Start Receivers
    7. Stop
    8. Stop Receivers
    9. Disconnect
    10. Disconnect Receivers
    11. Dispose
    12. Dispose Receivers

  • Examples of org.mule.transport.AbstractConnector

            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

    Examples of org.mule.transport.AbstractConnector

            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

    Examples of org.mule.transport.AbstractConnector

        }

        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

    Examples of org.mule.transport.AbstractConnector

            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

    Examples of org.mule.transport.AbstractConnector

            return "issues/service-overrides-mule-1770-test.xml";
        }

        public void testServiceOverrides()
        {
            AbstractConnector c = (AbstractConnector)muleContext.getRegistry().lookupConnector("test");
            assertNotNull("Connector should not be null", c);
            assertNotNull("Service overrides should not be null", c.getServiceOverrides());
            String temp =  (String)c.getServiceOverrides().get(MuleProperties.CONNECTOR_DISPATCHER_FACTORY);
            assertNotNull("DispatcherFactory override should not be null", temp);
            assertEquals(TestMessageDispatcherFactory.class.getName(), temp);
            Transformer transformer = TransformerUtils.firstOrNull(c.getDefaultInboundTransformers(null));
            assertNotNull("InboundTransformer should not be null", transformer);
            assertEquals(NoActionTransformer.class, transformer.getClass());
        }
    View Full Code Here

    Examples of org.mule.transport.AbstractConnector


        // MULE-1878
        public void testDuplicate()
        {
            AbstractConnector c1 = (AbstractConnector)muleContext.getRegistry().lookupConnector("test");
            assertNotNull("Connector should not be null", c1);
            Transformer t1 = TransformerUtils.firstOrNull(c1.getDefaultInboundTransformers(null));
            assertNotNull("InboundTransformer should not be null", t1);
            assertEquals(NoActionTransformer.class, t1.getClass());

            AbstractConnector c2 = (AbstractConnector)muleContext.getRegistry().lookupConnector("second");
            assertNotNull("Connector should not be null", c2);
            Transformer t2 = TransformerUtils.firstOrNull(c2.getDefaultInboundTransformers(null));
            assertNull("InboundTransformer should be null", t2);
        }
    View Full Code Here

    Examples of org.mule.transport.AbstractConnector

                {
                    scheme = address.substring(0, i);
                    address = scheme + "://dynamic";
                    //This is used for creating the connector, since we don't know if the actual URI address is a vaild URI.
                    EndpointURI tempUri = new MuleEndpointURI(address, context);
                    AbstractConnector cnn = null;

                    if (epData.getConnectorName() != null)
                    {
                        cnn = (AbstractConnector) context.getRegistry().lookupConnector(epData.getConnectorName());
                    }
                    if (cnn == null)
                    {
                        cnn = (AbstractConnector) new TransportFactory(context).createConnector(tempUri);
                        if (epData.getConnectorName() != null)
                        {
                            cnn.setName(epData.getConnectorName());
                        }
                        context.getRegistry().registerConnector(cnn);
                    }

                    //This allows connector properties to be set as properties on the endpoint
    View Full Code Here

    Examples of org.mule.transport.AbstractConnector

         * @throws TransportServiceException if the connector cannot be created
         */
        @Override
        public Connector createConnector() throws TransportServiceException
        {
            AbstractConnector c = (AbstractConnector) super.createConnector();
            c.registerSupportedMetaProtocol(metaScheme);
            return c;
        }
    View Full Code Here

    Examples of org.mule.transport.AbstractConnector

            this.endpoint = endpoint;
        }

        public MuleEvent process(MuleEvent event) throws MuleException
        {
            AbstractConnector connector = (AbstractConnector) endpoint.getConnector();
            if (connector.isEnableMessageEvents())
            {
                String component = null;
                if (event.getFlowConstruct() != null)
                {
                    component = event.getFlowConstruct().getName();
                }

                int notificationAction;
                if (endpoint.getExchangePattern().hasResponse())
                {
                    notificationAction = EndpointMessageNotification.MESSAGE_SENT;
                }
                else
                {
                    notificationAction = EndpointMessageNotification.MESSAGE_DISPATCHED;
                }
                connector.fireNotification(new EndpointMessageNotification(event.getMessage(), endpoint,
                    component, notificationAction));
            }

            return event;
        }
    View Full Code Here

    Examples of org.mule.transport.AbstractConnector

            assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle());
            assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction());
            assertEquals(defaultThreadTTL, tp.getThreadTTL());

            // test that unset values retain a default value
            AbstractConnector c = (AbstractConnector) muleContext.getRegistry().lookupConnector("dummyConnector");
            tp = c.getDispatcherThreadingProfile();
            // this value is configured
            assertEquals(connectorMaxBufferSize, tp.getMaxBufferSize());
            // these values are inherited
            assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive());
            assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle());
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.