Regarding $subject, this is a showstopper none of the json path functionalities working when jms retrieved via jms object as part of JMS consumer service. You may try to retrive 'jms:Message message' and covert that to JSON object and peform json path operations, it will return you null
Sample [1]
service<jms:Consumer> orderDeliverySystem bind jmsConsumer {
// Triggered whenever an order is added to the 'OrderQueue'
onMessage(endpoint consumer, jms:Message message) {
log:printInfo("New order received from the JMS Queue");
http:Request orderToDeliver;
// Retrieve the string payload using native function
string stringPayload = check message.getTextMessageContent();
log:printInfo("Order Details: " + stringPayload);
json jsonOrder = <json>stringPayload;
orderToDeliver.setJsonPayload(jsonOrder);
http:Response courierRes= check courierEP -> post("/delivery", request = orderToDeliver);
//upon backend service response or backend service unavailability we need to ack
//back to the broker.
json courerResponseJSON = check courierRes.getJsonPayload();
log:printInfo("courier service response ||| " +courerResponseJSON.toString());
log:printInfo("courier service response status code ||| " +courierRes.statusCode);
}
There is a workaround suggested as given below, but following is not a viable option thus required immediate fix
function getJson(string content, string encoding) returns json {
io:StringReader reader = new io:StringReader(content, encoding = encoding);
json result = check reader.readJson();
var closeResult = reader.close();
return result;
}
Issue by dushansachinda Monday Jun 11, 2018 at 02:56 GMT Originally opened as https://github.com/ballerina-platform/ballerina-lang/issues/8973
Regarding $subject, this is a showstopper none of the json path functionalities working when jms retrieved via jms object as part of JMS consumer service. You may try to retrive 'jms:Message message' and covert that to JSON object and peform json path operations, it will return you null
Sample [1]
There is a workaround suggested as given below, but following is not a viable option thus required immediate fix
[1] https://ballerina.io/learn/by-guide/messaging-with-jms-queues/