コード例 #1
0
  private void handleRegularMessage(ClientMessageInternal message) {
    if (message.getAddress() == null) {
      message.setAddressTransient(queueInfo.getAddress());
    }

    message.onReceipt(this);

    if (!ackIndividually
        && message.getPriority() != 4
        && !message.containsProperty(ClientConsumerImpl.FORCED_DELIVERY_MESSAGE)) {
      // We have messages of different priorities so we need to ack them individually since the
      // order
      // of them in the ServerConsumerImpl delivery list might not be the same as the order they are
      // consumed in, which means that acking all up to won't work
      ackIndividually = true;
    }

    // Add it to the buffer
    buffer.addTail(message, message.getPriority());

    if (handler != null) {
      // Execute using executor
      if (!stopped) {
        queueExecutor();
      }
    } else {
      notify();
    }
  }
コード例 #2
0
  @Test
  public void testBindingAttributes() throws Exception {
    ClientSession session = basicSetUp();

    session.createQueue("addressName1", "queueName1", true);
    session.createQueue("addressName1", "queueName2", "bob", true);

    session.close();
    locator.close();
    server.stop();

    ByteArrayOutputStream xmlOutputStream = new ByteArrayOutputStream();
    XmlDataExporter xmlDataExporter = new XmlDataExporter();
    xmlDataExporter.process(
        xmlOutputStream,
        server.getConfiguration().getBindingsDirectory(),
        server.getConfiguration().getJournalDirectory(),
        server.getConfiguration().getPagingDirectory(),
        server.getConfiguration().getLargeMessagesDirectory());
    System.out.print(new String(xmlOutputStream.toByteArray()));

    clearDataRecreateServerDirs();
    server.start();
    locator = createInVMNonHALocator();
    factory = createSessionFactory(locator);
    session = factory.createSession(false, true, true);

    ByteArrayInputStream xmlInputStream = new ByteArrayInputStream(xmlOutputStream.toByteArray());
    XmlDataImporter xmlDataImporter = new XmlDataImporter();
    xmlDataImporter.process(xmlInputStream, session);

    ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString("queueName1"));

    assertEquals("addressName1", queueQuery.getAddress().toString());
    assertNull(queueQuery.getFilterString());

    queueQuery = session.queueQuery(new SimpleString("queueName2"));

    assertEquals("addressName1", queueQuery.getAddress().toString());
    assertEquals("bob", queueQuery.getFilterString().toString());
    assertEquals(true, queueQuery.isDurable());
  }