Hello, here is the preface.
1. Chapter One
The first chapter
. 1 / ** 2 * Producer sends a message containing the configuration failure retry . 3 * / . 4 public class Producer { . 5 public static void main (String [] args) throws MQClientException, {InterruptedException . 6 DefaultMQProducer Producer = new new DefaultMQProducer ( "GROUP_NAME" ); . 7 producer.setNamesrvAddr ( "192.168.2.222:9876;192.168.2.223:9876" ); . 8 . 9 // fails three times retransmission 10 producer.setRetryTimesWhenSendFailed (3 ); . 11 producer.start (); 12 is 13 is for ( int I = 0; I <100; I ++ ) { 14 the try { 15 the Message MSG = new new the Message ( "TopicTest", // Topic 16 "TagA", // Tag . 17 ( "the HelloWorld - RocketMQ" + I) .getBytes () // body 18 is ); . 19 // message is not sent within 1S successful, retry 20 is SendResult sendResult = producer.send (MSG, 1000 ); 21 is System.out.println (sendResult); 22 is }catch (Exception e) { 23 e.printStackTrace(); 24 Thread.sleep(1000); 25 } 26 } 27 producer.shutdown(); 28 } 29 }
2. Chapter II
Here we look at the specific situation.
The first section 2.1
content.
2.2 The second section
content.