Package org.apache.activemq.command

Examples of org.apache.activemq.command.BrokerId


    /**
     * Returns the broker ID that the command came from
     */
    protected BrokerId getFromBrokerId(Command command) throws IOException {
        BrokerId answer = null;
        Endpoint from = command.getFrom();
        if (from == null) {
            log.warn("Incoming command does not have a from endpoint: " + command);
        }
        else {
View Full Code Here


        topicRegion.gc();
    }

    public BrokerId getBrokerId() {
        if (brokerId == null) {
            brokerId = new BrokerId(BROKER_ID_GENERATOR.generateId());
        }
        return brokerId;
    }
View Full Code Here

        brokerService.setBrokerId("broker-1");
        brokerService.setPersistent(false);
        brokerService.setUseJmx(false);
        brokerService.start();
        brokerService.waitUntilStarted();
        remoteBrokerInfo.setBrokerId(new BrokerId("remote-broker-id"));
        remoteBrokerInfo.setBrokerName("remote-broker-name");

        localBroker.setTransportListener(EasyMock.isA(TransportListener.class));
        ArgHolder localListenerRef = ArgHolder.holdArgsForLastVoidCall();

        remoteBroker.setTransportListener(EasyMock.isA(TransportListener.class));
        ArgHolder remoteListenerRef = ArgHolder.holdArgsForLastVoidCall();
        localBroker.start();
        remoteBroker.start();

        remoteBroker.oneway(EasyMock.isA(Object.class));
        EasyMock.expectLastCall().times(4);
        remoteBroker.oneway(EasyMock.isA(Object.class));
        ExpectationWaiter remoteInitWaiter = ExpectationWaiter.waiterForLastVoidCall();

        localBroker.oneway(remoteBrokerInfo);
        EasyMock.expect(localBroker.request(EasyMock.isA(Object.class)))
                .andReturn(null);
        localBroker.oneway(EasyMock.isA(Object.class));
        ExpectationWaiter localInitWaiter = ExpectationWaiter.waiterForLastVoidCall();

        control.replay();

        DurableConduitBridge bridge = new DurableConduitBridge(configuration, localBroker, remoteBroker);
        bridge.setBrokerService(brokerService);
        bridge.start();

        localListener = (TransportListener) localListenerRef.getArguments()[0];
        Assert.assertNotNull(localListener);
        remoteListener = (TransportListener) remoteListenerRef.getArguments()[0];
        Assert.assertNotNull(remoteListener);

        remoteListener.onCommand(remoteBrokerInfo);

        remoteInitWaiter.assertHappens(5, TimeUnit.SECONDS);
        localInitWaiter.assertHappens(5, TimeUnit.SECONDS);

        control.verify();
        control.reset();

        ActiveMQMessage msg = new ActiveMQMessage();
        msg.setDestination(new ActiveMQTopic("test"));
        msgDispatch = new MessageDispatch();
        msgDispatch.setMessage(msg);

        ConsumerInfo path1 = new ConsumerInfo();
        path1.setDestination(msg.getDestination());
        path1.setConsumerId(new ConsumerId(new SessionId(new ConnectionId("conn-id-1"), 1), 3));
        path1.setBrokerPath(new BrokerId[]{
                new BrokerId("remote-broker-id"),
                new BrokerId("server(1)-broker-id"),
        });
        path1Msg = new ActiveMQMessage();
        path1Msg.setDestination(AdvisorySupport.getConsumerAdvisoryTopic(path1.getDestination()));
        path1Msg.setDataStructure(path1);

        ConsumerInfo path2 = new ConsumerInfo();
        path2.setDestination(path1.getDestination());
        path2.setConsumerId(new ConsumerId(new SessionId(new ConnectionId("conn-id-2"), 2), 4));
        path2.setBrokerPath(new BrokerId[]{
                new BrokerId("remote-broker-id"),
                new BrokerId("server(2)-broker-id"),
                new BrokerId("server(1)-broker-id"),
        });
        path2Msg = new ActiveMQMessage();
        path2Msg.setDestination(path1Msg.getDestination());
        path2Msg.setDataStructure(path2);
View Full Code Here

        wf.setVersion(OpenWireFormat.DEFAULT_WIRE_VERSION);
        return wf;
    }

    protected BrokerId createBrokerId(String text) {
        return new BrokerId(text);
    }
View Full Code Here

        // exception each time
        return SINGLETON_EXCEPTION;
    }

    protected BooleanExpression createBooleanExpression(String string) {
        return new NetworkBridgeFilter(null, new BrokerId(string), 10, 10);
    }
View Full Code Here

    protected BrokerId[] appendToBrokerPath(BrokerId[] brokerPath, BrokerId[] pathsToAppend) {
        if (brokerPath == null || brokerPath.length == 0) {
            return pathsToAppend;
        }
        BrokerId rc[] = new BrokerId[brokerPath.length + pathsToAppend.length];
        System.arraycopy(brokerPath, 0, rc, 0, brokerPath.length);
        System.arraycopy(pathsToAppend, 0, rc, brokerPath.length, pathsToAppend.length);
        return rc;
    }
View Full Code Here

    protected BrokerId[] appendToBrokerPath(BrokerId[] brokerPath, BrokerId idToAppend) {
        if (brokerPath == null || brokerPath.length == 0) {
            return new BrokerId[] {idToAppend};
        }
        BrokerId rc[] = new BrokerId[brokerPath.length + 1];
        System.arraycopy(brokerPath, 0, rc, 0, brokerPath.length);
        rc[brokerPath.length] = idToAppend;
        return rc;
    }
View Full Code Here

        ProducerInfo info = (ProducerInfo)object;
        info.setProducerId(createProducerId("ProducerId:1"));
        info.setDestination(createActiveMQDestination("Destination:2"));

        {
            BrokerId value[] = new BrokerId[2];
            for (int i = 0; i < 2; i++) {
                value[i] = createBrokerId("BrokerPath:3");
            }
            info.setBrokerPath(value);
        }
View Full Code Here

        info.setClientId("ClientId:2");
        info.setPassword("Password:3");
        info.setUserName("UserName:4");

        {
            BrokerId value[] = new BrokerId[2];
            for (int i = 0; i < 2; i++) {
                value[i] = createBrokerId("BrokerPath:5");
            }
            info.setBrokerPath(value);
        }
View Full Code Here

        info.setDataStructure(createDataStructure("DataStructure:13"));
        info.setTargetConsumerId(createConsumerId("TargetConsumerId:14"));
        info.setCompressed(false);
        info.setRedeliveryCounter(2);
        {
            BrokerId value[] = new BrokerId[2];
            for (int i = 0; i < 2; i++) {
                value[i] = createBrokerId("BrokerPath:15");
            }
            info.setBrokerPath(value);
        }
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.BrokerId

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.