Search in sources :

Example 11 with ExceptionResponse

use of org.apache.activemq.command.ExceptionResponse in project activemq-artemis by apache.

the class ExceptionResponseTest method createObject.

@Override
public Object createObject() throws Exception {
    ExceptionResponse info = new ExceptionResponse();
    populateObject(info);
    return info;
}
Also used : ExceptionResponse(org.apache.activemq.command.ExceptionResponse)

Example 12 with ExceptionResponse

use of org.apache.activemq.command.ExceptionResponse in project activemq-artemis by apache.

the class ExceptionResponseTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ExceptionResponse info = (ExceptionResponse) object;
    info.setException(createThrowable("Exception:1"));
}
Also used : ExceptionResponse(org.apache.activemq.command.ExceptionResponse)

Example 13 with ExceptionResponse

use of org.apache.activemq.command.ExceptionResponse in project activemq-artemis by apache.

the class ZeroPrefetchConsumerTest method testBrokerZeroPrefetchConfigWithConsumerControl.

// https://issues.apache.org/jira/browse/AMQ-4234
// https://issues.apache.org/jira/browse/AMQ-4235
public void testBrokerZeroPrefetchConfigWithConsumerControl() throws Exception {
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(brokerZeroQueue);
    assertEquals("broker config prefetch in effect", 0, consumer.info.getCurrentPrefetchSize());
    // verify sub view broker
    // I comment out this because it checks broker internal
    // which doesn't apply to artemis broker.
    // Subscription sub = broker.getRegionBroker().getDestinationMap().get(ActiveMQDestination.transform(brokerZeroQueue)).getConsumers().get(0);
    // assertEquals("broker sub prefetch is correct", 0, sub.getConsumerInfo().getCurrentPrefetchSize());
    // manipulate Prefetch (like failover and stomp)
    ConsumerControl consumerControl = new ConsumerControl();
    consumerControl.setConsumerId(consumer.info.getConsumerId());
    consumerControl.setDestination(ActiveMQDestination.transform(brokerZeroQueue));
    // default for a q
    consumerControl.setPrefetch(1000);
    Object reply = ((ActiveMQConnection) connection).getTransport().request(consumerControl);
    assertTrue("good request", !(reply instanceof ExceptionResponse));
    assertEquals("broker config prefetch in effect", 0, consumer.info.getCurrentPrefetchSize());
}
Also used : ExceptionResponse(org.apache.activemq.command.ExceptionResponse) ConsumerControl(org.apache.activemq.command.ConsumerControl) Session(javax.jms.Session)

Example 14 with ExceptionResponse

use of org.apache.activemq.command.ExceptionResponse in project activemq-artemis by apache.

the class StubConnection method request.

public Response request(Command command) throws Exception {
    if (command instanceof Message) {
        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;
    }
    return null;
}
Also used : Response(org.apache.activemq.command.Response) ExceptionResponse(org.apache.activemq.command.ExceptionResponse) ExceptionResponse(org.apache.activemq.command.ExceptionResponse) Message(org.apache.activemq.command.Message)

Example 15 with ExceptionResponse

use of org.apache.activemq.command.ExceptionResponse in project activemq-artemis by apache.

the class ExceptionResponseTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ExceptionResponse info = (ExceptionResponse) object;
    info.setException(createThrowable("Exception:1"));
}
Also used : ExceptionResponse(org.apache.activemq.command.ExceptionResponse)

Aggregations

ExceptionResponse (org.apache.activemq.command.ExceptionResponse)22 Response (org.apache.activemq.command.Response)3 Message (org.apache.activemq.command.Message)2 IOException (java.io.IOException)1 IllegalStateException (javax.jms.IllegalStateException)1 InvalidClientIDException (javax.jms.InvalidClientIDException)1 InvalidDestinationException (javax.jms.InvalidDestinationException)1 JMSSecurityException (javax.jms.JMSSecurityException)1 Session (javax.jms.Session)1 XAException (javax.transaction.xa.XAException)1 ActiveMQAddressExistsException (org.apache.activemq.artemis.api.core.ActiveMQAddressExistsException)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ActiveMQNonExistentQueueException (org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException)1 ActiveMQQueueExistsException (org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException)1 ActiveMQRemoteDisconnectException (org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException)1 ActiveMQSecurityException (org.apache.activemq.artemis.api.core.ActiveMQSecurityException)1 Command (org.apache.activemq.command.Command)1 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)1 ConsumerControl (org.apache.activemq.command.ConsumerControl)1 ControlCommand (org.apache.activemq.command.ControlCommand)1