org.apache.qpid.example.transport
Class ExistingSocketConnectorDemo

java.lang.Object
  extended by org.apache.qpid.example.transport.ExistingSocketConnectorDemo
All Implemented Interfaces:
org.apache.qpid.jms.ConnectionListener

public class ExistingSocketConnectorDemo
extends Object
implements org.apache.qpid.jms.ConnectionListener

This is a simple application that demonstrates how you can use the Qpid AMQP interfaces to use existing sockets as the transport for the Client API. The Demo here runs twice: 1. Just to show a simple publish and receive. 2. To demonstrate how to use existing sockets and utilise the underlying client failover mechnaism.


Field Summary
(package private)  Connection _connection
           
(package private)  MessageProducer _producer
           
(package private)  Session _session
           
 String CONNECTION
          Here we can see the broker we are connecting to is set to be 'socket:///' signifying we will provide the socket.
(package private)  String Socket1_ID
           
(package private)  String Socket2_ID
           
 
Constructor Summary
ExistingSocketConnectorDemo()
           
 
Method Summary
 void bytesReceived(long count)
           
 void bytesSent(long count)
           
 void failoverComplete()
           
static void main(String[] args)
           
 boolean preFailover(boolean redirect)
           
 boolean preResubscribe()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_connection

Connection _connection

_producer

MessageProducer _producer

_session

Session _session

Socket1_ID

String Socket1_ID

Socket2_ID

String Socket2_ID

CONNECTION

public final String CONNECTION
Here we can see the broker we are connecting to is set to be 'socket:///' signifying we will provide the socket.

Constructor Detail

ExistingSocketConnectorDemo

public ExistingSocketConnectorDemo()
                            throws IOException,
                                   org.apache.qpid.url.URLSyntaxException,
                                   org.apache.qpid.AMQException,
                                   JMSException
Throws:
IOException
org.apache.qpid.url.URLSyntaxException
org.apache.qpid.AMQException
JMSException
Method Detail

main

public static void main(String[] args)
                 throws IOException,
                        org.apache.qpid.url.URLSyntaxException,
                        org.apache.qpid.AMQException,
                        JMSException
Throws:
IOException
org.apache.qpid.url.URLSyntaxException
org.apache.qpid.AMQException
JMSException

bytesSent

public void bytesSent(long count)
Specified by:
bytesSent in interface org.apache.qpid.jms.ConnectionListener

bytesReceived

public void bytesReceived(long count)
Specified by:
bytesReceived in interface org.apache.qpid.jms.ConnectionListener

preFailover

public boolean preFailover(boolean redirect)
Specified by:
preFailover in interface org.apache.qpid.jms.ConnectionListener

preResubscribe

public boolean preResubscribe()
Specified by:
preResubscribe in interface org.apache.qpid.jms.ConnectionListener

failoverComplete

public void failoverComplete()
Specified by:
failoverComplete in interface org.apache.qpid.jms.ConnectionListener


Licensed to the Apache Software Foundation