use of com.rabbitmq.stream.codec.SwiftMqCodec in project rabbitmq-stream-java-client by rabbitmq.
the class ClientTest method publishConsumeComplexMessagesWithMessageImplementationAndSwiftMqCodec.
@Test
void publishConsumeComplexMessagesWithMessageImplementationAndSwiftMqCodec() {
Codec codec = new SwiftMqCodec();
Client publisher = cf.get(new Client.ClientParameters().codec(codec));
publishConsumeComplexMessage(publisher, codec, i -> {
byte[] body = ("message" + i).getBytes(StandardCharsets.UTF_8);
Map<String, Object> applicationProperties = Collections.singletonMap("id", i);
Message message = new Message() {
@Override
public boolean hasPublishingId() {
return false;
}
@Override
public long getPublishingId() {
return 0;
}
@Override
public byte[] getBodyAsBinary() {
return body;
}
@Override
public Object getBody() {
return null;
}
@Override
public Properties getProperties() {
return null;
}
@Override
public Map<String, Object> getApplicationProperties() {
return applicationProperties;
}
@Override
public Map<String, Object> getMessageAnnotations() {
return null;
}
};
return message;
});
}
use of com.rabbitmq.stream.codec.SwiftMqCodec in project rabbitmq-stream-java-client by rabbitmq.
the class ClientTest method publishConsumeComplexMessageWithMessageBuilderAndSwiftMqCodec.
@Test
void publishConsumeComplexMessageWithMessageBuilderAndSwiftMqCodec() {
Codec codec = new SwiftMqCodec();
Client publisher = cf.get(new Client.ClientParameters().codec(codec));
publishConsumeComplexMessage(publisher, codec, i -> publisher.messageBuilder().applicationProperties().entry("id", i).messageBuilder().addData(("message" + i).getBytes(StandardCharsets.UTF_8)).build());
}
Aggregations