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;
}
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"));
}
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());
}
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;
}
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"));
}
Aggregations