org.apache.rocketmq.client.producer.TransactionCheckListener Java Examples
The following examples show how to use
org.apache.rocketmq.client.producer.TransactionCheckListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultMQProducerImpl.java From rocketmq with Apache License 2.0 | 5 votes |
/** * This method will be removed in the version 5.0.0 and <code>getCheckListener</code> is recommended. * * @return */ @Override @Deprecated public TransactionCheckListener checkListener() { if (this.defaultMQProducer instanceof TransactionMQProducer) { TransactionMQProducer producer = (TransactionMQProducer) defaultMQProducer; return producer.getTransactionCheckListener(); } return null; }
Example #2
Source File: DefaultMQProducerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
@Override public TransactionCheckListener checkListener() { if (this.defaultMQProducer instanceof TransactionMQProducer) { TransactionMQProducer producer = (TransactionMQProducer) defaultMQProducer; return producer.getTransactionCheckListener(); } return null; }
Example #3
Source File: DefaultMQProducerImpl.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * This method will be removed in the version 5.0.0 and <code>getCheckListener</code> is recommended. * @return */ @Override @Deprecated public TransactionCheckListener checkListener() { if (this.defaultMQProducer instanceof TransactionMQProducer) { TransactionMQProducer producer = (TransactionMQProducer) defaultMQProducer; return producer.getTransactionCheckListener(); } return null; }
Example #4
Source File: TransactionProducer.java From rocketmq with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws MQClientException, InterruptedException { TransactionCheckListener transactionCheckListener = new TransactionCheckListenerImpl(); TransactionMQProducer producer = new TransactionMQProducer("please_rename_unique_group_name"); producer.setCheckThreadPoolMinSize(2); producer.setCheckThreadPoolMaxSize(2); producer.setCheckRequestHoldMax(2000); producer.setTransactionCheckListener(transactionCheckListener); producer.start(); String[] tags = new String[] {"TagA", "TagB", "TagC", "TagD", "TagE"}; TransactionExecuterImpl tranExecuter = new TransactionExecuterImpl(); for (int i = 0; i < 100; i++) { try { Message msg = new Message("TopicTest", tags[i % tags.length], "KEY" + i, ("Hello RocketMQ " + i).getBytes(RemotingHelper.DEFAULT_CHARSET)); SendResult sendResult = producer.sendMessageInTransaction(msg, tranExecuter, null); System.out.printf("%s%n", sendResult); Thread.sleep(10); } catch (MQClientException | UnsupportedEncodingException e) { e.printStackTrace(); } } for (int i = 0; i < 100000; i++) { Thread.sleep(1000); } producer.shutdown(); }
Example #5
Source File: TransactionProducer.java From DDMQ with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws MQClientException, InterruptedException { TransactionCheckListener transactionCheckListener = new TransactionCheckListenerImpl(); TransactionMQProducer producer = new TransactionMQProducer("please_rename_unique_group_name"); producer.setCheckThreadPoolMinSize(2); producer.setCheckThreadPoolMaxSize(2); producer.setCheckRequestHoldMax(2000); producer.setTransactionCheckListener(transactionCheckListener); producer.start(); String[] tags = new String[] {"TagA", "TagB", "TagC", "TagD", "TagE"}; TransactionExecuterImpl tranExecuter = new TransactionExecuterImpl(); for (int i = 0; i < 100; i++) { try { Message msg = new Message("TopicTest", tags[i % tags.length], "KEY" + i, ("Hello RocketMQ " + i).getBytes(RemotingHelper.DEFAULT_CHARSET)); SendResult sendResult = producer.sendMessageInTransaction(msg, tranExecuter, null); System.out.printf("%s%n", sendResult); Thread.sleep(10); } catch (MQClientException | UnsupportedEncodingException e) { e.printStackTrace(); } } for (int i = 0; i < 100000; i++) { Thread.sleep(1000); } producer.shutdown(); }
Example #6
Source File: TransactionProducer.java From DDMQ with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws MQClientException, InterruptedException { TransactionCheckListener transactionCheckListener = new TransactionCheckListenerImpl(); TransactionMQProducer producer = new TransactionMQProducer("please_rename_unique_group_name"); producer.setCheckThreadPoolMinSize(2); producer.setCheckThreadPoolMaxSize(2); producer.setCheckRequestHoldMax(2000); producer.setTransactionCheckListener(transactionCheckListener); producer.start(); String[] tags = new String[] {"TagA", "TagB", "TagC", "TagD", "TagE"}; TransactionExecuterImpl tranExecuter = new TransactionExecuterImpl(); for (int i = 0; i < 100; i++) { try { Message msg = new Message("TopicTest", tags[i % tags.length], "KEY" + i, ("Hello RocketMQ " + i).getBytes(RemotingHelper.DEFAULT_CHARSET)); SendResult sendResult = producer.sendMessageInTransaction(msg, tranExecuter, null); System.out.printf("%s%n", sendResult); Thread.sleep(10); } catch (MQClientException | UnsupportedEncodingException e) { e.printStackTrace(); } } for (int i = 0; i < 100000; i++) { Thread.sleep(1000); } producer.shutdown(); }
Example #7
Source File: DefaultMQProducerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
@Override public TransactionCheckListener checkListener() { if (this.defaultMQProducer instanceof TransactionMQProducer) { TransactionMQProducer producer = (TransactionMQProducer) defaultMQProducer; return producer.getTransactionCheckListener(); } return null; }
Example #8
Source File: TransactionProducer.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws MQClientException, InterruptedException { TransactionCheckListener transactionCheckListener = new TransactionCheckListenerImpl(); TransactionMQProducer producer = new TransactionMQProducer("please_rename_unique_group_name"); producer.setCheckThreadPoolMinSize(2); producer.setCheckThreadPoolMaxSize(2); producer.setCheckRequestHoldMax(2000); producer.setTransactionCheckListener(transactionCheckListener); producer.start(); String[] tags = new String[] {"TagA", "TagB", "TagC", "TagD", "TagE"}; TransactionExecuterImpl tranExecuter = new TransactionExecuterImpl(); for (int i = 0; i < 100; i++) { try { Message msg = new Message("TopicTest", tags[i % tags.length], "KEY" + i, ("Hello RocketMQ " + i).getBytes(RemotingHelper.DEFAULT_CHARSET)); SendResult sendResult = producer.sendMessageInTransaction(msg, tranExecuter, null); System.out.printf("%s%n", sendResult); Thread.sleep(10); } catch (MQClientException | UnsupportedEncodingException e) { e.printStackTrace(); } } for (int i = 0; i < 100000; i++) { Thread.sleep(1000); } producer.shutdown(); }
Example #9
Source File: DefaultMQProducerImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
@Override public TransactionCheckListener checkListener() { if (this.defaultMQProducer instanceof TransactionMQProducer) { TransactionMQProducer producer = (TransactionMQProducer) defaultMQProducer; return producer.getTransactionCheckListener(); } return null; }
Example #10
Source File: TransactionProducer.java From rocketmq_trans_message with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws MQClientException, InterruptedException { TransactionCheckListener transactionCheckListener = new TransactionCheckListenerImpl(); TransactionMQProducer producer = new TransactionMQProducer("please_rename_unique_group_name"); producer.setCheckThreadPoolMinSize(2); producer.setCheckThreadPoolMaxSize(2); producer.setCheckRequestHoldMax(2000); //producer.setNamesrvAddr("127.0.0.1:9876"); producer.setNamesrvAddr("testserver004:9876"); producer.setTransactionCheckListener(transactionCheckListener); producer.start(); String[] tags = new String[]{"TagA", "TagB", "TagC", "TagD", "TagE"}; TransactionExecuterImpl tranExecuter = new TransactionExecuterImpl(); ExecutorService executorService = Executors.newFixedThreadPool(20); for (int j = 0; j < 5000; j++) { final int i = j; executorService.submit(new Runnable() { @Override public void run() { try { int xx = i; Message msg = new Message("TransactionTest", tags[i % tags.length], "KEY" + i, String.valueOf(xx).getBytes(RemotingHelper.DEFAULT_CHARSET)); long startTime = System.currentTimeMillis(); msg.putUserProperty(PropertyKeyConst.CheckImmunityTimeInSeconds, "30"); //producer.send(msg); SendResult sendResult = producer.sendMessageInTransaction(msg, tranExecuter, i); //System.out.println("发送消息:" + sendResult + ",消耗时间:" + (System.currentTimeMillis() - startTime) + "ms"); System.out.println("发送消息:" + xx + ",消耗时间:" + (System.currentTimeMillis() - startTime) + "ms"); statsMap.put(i, true); } catch (Exception e) { e.printStackTrace(); } } }); } for (int i = 0; i < 100000; i++) { Thread.sleep(1000); } producer.shutdown(); }
Example #11
Source File: MQProducerInner.java From rocketmq-read with Apache License 2.0 | 2 votes |
/** * 获取checklistener * @return ; */ TransactionCheckListener checkListener();
Example #12
Source File: MQProducerInner.java From DDMQ with Apache License 2.0 | votes |
TransactionCheckListener checkListener();
Example #13
Source File: MQProducerInner.java From rocketmq with Apache License 2.0 | votes |
TransactionCheckListener checkListener();
Example #14
Source File: MQProducerInner.java From rocketmq_trans_message with Apache License 2.0 | votes |
TransactionCheckListener checkListener();
Example #15
Source File: MQProducerInner.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | votes |
TransactionCheckListener checkListener();
Example #16
Source File: MQProducerInner.java From rocketmq with Apache License 2.0 | votes |
TransactionCheckListener checkListener();
Example #17
Source File: MQProducerInner.java From DDMQ with Apache License 2.0 | votes |
TransactionCheckListener checkListener();