Package org.apache.activemq.transport

Examples of org.apache.activemq.transport.TransportListener


   
    public void onAccept(Transport transport) {
        try {
            log.info("["+getName()+"] Server Accepted a Connection");
            serverTransport = transport;
            serverTransport.setTransportListener(new TransportListener() {
                public void onCommand(Object command) {
                    serverReceiveCount.incrementAndGet();
                    if( serverRunOnCommand !=null ) {
                        serverRunOnCommand.run();
                    }
View Full Code Here


       
        //
        // Manually create a client transport so that it does not send KeepAlive packets.
        // this should simulate a client hang.
        clientTransport = new TcpTransport(new OpenWireFormat(), SocketFactory.getDefault(), new URI("tcp://localhost:61616"), null);
        clientTransport.setTransportListener(new TransportListener() {
            public void onCommand(Object command) {
                clientReceiveCount.incrementAndGet();
                if( clientRunOnCommand !=null ) {
                    clientRunOnCommand.run();
                }
View Full Code Here

    }

    protected void doStart() throws Exception {
        log.info("Starting " + this);

        configuredTransport.setTransportListener(new TransportListener() {
            public void onCommand(Object o) {
              final Command command = (Command) o;
                processInboundConnection(command);
            }
View Full Code Here

            throw new TransportDisposedIOException("Peer ("+peer.toString()+") disposed.");
        }
    }
   
    protected void syncOneWay(Object command){
        final TransportListener tl=peer.transportListener;
        prePeerSetQueue=peer.prePeerSetQueue;
        if(tl==null){
            prePeerSetQueue.add(command);
        }else{
            tl.onCommand(command);
        }
    }
View Full Code Here

    /**
     * @see org.apache.activemq.thread.Task#iterate()
     */
    public boolean iterate(){
        final TransportListener tl=peer.transportListener;
        if(!messageQueue.isEmpty()&&!peer.disposed&&tl!=null){
            final Command command=(Command) messageQueue.poll();
            tl.onCommand(command);
        }
        return !messageQueue.isEmpty()&&!peer.disposed&&!(peer.transportListener==null);
    }
View Full Code Here

   
            public void onException(IOException error){
                serviceLocalException(error);
            }
        });
        remoteBroker.setTransportListener(new TransportListener(){
            public void onCommand(Object o){
              Command command = (Command) o;
                serviceRemoteCommand(command);
            }
   
View Full Code Here

    public Worker() throws URISyntaxException, JMSException {
      URI uri = new URI("failover://(mock://("+tcpUri+"))");
      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(uri);
      connection = (ActiveMQConnection)factory.createConnection();
      connection.setExceptionListener(this);
      connection.addTransportListener(new TransportListener() {
        public void onCommand(Object command) {
        }
        public void onException(IOException error) {
          setError(error);
        }
View Full Code Here

        return TransportFactory.connect(new URI("failover://(tcp://doesNotExist:1234)?useExponentialBackOff=false&maxReconnectAttempts=3&initialReconnectDelay=100"));
    }

    protected void setUp() throws Exception {
        transport = createTransport();
        transport.setTransportListener(new TransportListener() {

            public void onCommand(Object command) {
            }

            public void onException(IOException error) {
View Full Code Here

            consumer.setTransportListener(this);
            consumer.start();
        }

        producer = createProducer();
        producer.setTransportListener(new TransportListener() {
            public void onCommand(Object command) {
                log.info("Producer received: " + command);
            }

            public void onException(IOException error) {
View Full Code Here

    private Exception connectionFailure;

    private final TransportListener myTransportListener = createTransportListener();
   
    TransportListener createTransportListener() {
      return new TransportListener() {
          public void onCommand(Object o) {
              Command command = (Command) o;
              if (command == null) {
                  return;
              }
View Full Code Here

TOP

Related Classes of org.apache.activemq.transport.TransportListener

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.