Do not return a Postition from send signature in the API 8/head
authortmaret <tmaret@adobe.com>
Thu, 3 Jan 2019 14:38:36 +0000 (15:38 +0100)
committertmaret <tmaret@adobe.com>
Thu, 3 Jan 2019 14:38:36 +0000 (15:38 +0100)
org.apache.aries.events.api/src/main/java/org/apache/aries/events/api/Messaging.java
org.apache.aries.events.memory/src/main/java/org/apache/aries/events/memory/InMemoryMessaging.java
org.apache.aries.events.memory/src/test/java/org/apache/aries/events/memory/MessagingTest.java

index 36433d93c062a249942b58a389fa8d65825ebfee..2cd1138a196e774b35c7ca50b38a9800b0cd2244 100644 (file)
@@ -28,7 +28,7 @@ public interface Messaging {
      * Send a message to a topic. When this method returns the message 
      * is safely persisted.
      */
-    Position send(String topic, Message message);
+    void send(String topic, Message message);
 
     /**
      * Subscribe to a topic. The callback is called for each message received.
index e2639fe5c63200959f9f788ba72cd53dc4729af6..8966c16d540f87bc06edecf19d95e574a8d39390 100644 (file)
@@ -36,9 +36,9 @@ public class InMemoryMessaging implements Messaging {
     private Map<String, Topic> topics = new ConcurrentHashMap<>();
 
     @Override
-    public Position send(String topicName, Message message) {
+    public void send(String topicName, Message message) {
         Topic topic = getOrCreate(topicName);
-        return topic.send(message);
+        topic.send(message);
     }
 
     @Override
index a8262bdfb3a4f5a5b884d5b9cae3f606590d29ae..2a70b6e93392c3e87c57a47579912ce87b2deaeb 100644 (file)
@@ -62,9 +62,7 @@ public class MessagingTest {
     public void testSend() {
         subscriptions.add(messaging.subscribe("test", null, Seek.earliest, callback));
         String content = "testcontent";
-        Position pos = send("test", content);
-        assertThat(pos.toString(), equalTo("0"));
-        
+        send("test", content);
         verify(callback, timeout(1000)).accept(messageCaptor.capture());
         Received received = messageCaptor.getValue();
         assertThat(received.getMessage().getPayload(), equalTo(toBytes(content)));
@@ -132,11 +130,11 @@ public class MessagingTest {
         return new String(rec.getMessage().getPayload(), Charset.forName("UTF-8"));
     }
     
-    private Position send(String topic, String content) {
+    private void send(String topic, String content) {
         Map<String, String> props = new HashMap<String, String>();
         props.put("my", "testvalue");
         Message message = messaging.newMessage(toBytes(content), props);
-        return messaging.send(topic, message);
+        messaging.send(topic, message);
     }
 
     private byte[] toBytes(String content) {