Skip to content
Permalink
Browse files
Do not return a Postition from send signature in the API
  • Loading branch information
tmaret committed Jan 3, 2019
1 parent ad3b813 commit 01b1ff977d71150bb53454904cb5bba9f20e93f1
Showing 3 changed files with 6 additions and 8 deletions.
@@ -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.
@@ -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
@@ -62,9 +62,7 @@ public void testPositionFromString() {
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 @@ private String getContent(Received rec) {
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) {

0 comments on commit 01b1ff9

Please sign in to comment.