File tree Expand file tree Collapse file tree
openmessaging-api/src/main/java/io/openmessaging/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4141 * @version OMS 1.2.0
4242 * @since OMS 1.2.0
4343 */
44- public interface Producer extends Admin {
44+ public interface Producer extends ProducerBase , Admin {
4545
4646 /**
4747 * Sends a message to the specified destination synchronously, the destination should be preset to {@link
@@ -84,12 +84,4 @@ public interface Producer extends Admin {
8484 * @param callbackExecutor
8585 */
8686 void setCallbackExecutor (final ExecutorService callbackExecutor );
87-
88- /**
89- * Create message builder, used for build message in a fluent way.
90- *
91- * @param <T>
92- * @return
93- */
94- <T > MessageBuilder <T > messageBuilder ();
9587}
Original file line number Diff line number Diff line change 1+ package io .openmessaging .api ;
2+
3+ /**
4+ * {@code ProducerBase} is the basic of other {@code Producer} interfaces
5+ * and is used to define some common methods.
6+ *
7+ * @author chengyi (mark.lx@antfin.com) 2020-05-22 11:12
8+ */
9+ public interface ProducerBase {
10+
11+ /**
12+ * Create message builder, used for build message in a fluent way.
13+ *
14+ * @param <T> the class of message's payload
15+ * @return MessageBuilder
16+ */
17+ <T > MessageBuilder <T > messageBuilder ();
18+ }
Original file line number Diff line number Diff line change 1717
1818package io .openmessaging .api .order ;
1919
20- import io .openmessaging .api .Admin ;
21- import io .openmessaging .api .Message ;
22- import io .openmessaging .api .MessageBuilder ;
23- import io .openmessaging .api .SendResult ;
20+ import io .openmessaging .api .*;
2421
2522/**
2623 * Sequential message producer interface
2724 *
2825 * @version OMS 1.2.0
2926 * @since OMS 1.2.0
3027 */
31- public interface OrderProducer extends Admin {
28+ public interface OrderProducer extends ProducerBase , Admin {
3229
3330 /**
3431 * Send message in order
@@ -39,13 +36,4 @@ public interface OrderProducer extends Admin {
3936 * @return {@link SendResult} Message delivery result, including message Id.
4037 */
4138 SendResult send (final Message message , final String shardingKey );
42-
43-
44- /**
45- * Create message builder, used for build message in a fluent way.
46- *
47- * @param <T>
48- * @return
49- */
50- <T > MessageBuilder <T > messageBuilder ();
5139}
Original file line number Diff line number Diff line change 1717
1818package io .openmessaging .api .transaction ;
1919
20- import io .openmessaging .api .Admin ;
21- import io .openmessaging .api .Message ;
22- import io .openmessaging .api .MessageBuilder ;
23- import io .openmessaging .api .SendResult ;
24- import io .openmessaging .api .TransactionalResult ;
20+ import io .openmessaging .api .*;
2521
2622/**
2723 * Send transactional message.
2824 *
2925 * @version OMS 1.2.0
3026 * @since OMS 1.2.0
3127 */
32- public interface TransactionProducer extends Admin {
28+ public interface TransactionProducer extends ProducerBase , Admin {
3329
3430 /**
3531 * This method is used to send a transactional message. A transactional message is sent in three steps:
@@ -49,15 +45,6 @@ SendResult send(final Message message,
4945 final LocalTransactionExecuter localTransactionExecutor ,
5046 final Object arg );
5147
52-
53- /**
54- * Create message builder, used for build message in a fluent way.
55- *
56- * @param <T>
57- * @return
58- */
59- <T > MessageBuilder <T > messageBuilder ();
60-
6148 /**
6249 * Sends a transactional message
6350 * <p>
You can’t perform that action at this time.
0 commit comments