Package org.activemq.broker

Examples of org.activemq.broker.Broker


        ActiveMQConnection connection2 = (ActiveMQConnection) factory2.createConnection();
        assertNotNull(connection2);
       
        VmTransportChannel transportChannel = (VmTransportChannel) connection.getTransportChannel();
        BrokerClientImpl brokerClient = (BrokerClientImpl)transportChannel.getSendListener();
        Broker broker = brokerClient.getBrokerConnector().getBrokerContainer().getBroker();
       
        VmTransportChannel transportChannel2 = (VmTransportChannel) connection2.getTransportChannel();
        BrokerClientImpl brokerClient2 = (BrokerClientImpl)transportChannel2.getSendListener();
        Broker broker2 = brokerClient2.getBrokerConnector().getBrokerContainer().getBroker();
       
        assertTrue( broker == broker2 );
       
    }
View Full Code Here


        ActiveMQConnection connection2 = (ActiveMQConnection) factory2.createConnection();
        assertNotNull(connection2);
       
        VmTransportChannel transportChannel = (VmTransportChannel) connection.getTransportChannel();
        BrokerClientImpl brokerClient = (BrokerClientImpl)transportChannel.getSendListener();
        Broker broker = brokerClient.getBrokerConnector().getBrokerContainer().getBroker();
       
        VmTransportChannel transportChannel2 = (VmTransportChannel) connection2.getTransportChannel();
        BrokerClientImpl brokerClient2 = (BrokerClientImpl)transportChannel2.getSendListener();
        Broker broker2 = brokerClient2.getBrokerConnector().getBrokerContainer().getBroker();
       
        assertTrue( broker == broker2 );
       
    }
