Skip to content

Commit

Permalink
feat: create miranumMessageAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
rami-nk committed Jul 13, 2023
1 parent 5643e99 commit 2a68250
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.miragon.example.adapter.out;

import io.miragon.example.application.port.out.SendMessagePort;
import io.miragon.miranum.connect.message.api.CorrelateMessageCommand;
import io.miragon.miranum.connect.message.api.MessageApi;
import lombok.RequiredArgsConstructor;

import java.util.Map;

@RequiredArgsConstructor
public class MiranumMessageAdapter implements SendMessagePort {

private final MessageApi messageApi;

@Override
public void sendMessage(String messageName, String key, Map<String, Object> data) {
var command = new CorrelateMessageCommand(messageName, key, data);
messageApi.correlateMessage(command);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

public interface SendMessagePort {

void sendMessage(final String messageName, final Map<String, Object> data);
void sendMessage(final String messageName, final String key, final Map<String, Object> data);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SendMessageService implements SendMessageUseCase {

@Override
public SendMessageResult sendMessage(SendMessageCommand command) {
sendMessagePort.sendMessage(command.getMessage(), null);
sendMessagePort.sendMessage(command.getMessage(), "key", null);
return new SendMessageResult("answer to: " + command.getMessage());
}
}

0 comments on commit 2a68250

Please sign in to comment.