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+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one or more
3+ * contributor license agreements. See the NOTICE file distributed with
4+ * this work for additional information regarding copyright ownership.
5+ * The ASF licenses this file to You under the Apache License, Version 2.0
6+ * (the "License"); you may not use this file except in compliance with
7+ * the License. You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+ package io .openmessaging .api ;
18+
19+ /**
20+ * {@code ProducerBase} is the basic of other {@code Producer} interfaces
21+ * and is used to define some common methods.
22+ *
23+ * @version OMS 2.0.3
24+ * @since OMS 2.0.3
25+ */
26+ public interface ProducerBase {
27+
28+ /**
29+ * Create message builder, used for build message in a fluent way.
30+ *
31+ * @param <T> the class of message's payload
32+ * @return MessageBuilder
33+ */
34+ <T > MessageBuilder <T > messageBuilder ();
35+ }
Original file line number Diff line number Diff line change 1919
2020import io .openmessaging .api .Admin ;
2121import io .openmessaging .api .Message ;
22- import io .openmessaging .api .MessageBuilder ;
22+ import io .openmessaging .api .ProducerBase ;
2323import io .openmessaging .api .SendResult ;
2424
2525/**
2828 * @version OMS 1.2.0
2929 * @since OMS 1.2.0
3030 */
31- public interface OrderProducer extends Admin {
31+ public interface OrderProducer extends ProducerBase , Admin {
3232
3333 /**
3434 * Send message in order
@@ -39,13 +39,4 @@ public interface OrderProducer extends Admin {
3939 * @return {@link SendResult} Message delivery result, including message Id.
4040 */
4141 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 ();
5142}
Original file line number Diff line number Diff line change 1919
2020import io .openmessaging .api .Admin ;
2121import io .openmessaging .api .Message ;
22- import io .openmessaging .api .MessageBuilder ;
22+ import io .openmessaging .api .ProducerBase ;
2323import io .openmessaging .api .SendResult ;
2424import io .openmessaging .api .TransactionalResult ;
2525
2929 * @version OMS 1.2.0
3030 * @since OMS 1.2.0
3131 */
32- public interface TransactionProducer extends Admin {
32+ public interface TransactionProducer extends ProducerBase , Admin {
3333
3434 /**
3535 * This method is used to send a transactional message. A transactional message is sent in three steps:
@@ -46,17 +46,8 @@ public interface TransactionProducer extends Admin {
4646 * @return Send result
4747 */
4848 SendResult send (final Message message ,
49- final LocalTransactionExecuter localTransactionExecutor ,
50- final Object arg );
51-
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 ();
49+ final LocalTransactionExecuter localTransactionExecutor ,
50+ final Object arg );
6051
6152 /**
6253 * Sends a transactional message
You can’t perform that action at this time.
0 commit comments