View Full Code Here

    private String topicPrefix = "topic.";

    public Context getInitialContext(Hashtable environment) throws NamingException {
        // lets create a factory
        Map data = new ConcurrentHashMap();
        Broker broker = null;
       
        String[] names = getConnectionFactoryNames(environment);
        for (int i = 0; i < names.length; i++) {
           
            String name = names[i];
            ActiveMQConnectionFactory factory = createConnectionFactory(name, environment);
           
            if( broker==null ) {
                try {
                    broker = factory.getEmbeddedBroker();
                }
                catch (JMSException e) {
                    log.warn("Failed to get embedded broker", e);
                }
            }
            data.put(name,factory);
        }
               
        createQueues(data, environment);
        createTopics(data, environment);
        if (broker != null) {
            data.put("destinations", broker.getDestinationContext(environment));
        }

        data.put("dynamicQueues", new LazyCreateContext() {
            protected Object createEntry(String name) {
                return new ActiveMQQueue(name);
View Full Code Here

        assertTrue("Should have created a broker!", value != null);
        assertTrue("Should be a broker container: " + value, value instanceof BrokerContainer);

        BrokerContainer container = (BrokerContainer) value;
        Broker broker = container.getBroker();
        assertTrue("Should have a broker!", broker != null);

        assertEquals("Broker name not set!", "localhost", broker.getBrokerName());

        Object transport = factory.getBean("transport");
        assertTrue("Made transport", transport != null);

        List connectors = container.getTransportConnectors();
        assertEquals("Should have created more connectors", 3, connectors.size());

        BrokerConnectorImpl connector1 = (BrokerConnectorImpl) connectors.get(0);
        TransportServerChannel serverChannel1 = connector1.getServerChannel();
        assertTrue(serverChannel1 instanceof VmTransportServerChannel);

        BrokerConnectorImpl connector2 = (BrokerConnectorImpl) connectors.get(1);
        TransportServerChannel serverChannel2 = connector2.getServerChannel();
        assertTrue(serverChannel2 instanceof TcpTransportServerChannel);
        TcpTransportServerChannel tcpChannel2 = (TcpTransportServerChannel) serverChannel2;
        assertEquals("backlog", 1000, tcpChannel2.getBacklog());
        assertEquals("maxOutstandingMessages", 50, tcpChannel2.getMaxOutstandingMessages());
        assertTrue("useAsyncSend", tcpChannel2.isUseAsyncSend());
        assertTrue("Created correct wireFormat: " + tcpChannel2.getWireFormat(), tcpChannel2.getWireFormat() instanceof WireFormatStub);


        List networkConnectors = container.getNetworkConnectors();
        assertEquals("Should have a single network connector", 1, networkConnectors.size());
        NetworkConnector networkConnector = (NetworkConnector) networkConnectors.get(0);
        ActiveMQPrefetchPolicy localPrefetchPolicy = networkConnector.getLocalPrefetchPolicy();
        assertNotNull("localPrefetchPolicy", localPrefetchPolicy);
        assertEquals("localPrefetchPolicy.getQueuePrefetch", 1, localPrefetchPolicy.getQueuePrefetch());
        assertEquals("localPrefetchPolicy.getQueueBrowserPrefetch", 2, localPrefetchPolicy.getQueueBrowserPrefetch());

        ActiveMQPrefetchPolicy remotePrefetchPolicy = networkConnector.getRemotePrefetchPolicy();
        assertNotNull("remotePrefetchPolicy", remotePrefetchPolicy);
        assertEquals("remotePrefetchPolicy.getTopicPrefetch", 3, remotePrefetchPolicy.getTopicPrefetch());
        assertEquals("remotePrefetchPolicy.getDurableTopicPrefetch", 4, remotePrefetchPolicy.getDurableTopicPrefetch());


        List networkChannels = networkConnector.getNetworkChannels();
        assertEquals("Should have 2 network channels", 2, networkChannels.size());

        NetworkChannel networkChannel = (NetworkChannel) networkChannels.get(0);
        assertEquals("URL not equal", "tcp://somehost:61616", networkChannel.getUri());
        assertEquals("remoteUserName", "James", networkChannel.getRemoteUserName());
        assertEquals("remotePassword", "Stewey", networkChannel.getRemotePassword());

        System.out.println("Created network channel: " + networkChannel);

        SecurityAdapter securityAdapter = broker.getSecurityAdapter();
        assertTrue("Should have created a security adapter", securityAdapter != null);

        RedeliveryPolicy redeliveryPolicy = broker.getRedeliveryPolicy();
        assertTrue("Should have created a redeliveryPolicy", redeliveryPolicy != null);
        assertEquals("isBackOffMode", true, redeliveryPolicy.isBackOffMode());
        assertEquals("getMaximumRetryCount", 10, redeliveryPolicy.getMaximumRetryCount());

        DiscoveryAgent discoveryAgent = container.getDiscoveryAgent();
View Full Code Here

        String brokerName = getName();
        BrokerContainer container = factory.createBrokerContainer(brokerName, BrokerContext.getInstance());

        assertTrue("Should have a broker container!", container != null);

        Broker broker = container.getBroker();
        assertTrue("Should have a broker!", broker != null);

        assertEquals("Broker name not set!", brokerName, broker.getBrokerName());

        container.start();
        container.stop();
        return container;
    }
View Full Code Here

    private String topicPrefix = "topic.";

    public Context getInitialContext(Hashtable environment) throws NamingException {
        // lets create a factory
        Map data = new ConcurrentHashMap();
        Broker broker = null;
       
        String[] names = getConnectionFactoryNames(environment);
        for (int i = 0; i < names.length; i++) {
           
            String name = names[i];
            ActiveMQConnectionFactory factory = createConnectionFactory(name, environment);
           
            if( broker==null ) {
                try {
                    broker = factory.getEmbeddedBroker();
                }
                catch (JMSException ignore) {
                }
            }
            data.put(name,factory);
        }
               
        createQueues(data, environment);
        createTopics(data, environment);
        if (broker != null) {
            data.put("destinations", broker.getDestinationContext(environment));
        }
       
        return new ReadOnlyContext(environment, data);
    }
View Full Code Here

        ActiveMQConnection connection2 = (ActiveMQConnection) factory2.createConnection();
        assertNotNull(connection2);
       
        VmTransportChannel transportChannel = (VmTransportChannel) connection.getTransportChannel();
        BrokerClientImpl brokerClient = (BrokerClientImpl)transportChannel.getSendListener();
        Broker broker = brokerClient.getBrokerConnector().getBrokerContainer().getBroker();
       
        VmTransportChannel transportChannel2 = (VmTransportChannel) connection2.getTransportChannel();
        BrokerClientImpl brokerClient2 = (BrokerClientImpl)transportChannel2.getSendListener();
        Broker broker2 = brokerClient2.getBrokerConnector().getBrokerContainer().getBroker();
       
        assertTrue( broker == broker2 );
       
    }
View Full Code Here

        ActiveMQConnection connection2 = (ActiveMQConnection) factory2.createConnection();
        assertNotNull(connection2);
       
        VmTransportChannel transportChannel = (VmTransportChannel) connection.getTransportChannel();
        BrokerClientImpl brokerClient = (BrokerClientImpl)transportChannel.getSendListener();
        Broker broker = brokerClient.getBrokerConnector().getBrokerContainer().getBroker();
       
        VmTransportChannel transportChannel2 = (VmTransportChannel) connection2.getTransportChannel();
        BrokerClientImpl brokerClient2 = (BrokerClientImpl)transportChannel2.getSendListener();
        Broker broker2 = brokerClient2.getBrokerConnector().getBrokerContainer().getBroker();
       
        assertTrue( broker == broker2 );
       
    }
View Full Code Here

    private String topicPrefix = "topic.";

    public Context getInitialContext(Hashtable environment) throws NamingException {
        // lets create a factory
        Map data = new ConcurrentHashMap();
        Broker broker = null;
       
        String[] names = getConnectionFactoryNames(environment);
        for (int i = 0; i < names.length; i++) {
           
            String name = names[i];
            ActiveMQConnectionFactory factory = createConnectionFactory(name, environment);
           
            if( broker==null ) {
                try {
                    broker = factory.getEmbeddedBroker();
                }
                catch (JMSException e) {
                    log.warn("Failed to get embedded broker", e);
                }
            }
            data.put(name,factory);
        }
               
        createQueues(data, environment);
        createTopics(data, environment);
        if (broker != null) {
            data.put("destinations", broker.getDestinationContext(environment));
        }
       
        return new ReadOnlyContext(environment, data);
    }
View Full Code Here

        if (client != null) {
            BrokerConnector connector = client.getBrokerConnector();
            if (connector != null) {
                BrokerContainer container = connector.getBrokerContainer();
                if (container != null) {
                    Broker broker = container.getBroker();
                    if (broker != null) {
                        SecurityAdapter securityAdapter = broker.getSecurityAdapter();
                        if (securityAdapter != null) {
                            return securityAdapter.authorizeReceive(client, message);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.activemq.broker.Broker

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.