Package com.netflix.astyanax.recipes.queue

Examples of com.netflix.astyanax.recipes.queue.MessageProducer.sendMessage()


        final Message message = new Message()
                .setUniqueKey(key)
                .setTimeout(1, TimeUnit.SECONDS)
                .setTrigger(new RepeatingTrigger.Builder().withInterval(1, TimeUnit.SECONDS).build());

        producer.sendMessage(message);

        // Make sure it's unique by trying to submit again
        try {
            producer.sendMessage(message);
            Assert.fail();
View Full Code Here


        producer.sendMessage(message);

        // Make sure it's unique by trying to submit again
        try {
            producer.sendMessage(message);
            Assert.fail();
        } catch (KeyExistsException e) {
            LOG.info("Key already exists");
        }
View Full Code Here

        {
            final Message m = new Message();

            // Add a message
            LOG.info(m.toString());
            String messageId = producer.sendMessage(m);
            LOG.info("MessageId: " + messageId);
        }
    }

    @Test
View Full Code Here

        {
            final Message m = new Message().setKey(key);

            // Add a message
            LOG.info(m.toString());
            String messageId = producer.sendMessage(m);
            LOG.info("MessageId: " + messageId);

            Assert.assertEquals(1, scheduler.getMessageCount());

            // Read it by the messageId
View Full Code Here

        {
            // Send another message
            final Message m = new Message().setUniqueKey(key);
            LOG.info("m2: " + m);
            final String messageId2 = producer.sendMessage(m);
            LOG.info("MessageId2: " + messageId2);

            try {
                final Message m2 = new Message().setUniqueKey(key);
                producer.sendMessage(m2);
View Full Code Here

            final String messageId2 = producer.sendMessage(m);
            LOG.info("MessageId2: " + messageId2);

            try {
                final Message m2 = new Message().setUniqueKey(key);
                producer.sendMessage(m2);
                Assert.fail("Message should already exists");
            } catch (MessageQueueException e) {
                LOG.info("Failed to insert duplicate key", e);
            }
View Full Code Here

                    .setKey("Key12345")
                    .setTrigger(new RepeatingTrigger.Builder()
                    .withInterval(3, TimeUnit.SECONDS)
                    .withRepeatCount(10)
                    .build());
            final String messageId3 = producer.sendMessage(m);
            Assert.assertNotNull(messageId3);
            final Message m3rm = scheduler.peekMessage(messageId3);
            Assert.assertNotNull(m3rm);
            LOG.info(m3rm.toString());
            Assert.assertEquals(1, scheduler.getMessageCount());
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.