Skip to content

Commit

Permalink
DATAGO-67107 Added support for mapping/forwarding Solace message user…
Browse files Browse the repository at this point in the history
… properties to Kafka record headers

- Added two new configuration parameters: sol.message_processor.map_user_properties and
sol.message_processor.map_solace_standard_properties
- Updated tests, sample configuration and docs
  • Loading branch information
mayur-solace committed Feb 2, 2024
1 parent cff498f commit 0d9f65c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import com.solacesystems.jcsmp.TextMessage;
import com.solacesystems.jcsmp.Topic;
import com.solacesystems.jcsmp.impl.AbstractDestination;
import com.solacesystems.jcsmp.impl.QueueImpl;
import com.solacesystems.jcsmp.impl.TopicImpl;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.time.Duration;
Expand Down Expand Up @@ -684,9 +682,9 @@ private SDTMap getTestUserProperties() throws SDTException {
solMsgUserProperties.putByteArray("byteArray-user-property",
new ByteArray("Hello World".getBytes()));
solMsgUserProperties.putDestination("topic-user-property",
TopicImpl.createFastNoValidation("testTopic"));
JCSMPFactory.onlyInstance().createTopic("testTopic"));
solMsgUserProperties.putDestination("queue-user-property",
QueueImpl.createFastNoValidation("testQueue"));
JCSMPFactory.onlyInstance().createTopic("testQueue"));

return solMsgUserProperties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.solacesystems.jcsmp.SDTMap;
import com.solacesystems.jcsmp.TextMessage;
import com.solacesystems.jcsmp.User_Cos;
import com.solacesystems.jcsmp.impl.QueueImpl;
import com.solacesystems.jcsmp.impl.RawSMFMessageImpl;
import com.solacesystems.jcsmp.impl.TopicImpl;
import java.math.BigInteger;
import java.util.UUID;
import org.apache.kafka.connect.header.ConnectHeaders;
Expand Down Expand Up @@ -76,9 +74,9 @@ void testUserPropertiesMappingForGivenUserPropertyMap() throws SDTException {
solMsgUserProperties.putByteArray("byteArray-user-property",
new ByteArray("Hello World".getBytes()));
solMsgUserProperties.putDestination("topic-user-property",
TopicImpl.createFastNoValidation("testTopic"));
JCSMPFactory.onlyInstance().createTopic("testTopic"));
solMsgUserProperties.putDestination("queue-user-property",
QueueImpl.createFastNoValidation("testQueue"));
JCSMPFactory.onlyInstance().createQueue("testQueue"));

final BytesXMLMessage message = mock(TextMessage.class);
when(message.getProperties()).thenReturn(solMsgUserProperties);
Expand Down Expand Up @@ -114,9 +112,9 @@ void testSolaceStandardPropertiesMappingGivenSolaceMessage() {
when(message.getApplicationMessageType()).thenReturn("testMessageType");
when(message.getCorrelationId()).thenReturn(UUID.randomUUID().toString());
when(message.getCos()).thenReturn(User_Cos.USER_COS_1);
when(message.getDestination()).thenReturn(QueueImpl.createFastNoValidation("testQueue"));
when(message.getDestination()).thenReturn(JCSMPFactory.onlyInstance().createQueue("testQueue"));
when(message.getDeliveryMode()).thenReturn(DeliveryMode.PERSISTENT);
when(message.getReplyTo()).thenReturn(QueueImpl.createFastNoValidation("testQueue"));
when(message.getReplyTo()).thenReturn(JCSMPFactory.onlyInstance().createQueue("testQueue"));

ConnectHeaders kafkaHeaders = messageProcessor.solacePropertiesToKafkaHeaders(message);
assertThat("kafkaHeaders should not be empty", !kafkaHeaders.isEmpty());
Expand Down

0 comments on commit 0d9f65c

Please sign in to comment.