org.apache.qpid.management.domain.services
Class QpidService

java.lang.Object
  extended by org.apache.qpid.management.domain.services.QpidService
All Implemented Interfaces:
org.apache.qpid.transport.SessionListener

public class QpidService
extends Object
implements org.apache.qpid.transport.SessionListener

Qpid Broker facade.


Constructor Summary
QpidService(UUID brokerId)
          Builds a new service with the given connection data.
 
Method Summary
 void close()
          Closes communication with broker.
 void closed(org.apache.qpid.transport.Session ssn)
           
 void connect()
          Estabilishes a connection with the broker.
 void createSubscription(String queueName, String destinationName, org.apache.qpid.nclient.util.MessageListener listener)
          Associate a message listener with a destination therefore creating a new subscription.
 void declareBinding(String queueName, String exchangeName, String routingKey)
          Binds (on the broker) a queue with an exchange.
 void declareQueue(String queueName)
          Declares a queue on the broker with the given name.
 void declareUnbinding(String queueName, String exchangeName, String routingKey)
          Removes a previously declare binding between an exchange and a queue.
 void deleteQueue(String queueName)
          Removes the queue with the given name from the broker.
 void exception(org.apache.qpid.transport.Session ssn, org.apache.qpid.transport.SessionException exc)
           
 void invoke(String packageName, String className, Binary schemaHash, Binary objectId, Object[] parameters, QpidMethod method, int sequenceNumber, long bankId, long brokerId)
          Invokes an operation on a broker object instance.
 void message(org.apache.qpid.transport.Session ssn, org.apache.qpid.transport.MessageTransfer xfr)
           
 void opened(org.apache.qpid.transport.Session ssn)
           
 void removeSubscription(String destinationName)
          Removes a previously declared consumer from the broker.
 void requestSchema(String packageName, String className, Binary schemaHash)
          Requests a schema for the given package.class.hash.
 void resumed(org.apache.qpid.transport.Session ssn)
           
 void sendMessage(org.apache.qpid.api.Message message)
          Sends a command message.
 void sync()
          All the previously entered outstanding commands are asynchronous.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QpidService

public QpidService(UUID brokerId)
Builds a new service with the given connection data.

Parameters:
connectionData - the connection data of the broker.
Method Detail

connect

public void connect()
             throws Exception
Estabilishes a connection with the broker.

Throws:
QpidException - in case of connection failure.
Exception

opened

public void opened(org.apache.qpid.transport.Session ssn)
Specified by:
opened in interface org.apache.qpid.transport.SessionListener

resumed

public void resumed(org.apache.qpid.transport.Session ssn)
Specified by:
resumed in interface org.apache.qpid.transport.SessionListener

message

public void message(org.apache.qpid.transport.Session ssn,
                    org.apache.qpid.transport.MessageTransfer xfr)
Specified by:
message in interface org.apache.qpid.transport.SessionListener

exception

public void exception(org.apache.qpid.transport.Session ssn,
                      org.apache.qpid.transport.SessionException exc)
Specified by:
exception in interface org.apache.qpid.transport.SessionListener

closed

public void closed(org.apache.qpid.transport.Session ssn)
Specified by:
closed in interface org.apache.qpid.transport.SessionListener

sync

public void sync()
All the previously entered outstanding commands are asynchronous. Synchronous behavior is achieved through invoking this method.


close

public void close()
Closes communication with broker.


createSubscription

public void createSubscription(String queueName,
                               String destinationName,
                               org.apache.qpid.nclient.util.MessageListener listener)
Associate a message listener with a destination therefore creating a new subscription.

Parameters:
queueName - The name of the queue that the subscriber is receiving messages from.
destinationName - the name of the destination, or delivery tag, for the subscriber.
listener - the listener for this destination.
See Also:
Session#messageSubscribe(String, String, short, short, org.apache.qpid.nclient.MessagePartListener, java.util.Map, org.apache.qpid.transport.Option...)

removeSubscription

public void removeSubscription(String destinationName)
Removes a previously declared consumer from the broker.

Parameters:
destinationName - the name of the destination, or delivery tag, for the subscriber.
See Also:
SessionInvoker.messageCancel(String, Option...)

declareQueue

public void declareQueue(String queueName)
Declares a queue on the broker with the given name.

Parameters:
queueName - the name of the declared queue.
See Also:
SessionInvoker.queueDeclare(String, String, java.util.Map, Option...)

deleteQueue

public void deleteQueue(String queueName)
Removes the queue with the given name from the broker.

Parameters:
queueName - the name of the queue.
See Also:
SessionInvoker.queueDelete(String, Option...)

declareBinding

public void declareBinding(String queueName,
                           String exchangeName,
                           String routingKey)
Binds (on the broker) a queue with an exchange.

Parameters:
queueName - the name of the queue to bind.
exchangeName - the exchange name.
routingKey - the routing key used for the binding.
See Also:
SessionInvoker.exchangeBind(String, String, String, java.util.Map, Option...)

declareUnbinding

public void declareUnbinding(String queueName,
                             String exchangeName,
                             String routingKey)
Removes a previously declare binding between an exchange and a queue.

Parameters:
queueName - the name of the queue.
exchangeName - the name of the exchange.
routingKey - the routing key used for binding.

requestSchema

public void requestSchema(String packageName,
                          String className,
                          Binary schemaHash)
                   throws IOException
Requests a schema for the given package.class.hash.

Parameters:
packageName - the package name.
className - the class name.
schemaHash - the schema hash.
Throws:
IOException - when the schema request cannot be sent.

invoke

public void invoke(String packageName,
                   String className,
                   Binary schemaHash,
                   Binary objectId,
                   Object[] parameters,
                   QpidMethod method,
                   int sequenceNumber,
                   long bankId,
                   long brokerId)
            throws MethodInvocationException,
                   UnableToComplyException
Invokes an operation on a broker object instance.

Parameters:
packageName - the package name.
className - the class name.
schemaHash - the schema hash of the corresponding class.
objectId - the object instance identifier.
parameters - the parameters for this invocation.
method - the method (definition) invoked.
bankId - the object bank identifier.
brokerId - the broker identifier.
Throws:
MethodInvocationException - when the invoked method returns an error code.
UnableToComplyException - when it wasn't possibile to invoke the requested operation.

sendMessage

public void sendMessage(org.apache.qpid.api.Message message)
                 throws IOException
Sends a command message.

Parameters:
message - the command message.
Throws:
IOException - when the message cannot be sent.


Licensed to the Apache Software Foundation