Package org.apache.activemq.command

Examples of org.apache.activemq.command.Response


    public void testRequestResponse() throws Exception {
        ConsumerInfo expected = new ConsumerInfo();
        expected.setSelector("Edam");
        expected.setResponseRequired(true);
        log.info("About to send: " + expected);
        Response response = (Response) producer.request(expected, 2000);

        log.info("Received: " + response);
        assertNotNull("Received a response", response);
        assertTrue("Should not be an exception", !response.isException());
    }
View Full Code Here


    public Object request(Object o) throws IOException {
      final Command command = (Command) o;
        FutureResponse response = asyncRequest(command, null);
        while (true) {
            Response result = response.getResult(requestTimeout);
            if (result != null) {
                return result;
            }
            onMissingResponse(command, response);
        }
View Full Code Here

        while (timeout > 0) {
            int time = timeout;
            if (timeout > requestTimeout) {
                time = requestTimeout;
            }
            Response result = response.getResult(time);
            if (result != null) {
                return result;
            }
            onMissingResponse(command, response);
            timeout -= time;
View Full Code Here

     */
    public void setConnectionId(String connectionId) throws IOException {
    }

    public Response processAddConnection(ConnectionInfo info) throws Exception {
        Response answer = super.processAddConnection(info);
        String clientId = info.getClientId();
        if (clientId != null) {
            if(byClientIdName==null) {
              byClientIdName = createByClientIdObjectName(clientId);
              registerMBean(byClientIdName);
View Full Code Here

            Message message = (Message) command;
            message.setProducerId(message.getMessageId().getProducerId());
        }
        command.setResponseRequired(false);
        if (connection != null) {
            Response response = connection.service(command);
            if (response != null && response.isException()) {
                ExceptionResponse er = (ExceptionResponse) response;
                throw JMSExceptionSupport.create(er.getException());
            }
        }
        else if (transport != null) {
View Full Code Here

            Message message = (Message) command;
            message.setProducerId(message.getMessageId().getProducerId());
        }
        command.setResponseRequired(true);
        if (connection != null) {
            Response response = connection.service(command);
            if (response != null && response.isException()) {
                ExceptionResponse er = (ExceptionResponse) response;
                throw JMSExceptionSupport.create(er.getException());
            }
            return response;
        }
        else if (transport != null) {
            Response response = (Response) transport.request(command);
            if (response != null && response.isException()) {
                ExceptionResponse er = (ExceptionResponse) response;
                throw JMSExceptionSupport.create(er.getException());
            }
            return response;
        }
View Full Code Here

     */
  public void onActiveMQCommad( Command command ) throws IOException, JMSException {

      if ( command.isResponse() ) {

      Response response = (Response) command;
        ResponseHandler rh = (ResponseHandler) resposeHandlers.remove(new Integer(response.getCorrelationId()));
        if( rh !=null ) {
          rh.onResponse(this, response);
        }

    } else if( command.isMessageDispatch() ) {
View Full Code Here

     * @throws IOException
     */
    public void onActiveMQCommand(Command command) throws IOException, JMSException {
        if (command.isResponse()) {

            Response response = (Response)command;
            ResponseHandler rh = resposeHandlers.remove(Integer.valueOf(response.getCorrelationId()));
            if (rh != null) {
                rh.onResponse(this, response);
            } else {
                // Pass down any unexpected errors. Should this close the connection?
                if (response.isException()) {
                    Throwable exception = ((ExceptionResponse)response).getException();
                    handleException(exception, null);
                }
            }
        } else if (command.isMessageDispatch()) {
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) {
            LOG.error("Slave Failed", e);
View Full Code Here

    }
   
    protected StubConnection createConnection() throws Exception {
        return new StubConnection(broker) {
            public Response request(Command command) throws Exception {
                Response r = super.request((Command) wireFormat.unmarshal(wireFormat.marshal(command)));
                if( r != null ) {
                    r = (Response) wireFormat.unmarshal(wireFormat.marshal(r));
                }
                return r;
            }
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.