Examples of ack()


Examples of org.fusesource.mqtt.client.Message.ack()

        Topic[] topics = {new Topic(utf8("foo"), QoS.AT_LEAST_ONCE)};
        subConnection.subscribe(topics);
        for (int i = 0; i < 10; i++) {
            pubConnection.publish("foo", payload, QoS.AT_LEAST_ONCE, false);
            Message message = subConnection.receive();
            message.ack();
            assertArrayEquals(payload, message.getPayload());
        }
        subConnection.disconnect();
        pubConnection.disconnect();
    }
View Full Code Here

Examples of org.fusesource.mqtt.client.Message.ack()

    public byte[] receive(int timeout) throws Exception {
        byte[] result = null;
        Message message = connection.receive(timeout, TimeUnit.MILLISECONDS);
        if (message != null){
            result = message.getPayload();
            message.ack();
        }
        return result;
    }

    @Override
View Full Code Here

Examples of org.fusesource.mqtt.client.Message.ack()

            received++;
            payload = message.getPayload();
            String messageContent = new String(payload);
            LOG.info("Received message from topic: " + message.getTopic() +
                     " Message content: " + messageContent);
            message.ack();
        }
        connectionSub.disconnect();

        for(int j = 0; j < numberOfRuns; j++) {
View Full Code Here

Examples of org.fusesource.mqtt.client.Message.ack()

                received++;
                payload = message.getPayload();
                String messageContent = new String(payload);
                LOG.info("Received message from topic: " + message.getTopic() +
                         " Message content: " + messageContent);
                message.ack();
            }
            connectionSub.disconnect();
        }
        assertEquals("Should have received " + (messagesPerRun * (numberOfRuns + 1)) + " messages", (messagesPerRun * (numberOfRuns + 1)), received);
    }
View Full Code Here

Examples of org.fusesource.mqtt.client.Message.ack()

            received++;
            payload = message.getPayload();
            String messageContent = new String(payload);
            LOG.info("Received message from topic: " + message.getTopic() +
                    " Message content: " + messageContent);
            message.ack();
        }

        assertEquals("Should have received " + topics.length + " messages", topics.length, received);
    }
View Full Code Here

Examples of org.fusesource.mqtt.client.Message.ack()

    public byte[] receive(int timeout) throws Exception {
        byte[] result = null;
        Message message = connection.receive(timeout, TimeUnit.MILLISECONDS);
        if (message != null){
            result = message.getPayload();
            message.ack();
        }
        return result;
    }

    @Override
View Full Code Here

Examples of org.fusesource.mqtt.client.Message.ack()

        Thread thread = new Thread(new Runnable() {
            public void run() {
                for (int i = 0; i < numberOfMessages; i++) {
                    try {
                        Message message = subscribeConnection.receive();
                        message.ack();
                        latch.countDown();
                    } catch (Exception e) {
                        e.printStackTrace();
                        break;
                    }
View Full Code Here

Examples of org.hornetq.core.paging.cursor.PageSubscription.ack()

         assertNotNull(msg);
         assertEquals(i, msg.getMessage().getIntProperty("key").intValue());

         if (i < firstPageSize)
         {
            cursor.ack(msg);
         }
      }
      cursorProvider.printDebug();

      server.getStorageManager().waitOnOperations();
View Full Code Here

Examples of org.jboss.aerogear.simplepush.server.Notification.ack()

                try {
                    final String endpointToken = request.params().get("endpoint");
                    final String payload = buffer.toString();
                    logger.info("Notification endpointToken  [" + endpointToken + "] " + payload);
                    final Notification notification = simplePushServer.handleNotification(endpointToken, payload);
                    final NotificationMessage notificationMessage = new NotificationMessageImpl(notification.ack());
                    vertx.eventBus().send(writeHandlerMap.get(notification.uaid()), new Buffer(toJson(notificationMessage)));
                    request.response().setStatusCode(200);
                    request.response().end();
                } catch (final Exception e) {
                    logger.error(e);
View Full Code Here

Examples of org.jboss.narayana.blacktie.jatmibroker.core.transport.Message.ack()

            try {
              // Assumes the message was received from stomp -
              // fair
              // assumption outside of an MDB
              message.ack();
            } catch (IOException t) {
              log.error("Can't ack the message", t);
            }
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.