use of org.apache.activemq.artemis.core.postoffice.Binding in project activemq-artemis by apache.
the class AddressControlImpl method getBindingNames.
@Override
public String[] getBindingNames() throws Exception {
clearIO();
try {
Bindings bindings = postOffice.getBindingsForAddress(addressInfo.getName());
String[] bindingNames = new String[bindings.getBindings().size()];
int i = 0;
for (Binding binding : bindings.getBindings()) {
bindingNames[i++] = binding.getUniqueName().toString();
}
return bindingNames;
} catch (Throwable t) {
throw new IllegalStateException(t.getMessage());
} finally {
blockOnIO();
}
}
use of org.apache.activemq.artemis.core.postoffice.Binding in project activemq-artemis by apache.
the class AddressControlImpl method getNumberOfMessages.
@Override
public long getNumberOfMessages() throws Exception {
clearIO();
long totalMsgs = 0;
try {
Bindings bindings = postOffice.getBindingsForAddress(addressInfo.getName());
for (Binding binding : bindings.getBindings()) {
if (binding instanceof QueueBinding) {
totalMsgs += ((QueueBinding) binding).getQueue().getMessageCount();
}
}
return totalMsgs;
} catch (Throwable t) {
throw new IllegalStateException(t.getMessage());
} finally {
blockOnIO();
}
}
use of org.apache.activemq.artemis.core.postoffice.Binding in project activemq-artemis by apache.
the class QueueControlImpl method moveMessage.
@Override
public boolean moveMessage(final long messageID, final String otherQueueName, final boolean rejectDuplicates) throws Exception {
checkStarted();
clearIO();
try {
Binding binding = postOffice.getBinding(new SimpleString(otherQueueName));
if (binding == null) {
throw ActiveMQMessageBundle.BUNDLE.noQueueFound(otherQueueName);
}
return queue.moveReference(messageID, binding.getAddress(), binding, rejectDuplicates);
} finally {
blockOnIO();
}
}
use of org.apache.activemq.artemis.core.postoffice.Binding in project activemq-artemis by apache.
the class SessionCreateAndDeleteQueueTest method testDurableTrue.
@Test
public void testDurableTrue() throws Exception {
ClientSession session = createSessionFactory(locator).createSession(false, true, true);
session.createQueue(address, queueName, true);
Binding binding = server.getPostOffice().getBinding(queueName);
Queue q = (Queue) binding.getBindable();
Assert.assertTrue(q.isDurable());
session.close();
}
use of org.apache.activemq.artemis.core.postoffice.Binding in project activemq-artemis by apache.
the class SessionCreateAndDeleteQueueTest method testTemporaryFalse.
@Test
public void testTemporaryFalse() throws Exception {
ClientSession session = createSessionFactory(locator).createSession(false, true, true);
session.createQueue(address, queueName, false);
Binding binding = server.getPostOffice().getBinding(queueName);
Queue q = (Queue) binding.getBindable();
Assert.assertFalse(q.isTemporary());
session.close();
}
Aggregations