Package com.taobao.metamorphosis.client.producer

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


        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


        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

        EasyMock.expect(this.sessionFactory.createProducer()).andReturn(this.producer);
        this.producer.publish("test");
        EasyMock.expectLastCall();
        MessageBuilder builder = MessageBuilder.withTopic("test").withBody("hello world");
        final SendResult rt = new SendResult(true, null, 0, null);
        SendMessageCallback cb = new SendMessageCallback() {

            @Override
            public void onMessageSent(SendResult result) {
                assertSame(rt, result);
View Full Code Here

        this.messages = new ArrayList<Message>();
        final CountDownLatch latch = new CountDownLatch(count);
        for (int i = 0; i < count; i++) {
            final byte[] data = (strdata + i).getBytes();
            final Message msg = new Message(topic, data);
            this.producer.sendMessage(msg, new SendMessageCallback() {
                public void onMessageSent(final SendResult result) {
                    latch.countDown();
                    if (!result.isSuccess()) {
                        throw new RuntimeException("Send message failed:" + result.getErrorMessage());
                    }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.client.producer.SendMessageCallback

Copyright © 2018 www.massapicom. 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.