Package org.apache.activemq.command

Examples of org.apache.activemq.command.Response


        if (isClosed()) {
            throw new ConnectionClosedException();
        } else {

            try {
                Response response = (Response) this.transport.request(command);
                if (response.isException()) {
                    ExceptionResponse er = (ExceptionResponse) response;
                    if (er.getException() instanceof JMSException)
                        throw (JMSException) er.getException();
                    else
                        throw JMSExceptionSupport.create(er.getException());
View Full Code Here


        if (isClosed()) {
            throw new ConnectionClosedException();
        } else {

            try {
                Response response = (Response) this.transport.request(command,timeout);
                if (response!=null && response.isException()) {
                    ExceptionResponse er = (ExceptionResponse) response;
                    if (er.getException() instanceof JMSException)
                        throw (JMSException) er.getException();
                    else
                        throw JMSExceptionSupport.create(er.getException());
View Full Code Here

                        threadPool.execute(new Runnable() {
                      public void run() {
                              try {             
//                                System.out.println("Async thread start..");
                                sendMessage(context, message);
                              Response response = new Response();
                              response.setCorrelationId(message.getCommandId());
                      context.getConnection().dispatchAsync(response);             
                    } catch (Exception e) {
                              ExceptionResponse response = new ExceptionResponse(e);
                              response.setCorrelationId(message.getCommandId());
                      context.getConnection().dispatchAsync(response);
                    } finally {
//                                System.out.println("Async thread end..");
                    }
                      }
View Full Code Here

                    // The message was not sent using async send, so we should only ack the local
                    // broker when we get confirmation that the remote broker has received the message.
                    ResponseCallback callback = new ResponseCallback() {
                        public void onCompletion(FutureResponse future) {
                            try {
                                Response response = future.getResult();
                                if(response.isException()){
                                    ExceptionResponse er=(ExceptionResponse) response;
                                    serviceLocalException(er.getException());
                                } else {
                                    localBroker.oneway(new MessageAck(md,MessageAck.STANDARD_ACK_TYPE,1));
                                }
View Full Code Here

   
    public void onCommand(Object o) {
      Command command = (Command) o;
        boolean debug = log.isDebugEnabled();
        if( command.isResponse() ) {
            Response response = (Response) command;
            FutureResponse future = (FutureResponse) requestMap.remove(new Integer(response.getCorrelationId()));
            if( future!=null ) {
                future.set(response);
            } else {
                if( debug ) log.debug("Received unexpected response for command id: "+response.getCorrelationId());
            }
        } else {
            getTransportListener().onCommand(command);
        }
    }
View Full Code Here

            else {
                boolean responseRequired = command.isResponseRequired();
                int commandId = command.getCommandId();
                localBroker.oneway(command);
                if (responseRequired) {
                    Response response = new Response();
                    response.setCorrelationId(commandId);
                    remoteBroker.oneway(response);
                }
            }
        }
        catch (IOException e) {
View Full Code Here

    }

    protected void sendSyncToSlave(Command command){
        try{

            Response response=(Response) slave.request(command);
            if (response.isException()){
                ExceptionResponse er=(ExceptionResponse)response;
                log.error("Slave Failed",er.getException());
            }

        }catch(Throwable e){
View Full Code Here

        connector.setBrokerName(broker.getBrokerName());
        this.transport = transport;
        this.transport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object o) {
              Command command = (Command) o;
                Response response = service(command);
                if (response != null) {
                    dispatchSync(response);
                }
            }
View Full Code Here

        }
    }

    public Response service(Command command) {
       
        Response response=null;
        boolean responseRequired = command.isResponseRequired();
        int commandId = command.getCommandId();
        try {
            response = command.visit(this);
        } catch ( Throwable e ) {
            if( responseRequired ) {
                if( serviceLog.isDebugEnabled() && e.getClass()!=BrokerStoppedException.class )
                    serviceLog.debug("Error occured while processing sync command: "+e,e);
                response = new ExceptionResponse(e);
            } else {
                serviceException(e);
            }
        }       
        if( responseRequired ) {
            if( context!=null && context.isDontSendReponse() ) {
                // No need to send back a response at this time.
            } else {
                if( response == null ) {
                    response = new Response();
                }
                response.setCorrelationId(commandId);
            }
            if( context!=null ) {
                context.setDontSendReponse(false);
                context=null;
            }
View Full Code Here

        if (isClosed()) {
            throw new ConnectionClosedException();
        } else {

            try {
                Response response = (Response)this.transport.request(command);
                if (response.isException()) {
                    ExceptionResponse er = (ExceptionResponse)response;
                    if (er.getException() instanceof JMSException) {
                        throw (JMSException)er.getException();
                    } else {
                        if (isClosed()||closing.get()) {
View Full Code Here

TOP

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

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.