Example #1
0
  protected List<QueueBinding> getLocalQueueBindings(
      final PostOffice postOffice, final String address) throws Exception {
    ArrayList<QueueBinding> bindingsFound = new ArrayList<QueueBinding>();

    Bindings bindings = postOffice.getBindingsForAddress(new SimpleString(address));

    for (Binding binding : bindings.getBindings()) {
      if (binding instanceof LocalQueueBinding) {
        bindingsFound.add((QueueBinding) binding);
      }
    }
    return bindingsFound;
  }
Example #2
0
 public String[] getBindingNames() throws Exception {
   clearIO();
   try {
     Bindings bindings = postOffice.getBindingsForAddress(address);
     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();
   }
 }
Example #3
0
 public String[] getQueueNames() throws Exception {
   clearIO();
   try {
     Bindings bindings = postOffice.getBindingsForAddress(address);
     List<String> queueNames = new ArrayList<String>();
     for (Binding binding : bindings.getBindings()) {
       if (binding instanceof QueueBinding) {
         queueNames.add(binding.getUniqueName().toString());
       }
     }
     return queueNames.toArray(new String[queueNames.size()]);
   } catch (Throwable t) {
     throw new IllegalStateException(t.getMessage());
   } finally {
     blockOnIO();
   }
 }
Example #4
0
 public long getNumberOfMessages() throws Exception {
   clearIO();
   long totalMsgs = 0;
   try {
     Bindings bindings = postOffice.getBindingsForAddress(address);
     List<String> queueNames = new ArrayList<String>();
     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();
   }
 }