Package org.jencks

Examples of org.jencks.JCAConnector


         
          // Inbound connector
          ActiveMQActivationSpec ac = new ActiveMQActivationSpec();
          ac.setDestinationType("javax.jms.Queue");
          ac.setDestination(INBOUND_PREFIX + broker.getContainerName());
          containerConnector = new JCAConnector();
          containerConnector.setBootstrapContext(getBootstrapContext());
          containerConnector.setActivationSpec(ac);
          containerConnector.setResourceAdapter(resourceAdapter);
          containerConnector.setEndpointFactory(new SingletonEndpointFactory(this, getTransactionManager()));
          containerConnector.afterPropertiesSet();
         
          // Outbound connector
          ActiveMQManagedConnectionFactory mcf = new ActiveMQManagedConnectionFactory();
          mcf.setResourceAdapter(resourceAdapter);
          ConnectionFactory cf = (ConnectionFactory) mcf.createConnectionFactory(getConnectionManager());
          jmsTemplate = new JmsTemplate(cf);
          jmsTemplate.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          jmsPersistentTemplate = new JmsTemplate(cf);
          jmsPersistentTemplate.setDeliveryMode(DeliveryMode.PERSISTENT);
         
          // Inbound broadcast
          ac = new ActiveMQActivationSpec();
          ac.setDestinationType("javax.jms.Topic");
          ac.setDestination(broadcastDestinationName);
          broadcastConnector = new JCAConnector();
          broadcastConnector.setBootstrapContext(getBootstrapContext());
          broadcastConnector.setActivationSpec(ac);
          broadcastConnector.setResourceAdapter(resourceAdapter);
          broadcastConnector.setEndpointFactory(new SingletonEndpointFactory(this));
          broadcastConnector.afterPropertiesSet();
View Full Code Here


    public void shutDown() throws JBIException {
        super.shutDown();
        stop();
        // Destroy connectors
        while (!connectorMap.isEmpty()) {
          JCAConnector connector = (JCAConnector) connectorMap.remove(connectorMap.keySet().iterator().next());
          try {
            connector.destroy();
          } catch (Exception e) {
            log.warn("error closing jca connector", e);
          }
        }
        try {
View Full Code Here

            String componentName = event.getPacket().getComponentNameSpace().getName();
            if (event.getStatus() == ComponentPacketEvent.ACTIVATED){         
              ActiveMQActivationSpec ac = new ActiveMQActivationSpec();
              ac.setDestinationType("javax.jms.Queue");
              ac.setDestination(INBOUND_PREFIX + componentName);
              JCAConnector connector = new JCAConnector();
              connector.setBootstrapContext(getBootstrapContext());
              connector.setActivationSpec(ac);
              connector.setResourceAdapter(resourceAdapter);
              connector.setEndpointFactory(new SingletonEndpointFactory(this, getTransactionManager()));
              connector.afterPropertiesSet();
                connectorMap.put(componentName, connector);
            } else if (event.getStatus() == ComponentPacketEvent.DEACTIVATED){
              JCAConnector connector = (JCAConnector) connectorMap.remove(componentName);
                if (connector != null){
                  connector.destroy();
                }
            }
            // broadcast change to the network
            log.info("broadcast to internal JMS network: " + event);
            jmsTemplate.send(broadcastTopic, new MessageCreator() {
View Full Code Here

         
          // Inbound connector
          ActiveMQActivationSpec ac = new ActiveMQActivationSpec();
          ac.setDestinationType("javax.jms.Queue");
          ac.setDestination(INBOUND_PREFIX + broker.getContainer().getName());
          containerConnector = new JCAConnector();
          containerConnector.setBootstrapContext(getBootstrapContext());
          containerConnector.setActivationSpec(ac);
          containerConnector.setResourceAdapter(resourceAdapter);
          containerConnector.setEndpointFactory(new SingletonEndpointFactory(this, getTransactionManager()));
          containerConnector.start();
View Full Code Here

            try {
                // Inbound broadcast
                ActiveMQActivationSpec ac = new ActiveMQActivationSpec();
                ac.setDestinationType("javax.jms.Topic");
                ac.setDestination(broadcastDestinationName);
                broadcastConnector = new JCAConnector();
                broadcastConnector.setBootstrapContext(getBootstrapContext());
                broadcastConnector.setActivationSpec(ac);
                broadcastConnector.setResourceAdapter(resourceAdapter);
                broadcastConnector.setEndpointFactory(new SingletonEndpointFactory(new MessageListener() {
                    public void onMessage(Message message) {
View Full Code Here

        broker.getContainer().removeListener(endpointListener);
        // Remove component listener
        broker.getContainer().removeListener(componentListener);
        // Destroy connectors
        while (!connectorMap.isEmpty()) {
          JCAConnector connector = (JCAConnector) connectorMap.remove(connectorMap.keySet().iterator().next());
          try {
            connector.destroy();
          } catch (Exception e) {
            log.debug("Error closing jca connector", e);
          }
        }
        try {
View Full Code Here

            String key = EndpointSupport.getKey(event.getEndpoint());
            if(!connectorMap.containsKey(key)){
                ActiveMQActivationSpec ac = new ActiveMQActivationSpec();
                ac.setDestinationType("javax.jms.Queue");
                ac.setDestination(INBOUND_PREFIX + key);
                JCAConnector connector = new JCAConnector();
                connector.setBootstrapContext(getBootstrapContext());
                connector.setActivationSpec(ac);
                connector.setResourceAdapter(resourceAdapter);
                connector.setEndpointFactory(new SingletonEndpointFactory(this, getTransactionManager()));
                connector.start();
                connectorMap.put(key, connector);
            }
            // broadcast change to the network
            if (broadcast) {
                log.debug(broker.getContainer().getName() + ": broadcasting info for " + event);
View Full Code Here

    }
   
    public void onInternalEndpointUnregistered(EndpointEvent event, boolean broadcast) {
        try{
            String key = EndpointSupport.getKey(event.getEndpoint());
            JCAConnector connector=(JCAConnector) connectorMap.remove(key);
            if(connector!=null){
                connector.destroy();
            }
            // broadcast change to the network
            if (broadcast) {
                log.debug(broker.getContainer().getName() + ": broadcasting info for " + event);
                sendJmsMessage(broadcastTopic, event, false, false);
View Full Code Here

            String key = event.getComponent().getName();
            if(!connectorMap.containsKey(key)){
                ActiveMQActivationSpec ac = new ActiveMQActivationSpec();
                ac.setDestinationType("javax.jms.Queue");
                ac.setDestination(INBOUND_PREFIX + key);
                JCAConnector connector = new JCAConnector();
                connector.setBootstrapContext(getBootstrapContext());
                connector.setActivationSpec(ac);
                connector.setResourceAdapter(resourceAdapter);
                connector.setEndpointFactory(new SingletonEndpointFactory(this, getTransactionManager()));
                connector.start();
                connectorMap.put(key, connector);
            }
        } catch (Exception e) {
            log.error("Cannot create consumer for component " + event.getComponent().getName(), e);
        }
View Full Code Here

    }
   
    public void onComponentStopped(ComponentEvent event) {
        try {
            String key = event.getComponent().getName();
            JCAConnector connector = (JCAConnector) connectorMap.remove(key);
            if (connector != null){
                connector.destroy();
            }
        } catch (Exception e) {
            log.error("Cannot destroy consumer for component " + event.getComponent().getName(), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.jencks.JCAConnector

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.