Examples of MessageProducer

or logs event or heartbeat in one shot, for example:

@author Frankie Wu
  • com.netflix.astyanax.recipes.queue.MessageProducer
  • com.saasovation.common.port.adapter.messaging.rabbitmq.MessageProducer
    I am a message producer, which facilitates sending messages to a BrokerChannel. A BrokerChannel may be either an Exchange or a Queue. @author Vaughn Vernon
  • com.taobao.metamorphosis.client.producer.MessageProducer
    ��Ϣ�����ߣ��̰߳�ȫ���Ƽ����� @author boyan @Date 2011-4-21
  • com.wordpress.salaboy.messaging.MessageProducer
    @author salaboy
  • javax.jms.MessageProducer
    @version $Rev: 46019 $ $Date: 2004-09-14 03:56:06 -0600 (Tue, 14 Sep 2004) $
  • org.apache.cassandra.net.MessageProducer
  • org.apache.qpid.jms.MessageProducer
  • org.mokai.MessageProducer
    Used by {@link Connector}s to inject messages into the gateway. @author German Escobar

  • Examples of br.com.caelum.stella.MessageProducer

    public class CoreExample {
      public static void main(String[] args) {
        String cnpj = "26.637.142/0001-48";
        ResourceBundle resourceBundle = ResourceBundle
            .getBundle("StellaValidationMessages",new Locale("pt","BR"));
        MessageProducer messageProducer = new ResourceBundleMessageProducer(
            resourceBundle);
        boolean isFormatted = true;
        CNPJValidator validator = new CNPJValidator(messageProducer,
            isFormatted);
        try {
    View Full Code Here

    Examples of com.agilejava.blammo.MessageProducer

        return adapter;
      }

      public void logDivisionByZero(final int a) {
        if (!interceptor.accepts("BLAM0204", null, "logDivisionByZero")) return;
        final MessageProducer __producer = new MessageProducer() {
          public String getMessage() {
            String __message = bundle.getString("com.agilejava.blammo.samples.BLAM0204");
            Object[] args = new Object[] { new Integer(a) };
            __message = MessageFormat.format(__message, args);
            __message = "BLAM0204: " + __message;
    View Full Code Here

    Examples of com.dianping.cat.message.MessageProducer

        int len = paths.size();

        if (len > 0) {
          Cat.setup("DumpUploader");

          MessageProducer cat = Cat.getProducer();
          String ip = NetworkInterfaceManager.INSTANCE.getLocalHostAddress();
          Transaction root = cat.newTransaction("System", "Dump-" + ip);

          Collections.sort(paths);

          root.addData("files", paths);
          root.setStatus(Message.SUCCESS);

          for (int i = 0; i < len; i++) {
            String path = paths.get(i);
            Transaction t = cat.newTransaction("System", "UploadDump");
            File file = new File(baseDir, path);

            t.addData("file", path);

            FSDataOutputStream fdos = null;
            FileInputStream fis = null;
            try {
              fdos = makeHdfsOutputStream(path);
              fis = new FileInputStream(file);

              long start = System.currentTimeMillis();

              Files.forIO().copy(fis, fdos, AutoClose.INPUT_OUTPUT);

              double sec = (System.currentTimeMillis() - start) / 1000d;
              String size = Formats.forNumber().format(file.length(), "0.#", "B");
              String speed = sec <= 0 ? "N/A" : Formats.forNumber().format(file.length() / sec, "0.0", "B/s");

              t.addData("size", size);
              t.addData("speed", speed);
              t.setStatus(Message.SUCCESS);

              if (!file.delete()) {
                m_logger.warn("Can't delete file: " + file);
              }
            } catch (AlreadyBeingCreatedException e) {
              Cat.logError(e);
              t.setStatus(e);

              m_logger.error(String.format("Already being created (%s)!", path), e);
            } catch (AccessControlException e) {
              cat.logError(e);
              t.setStatus(e);
              m_logger.error(String.format("No permission to create HDFS file(%s)!", path), e);
            } catch (Exception e) {
              cat.logError(e);
              t.setStatus(e);
              m_logger.error(String.format("Uploading file(%s) to HDFS(%s) failed!", file, path), e);
            } finally {
              try {
                if (fdos != null) {
    View Full Code Here

    Examples of com.netflix.astyanax.recipes.queue.MessageProducer

                    .withPollInterval(100L, TimeUnit.MILLISECONDS)
                    .withShardLockManager(slm)
                    .build();

            queue.createQueue();
            MessageProducer producer = queue.createProducer();
            MessageConsumer consumer = queue.createConsumer();

            // Enqueue a recurring message
            final String key = "RepeatingMessageWithTimeout";
            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();
            } catch (KeyExistsException e) {
                LOG.info("Key already exists");
            }
    View Full Code Here

    Examples of com.saasovation.common.port.adapter.messaging.rabbitmq.MessageProducer

            List<Notification> notifications =
                this.listUnpublishedNotifications(
                        publishedNotificationTracker.mostRecentPublishedNotificationId());

            MessageProducer messageProducer = this.messageProducer();

            try {
                for (Notification notification : notifications) {
                    this.publish(notification, messageProducer);
                }

                this.publishedNotificationTrackerStore()
                    .trackMostRecentPublishedNotification(
                        publishedNotificationTracker,
                        notifications);
            } finally {
                messageProducer.close();
            }
        }
    View Full Code Here

    Examples of com.taobao.metamorphosis.client.producer.MessageProducer

    public class AsyncOnewayProducer {
        public static void main(final String[] args) throws Exception {
            // New session factory,ǿ�ҽ���ʹ�õ���
            final AsyncMessageSessionFactory sessionFactory = new AsyncMetaMessageSessionFactory(initMetaConfig());
            // create producer,ǿ�ҽ���ʹ�õ���
            final MessageProducer producer = sessionFactory.createAsyncProducer();
            // publish topic
            final String topic = "meta-test";
            producer.publish(topic);

            final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String line = null;
            while ((line = readLine(reader)) != null) {
                // send message
                try {
                    producer.sendMessage(new Message(topic, line.getBytes()), new SendMessageCallback() {

                        @Override
                        public void onMessageSent(final SendResult result) {
                            if (result.isSuccess()) {
                                System.out.println("Send message successfully,sent to " + result.getPartition());
    View Full Code Here

    Examples of com.wordpress.salaboy.messaging.MessageProducer

            MessageServerSingleton.getInstance().stop();
        }

        @Test
        public void hornetQSimple() throws HornetQException {
            MessageProducer producer = MessageFactory.createMessageProducer();

            String message = "Hello HornetQ!";
            producer.sendMessage(message);
            System.out.println(">> Sending Message: " + message);

            producer.stop();
           
            Object object = consumer.receiveMessage();
            Assert.assertNotNull(object);
            Assert.assertEquals(message, object.toString());
    View Full Code Here

    Examples of javax.jms.MessageProducer

            MapMessage invoiceMessage = session.createMapMessage();
            invoiceMessage.setInt("orderId", orderId);
            invoiceMessage.setFloat("amount", amount);

            // send it!
            MessageProducer producer = session.createProducer(invoiceQueue);
            producer.send(invoiceMessage);

            logger.log(
                Level.FINE,
                "sent invoice message for PO #{0,number,integer} with amount {1,number,currency}",
                new Object[] { orderId, amount });
    View Full Code Here

    Examples of javax.jms.MessageProducer

            // create the message
            MapMessage message = session.createMapMessage();
            message.setString("customerId", customerId);

            // send it!
            MessageProducer producer = session.createProducer(shippingQueue);
            producer.send(message);

            logger.log(Level.FINE, "sent shipping message for customer {0}",
                customerId);
          }
          finally {
    View Full Code Here

    Examples of javax.jms.MessageProducer

          ictx.close();
        }

        Connection cnx = cf.createConnection("anonymous", "anonymous");
        Session session = cnx.createSession(true, 0);
        MessageProducer pub = session.createProducer(dest);

        String location = System.getProperty("location");
        if (location != null)
          System.out.println("Publishes messages on topic on " + location);

        TextMessage msg = session.createTextMessage();

        int i;
        for (i = 0; i < 10; i++) {
          msg.setText("Msg " + i);
          pub.send(msg);
        }
        session.commit();

        System.out.println(i + " messages published.");
    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.