Package core.apiCore.helpers
Class MessageQueueHelper
java.lang.Object
core.apiCore.helpers.MessageQueueHelper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidevaluateOption(ServiceObject serviceObject) static CopyOnWriteArrayList<MessageObject> filterOutboundMessage(String messageId) filter outbound message based on messageIdstatic CopyOnWriteArrayList<MessageObject> findMessagesBasedOnMessageId(String messageId) find message based on record idstatic CopyOnWriteArrayList<MessageObject> find message based on unique identifier passed in through options identifiers are separated by comma separators have And relationshipstatic StringgenerateMessageId(ServiceObject serviceObject, String messageIdPrefix) generate message id if the request body is setgetHeaderList(CopyOnWriteArrayList<MessageObject> filteredMessages) inserts filtered headers to array list of stringsgetKeyValueFromString(String value, String entriesSeparator, String separator) separated based on key value if key value exists eg.getMessageList(CopyOnWriteArrayList<MessageObject> filteredMessages) inserts filtered messages to array list of stringsstatic voidgetOutboundMessages(MessageObject.messageType messageType) getTopicList(CopyOnWriteArrayList<MessageObject> filteredMessages) inserts filtered topics to array list of stringsstatic booleanisExpectingMessageCount(String expectedResponse) is fixed messaged count expected eg.static longlogPerInterval(int interval, StopWatchHelper watch, long lastLogged, int receivedMessageCount) log per interval stating the wait time for a message from message queuestatic voidprintAllFilteredMessages(CopyOnWriteArrayList<MessageObject> filteredMessages) static voidprint all messages idsstatic voidreceiveAndValidateMessages(ServiceObject serviceObject, String messageId, MessageObject.messageType messageType) 1) gets messages, adds them to the outboundMessages 2) filters based on the message key 3) validates based on expected response requirementsstatic voidsaveOutBoundValues(ServiceObject serviceObject, CopyOnWriteArrayList<MessageObject> filteredMessages, List<String> errorMessages) validateExpectedMessageCount(String request, List<String> filteredMessages) validate expected message count from received message format: EXPECTED_MESSAGE_COUNT:1;validateMessages(ServiceObject serviceObject, CopyOnWriteArrayList<MessageObject> filteredMessages) validate message based on message, header, or topic valites json, xml, or text response
-
Field Details
-
RESPONSE_IDENTIFIER
- See Also:
-
-
Constructor Details
-
MessageQueueHelper
public MessageQueueHelper()
-
-
Method Details
-
receiveAndValidateMessages
public static void receiveAndValidateMessages(ServiceObject serviceObject, String messageId, MessageObject.messageType messageType) throws Exception 1) gets messages, adds them to the outboundMessages 2) filters based on the message key 3) validates based on expected response requirements- Parameters:
messageId-- Throws:
Exception
-
saveOutBoundValues
public static void saveOutBoundValues(ServiceObject serviceObject, CopyOnWriteArrayList<MessageObject> filteredMessages, List<String> errorMessages) -
generateMessageId
generate message id if the request body is set- Parameters:
requestBody-- Returns:
-
logPerInterval
public static long logPerInterval(int interval, StopWatchHelper watch, long lastLogged, int receivedMessageCount) log per interval stating the wait time for a message from message queue- Parameters:
interval-watch-lastLogged-- Returns:
-
validateExpectedMessageCount
public static List<String> validateExpectedMessageCount(String request, List<String> filteredMessages) validate expected message count from received message format: EXPECTED_MESSAGE_COUNT:1;- Parameters:
request-filteredMessages-- Returns:
-
isExpectingMessageCount
is fixed messaged count expected eg. EXPECTED_MESSAGE_COUNT:2- Parameters:
expectedResponse-- Returns:
-
getKeyValueFromString
public static Map<String,String> getKeyValueFromString(String value, String entriesSeparator, String separator) separated based on key value if key value exists eg. key:value; key1:value1- Parameters:
value-entriesSeparator- eg. ";"separator- eg ":"- Returns:
-
findMessagesBasedOnResponseIdentifier
find message based on unique identifier passed in through options identifiers are separated by comma separators have And relationship- Parameters:
messageId-- Returns:
-
findMessagesBasedOnMessageId
find message based on record id- Parameters:
messageId-- Returns:
-
filterOutboundMessage
filter outbound message based on messageId- Parameters:
msgId-- Returns:
-
getOutboundMessages
- Throws:
Exception
-
printAllMessages
public static void printAllMessages()print all messages ids -
printAllFilteredMessages
-
getMessageList
inserts filtered messages to array list of strings- Parameters:
filteredMessages-- Returns:
-
getHeaderList
inserts filtered headers to array list of strings- Parameters:
filteredMessages-- Returns:
-
getTopicList
inserts filtered topics to array list of strings- Parameters:
filteredMessages-- Returns:
-
validateMessages
public static List<String> validateMessages(ServiceObject serviceObject, CopyOnWriteArrayList<MessageObject> filteredMessages) validate message based on message, header, or topic valites json, xml, or text response- Returns:
-
evaluateOption
-