Amazon MQ (Apache ActiveMQ) Event Source Lambda payload is missing Destination - aws-lambda

I have an AWS Lamda that is configured to receive messages from an Amazon MQ (Apache ActiveMQ) via an MQ trigger. I depend on the destination object shown in the example MQ record event in the documentation to know from which queue the message is coming. However, in reality, the message object has an empty destination object, and I am unsure why. The object looks good otherwise.
This is what the example looks like in the AWS documentation.
{
"eventSource": "aws:mq",
"eventSourceArn": "arn:aws:mq:us-west-2:111122223333:broker:test:b-9bcfa592-423a-4942-879d-eb284b418fc8",
"messages": [
{
"messageID": "ID:b-9bcfa592-423a-4942-879d-eb284b418fc8-1.mq.us-west-2.amazonaws.com-37557-1234520418293-4:1:1:1:1",
"messageType": "jms/text-message",
"deliveryMode": 1,
"replyTo": null,
"type": null,
"expiration": "60000",
"priority": 1,
"correlationId": "myJMSCoID",
"redelivered": false,
"destination": {
"physicalname": "testQueue"
},
"data":"QUJDOkFBQUE=",
"timestamp": 1598827811958,
"brokerInTime": 1598827811958,
"brokerOutTime": 1598827811959
},
{
"messageID": "ID:b-9bcfa592-423a-4942-879d-eb284b418fc8-1.mq.us-west-2.amazonaws.com-37557-1234520418293-4:1:1:1:1",
"messageType": "jms/bytes-message",
"deliveryMode": 1,
"replyTo": null,
"type": null,
"expiration": "60000",
"priority": 2,
"correlationId": "myJMSCoID1",
"redelivered": false,
"destination": {
"physicalname": "testQueue"
},
"data":"LQaGQ82S48k=",
"timestamp": 1598827811958,
"brokerInTime": 1598827811958,
"brokerOutTime": 1598827811959
}
]
}
This is what the event object looks like in reality as JSON when logged out.
This is the MQ Trigger.
This is what the object looks like in the Active MQ console.

Related

Kafka Stream reprocessing same record different streams thread

At times we are observing issue with Kafka Streams where the same record in getting processed multiple times. below snapshot from log will help :
{
"timestamp": "1652121164192",
"level": "INFO",
"thread": "EntityChangeTopic-7c6877ac-32ee-4e31-8a0b-b9ae02602d72-StreamThread-17",
"mdc": {
"sourceId": "UU",
"serviceType": "k2k",
"recordId": "875812581",
"External_Input_Topic_Name": "topic",
"Action": "AddOrUpdateRequest",
"clientId": "0.2.16",
"elasticapmtraceparent": "\u0000\u0000\ufffd\ufffd[\ufffd\ufffd\u0000&ҼX\u0010>I\ufffd\u0007\u0001\ufffdWh9z\nF\ufffd\u0002\u0000",
"output_format": "ecm",
"format": "icj",
"correlationId": "3591e033-cfb7-11ec-951a-75c1535081ae",
"external_correlationId": "0ad01109-b278-4a69-910d-7acf7db24bab",
"tenantRecord": "true"
},
"logger": "com.optum.hcm.kafka.streams.ECRProcessor",
"message": "processing ecr kafka message with key, correlationId : 0.2.16, 3591e033-cfb7-11ec-951a-75c1535081ae",
"context": "default"
Around 300sec(default max.poll.interval.ms) later I see another log with same message getting processed.
{
"timestamp": "1652121470436",
"level": "INFO",
"thread": "EntityChangeTopic-7c6877ac-32ee-4e31-8a0b-b9ae02602d72-StreamThread-18",
"mdc": {
"sourceId": "UU",
"serviceType": "k2k",
"recordId": "875812581",
"External_Input_Topic_Name": "topic",
"Action": "AddOrUpdateRequest",
"clientId": "0.2.16",
"elasticapmtraceparent": "\u0000\u0000\ufffd\ufffd[\ufffd\ufffd\u0000&ҼX\u0010>I\ufffd\u0007\u0001\ufffdWh9z\nF\ufffd\u0002\u0000",
"output_format": "ecm",
"format": "icj",
"correlationId": "3591e033-cfb7-11ec-951a-75c1535081ae",
"external_correlationId": "0ad01109-b278-4a69-910d-7acf7db24bab",
"tenantRecord": "true"
},
"logger": "com.optum.hcm.kafka.streams.ECRProcessor",
"message": "processing ecr kafka message with key, correlationId : 0.2.16, 3591e033-cfb7-11ec-951a-75c1535081ae",
"context": "default"
}
I am trying to understand the behavior of in case the processing time took why the same message is getting processed again and again by different thread?
Also if the consumer(Stream Thread) is removed after max.poll.interval.ms and all assigned task are given to another thread, when it's determined to bring the original consumer(Stream thread) back? Will original consumer reprocess the record?

Send proactive chat message to initiator of Microsoft Teams Calling Bot voice caller

I have a teams bot that can answer 1-to-1 voice calls. During the call I want the bot to be able to send chat messages to the user and be able to reference user data (like their name).
Although an incoming call does have a encrypted source identity, from my experiments it appears this is not a valid user id for proactive messaging.
Interestingly enough this is easily possible in group calls as it starts passing you participant lists (which i've done before), but 1-to-1 calls appear to rely on the source field which effectively leaves the user as anonymous.
{
"#odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"#odata.type": "#microsoft.graph.commsNotification",
"changeType": "created",
"resource": "/app/calls/4a1f2c00-831f-4e4e-9d7c-1648b6dddb73",
"resourceUrl": "/communications/calls/4a1f2c00-831f-4e4e-9d7c-1648b6dddb73",
"resourceData": {
"#odata.type": "#microsoft.graph.call",
"state": "incoming",
"direction": "incoming",
"callbackUri": "https://...",
"source": {
"#odata.type": "#microsoft.graph.participantInfo",
"id": "7684a0ea-7db6-4f3e-a339-eb46e16d57f0",
"identity": {
"#odata.type": "#microsoft.graph.identitySet",
"encrypted": {
"#odata.type": "#microsoft.graph.identity",
"id": "1g7qrdwga2udafuebrjcyobchnq7r4xigupowjluuccfdceufmew6ush6wlx-kellf96ky2nnhsl084rn6vegqmwawiqpux0kk5aw5lqq9oydrewxe9awkrk_uh_0nxat", // <-- not a valid chat user
"tenantId": "{tenancyId}",
"identityProvider": "None"
}
},
"endpointType": "default",
"region": "apac",
"languageId": "en-us"
},
"targets": [
{
"#odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"#odata.type": "#microsoft.graph.identitySet",
"application": {
"#odata.type": "#microsoft.graph.identity",
"id": "a2716ab5-9b38-4364-8869-b9b8deeff897",
"identityProvider": "AAD"
}
},
"endpointType": "default",
"id": "023126f0-904f-4c01-a78d-03f28e77e7a7",
"region": null,
"languageId": null
}
],
"tenantId": "{Azure Tenancy}",
"myParticipantId": "023126f0-904f-4c01-a78d-03f28e77e7a7",
"callChainId": "37de77c7-54b3-4d04-9e9c-181e5f5b5773",
"incomingContext": {
"#odata.type": "#microsoft.graph.incomingContext",
"sourceParticipantId": "7684a0ea-7db6-4f3e-a339-eb46e16d57f0"
},
"id": "4a1f2c00-831f-4e4e-9d7c-1648b6dddb73"
}
}
]
}
Yes, we can able to send the chat messages by creating Responder Call handler from bot.
Could you please try to implement the sample code.
In the sample code, will have a class named "ResponderCallHandler.cs", please have a look.

How to handle or create the model class for the data receiving from kafka which is emitted from neo4j streams?

i am trying to understand the receiving model from the kafka which is emitted from neo4j streams to one kafka topic.
Actually that data is looing like below.
{
"meta": {
"timestamp": 1608725179199,
"username": "neo4j",
"txId": 16443,
"txEventId": 0,
"txEventsCount": 1,
"operation": "created",
"source": {
"hostname": "9945"
}
},
"payload": {
"id": "1000",
"before": null,
"after": {
"properties": {
"name": "sdfdf"
},
"labels": [
"aaq"
]
},
"type": "node"
},
"schema": {
"properties": {
"name": "String"
},
"constraints": []
}
}
so to consume this type of complex structured data in springboot from kafka we need to create nested model?
i mean nearly 4 classes nested each other?
From my understanding i am trying to create the below classes.
meta (**This is 1st class**)
"operation": "created",
payload(**This is 2ndclass which is nested inside the Meta**)
id
before
after(**it is 3rd class which is nested to payload**)
properties(**it is 4th class which is nested with in after**)
these data only we needed to store
labels
type
Actually i didn't faced thee kind of nested issue before so don't have idea to procees?
so is the above method is right or any other possiblities are there?
Have to consume the data from kafka topic which is emitted by neo4j streams is the ultimate goal?
Language : Java
Framework: Springboot

Magento 2 Klarna checkout

I need to integrate the Klarna Checkout module into magento 2.1.2. I am using the version of the "klarna/m2-checkout module": 4.2.2.
When choosing a delivery method, I always get an error in the pop-up window:
Sorry, the delivery option you chose cannot be processed. Please select another delivery option.
When i choose shipping method, i get this responce:
{
"shared": {
"customer": {
"type": "person"
},
"user_preferences": {
"remember_me": true
},
"language": "en",
"locale": "en-US",
"customer_details": {
"client_token": "eyJhbGciOiJSUzUxMiJ9.eyJz",
"country": "swe",
"completed": true,
"fields_with_obfuscation": {
"email": "melosicuva#royalhost.info",
"given_name": "Testperson-se",
"family_name": "Approved",
"street_address": "Stårgatan 1",
"postal_code": "123 45",
"city": "Ankeborg",
"country": "SE",
"phone": "076-526 00 00",
"date_of_birth": "1941-03-21",
"national_identification_number": "19410321-9202"
},
"reference": "2f9a445a57a49215175178099002fc7165ee"
},
"shipping_details": {
"client_token": "eyJhbGciOiJSUzUxMiJ9.eyJzZXNzaW9uX"
},
"currency": "SEK",
"obfuscated_fields": []
},
"cart": {
"total_tax_amount": 30000,
"total_price_including_tax": 150000,
"total_price_excluding_tax": 120000,
"total_shipping_amount_excluding_tax": 0,
"total_surcharge_amount_excluding_tax": 0,
"total_discount_amount_excluding_tax": 0,
"total_shipping_amount_including_tax": 0,
"total_surcharge_amount_including_tax": 0,
"total_discount_amount_including_tax": 0,
"subtotal": 120000,
"total_store_credit": 0,
"items": [{
"type": "physical",
"reference": "1201018390010",
"name": "Armour Bib Shorts",
"quantity": 1,
"unit_price": 150000,
"total_tax_amount": 30000,
"tax_rate": 2500,
"total_price_including_tax": 150000,
"total_price_excluding_tax": 120000,
"product_url": "https://local.com/armour-bib-shorts-black.html?___store%5B_data%5D%5Bstore_id%5D=2&___store%5B_data%5D%5Bcode%5D=se&___store%5B_data%5D%5Bwebsite_id%5D=2&___store%5B_data%5D%5Bgroup_id%5D=2&___store%5B_data%5D%5Bname%5D=Sweden+Store&___store%5B_data%5D%5Bsort_order%5D=30&___store%5B_data%5D%5Bis_active%5D=1&___store%5B_data%5D%5Balias%5D=Sweden&___store%5B_data%5D%5Bavailable_currency_codes%5D%5B0%5D=SEK",
"image_url": "https://local.com//media/catalog/product/a/r/armour-bib-shorts-aw18-01.jpg"
}]
},
"errors": {
"generic": ["shipping_service_failed"]
},
"options": {
"allow_separate_shipping_address": false,
"date_of_birth_mandatory": false,
"title_mandatory": false,
"national_identification_number_mandatory": false,
"phone_mandatory": true,
"allowed_customer_types": ["person"],
"payment_selector_on_load": false
},
"preview_payment_methods": [{
"id": "-1",
"type": "invoice",
"locked": false,
"selected": false,
"data": {
"days": 14
}
}, {
"id": "-1",
"type": "direct_debit",
"locked": false,
"selected": false
}, {
"id": "-1",
"type": "credit_card",
"locked": false,
"selected": false,
"data": {
"available_cards": ["VISA", "MASTER"],
"allow_saved_card": false,
"do_save_card": false,
"collect_consent": false,
"consent_given": false
}
}],
"allowed_billing_countries": ["swe"],
"status": {
"prescreened": false
},
"analytics_user_id": "ELmpDn1f600JYxHtagC7FcsOdAXe9-2iwWhIzHSfmhM=",
"merchant": {
"hashed_id": "a9c814c7a780d46a7fb2403e452829b3",
"name": "Your business name"
},
"merchant_urls": {
"checkout": "https://local.com/checkout/klarna",
"confirmation": "https://checkout-eu.playground.klarna.com/yaco/orders/ffc4101d-00cb-5e63-81fc-0f0c15baeac3/redirect?auth_token=0el7mltb89prfz2fz2mw",
"terms": "https://local.com/terms",
"confirmation_page": "https://local.com/checkout/klarna/confirmation/id/ffc4101d-00cb-5e63-81fc-0f0c15baeac3"
}
}
Here I do not like the block:
"errors": {
"generic": ["shipping_service_failed"]
}
Does anyone know how to fix it?
Delivery error :
This error occurs when you set address_update callback and and it's not handled in the right way. This callback should be set if you need to update order's addresses, and should not take more than 10 sec.
Here's an example: https://developers.klarna.com/api/#checkout-api-callbacks-address-update
And some best practices: https://developers.klarna.com/documentation/klarna-checkout/best-practices/#address-updated
If you run Klarna Checkout on localhost, then you should make the localhost-based application reachable from Klarna via the HTTP protocol (e.g., for the address_update callback).
You can do it via services like Ngrok.
In case of this error it's good to know that:
Klarna Checkout is calling callbacks regarding the shipping on checkout page:
address_update
shipping_option_update
If Klarna doesn't receive the answer from callback request in 10s it will end the connection and eventually you will see the error message. You can find access status logs in your http server, for example access status 499 in nginx. On the other hand in Klarna Merchant Portal you will see logs with status "???".
The callback request may be not accessible or not accessible in time below 10s:
if you work on localhost configure tunnel to expose your local environment to be visible by Klarna. For example with ngrok.
make sure that magento cache is enabled.
disable xdebug (unless it's version >=3)
check internet connection quality
check php.ini and http server performance related settings
If error still occurs you can debug the callback api to find the bottleneck. For example you can use logs in Klarna Merchant Portal to create a postman request to the callback api.

MobileFirst create wrong SMS request

IBM MobileFirst Platform Foundation 8.0.0.
After configuring SMS settings I am trying to send a message but the request is created in the wrong way. See the result below.
//REST API : send notification request
{
"message": {
"alert": "Hello World from an SMS message"
},
"notificationType":3,
"target" : {
"deviceIds" : ["9a149c24-8859-3383-6067-d161e46d2554"]
}
}
The created request:
473607:[2017-01-02 16:44:02.494] - [440093822] Request received: HTTP GET /send.aspx?
encode=false&name=toParamName&value=Recipients&encode=false&name=textParamName&value=MessageText&encode=false&name=MessageType&value=text&encode=false&name=SenderName&value=PLIX&encode=false&name=UserName&value=MahmoudSamy&encode=true&name=Password&value=xyz&to=20100051111&text=Hello+World+from+an+SMS+message+2
//SMS settings
{
"port": "80",
"programName": "/sendsms",
"host": "xyz.com",
"name": "SMSGateway",
"parameters": [
{
"encode": "false",
"name": "toParamName",
"value": "to"
},
{
"encode": "false",
"name": "textParamName",
"value": "text"
},
{
"encode": "false",
"name": "SenderName",
"value": "Support"
},
{
"encode": "false",
"name": "UserName",
"value": "xyz"
},
{
"encode": "false",
"name": "Password",
"value": "xyz"
}
]
}
We tried to send SMS with SMS settings shared by you.
We are able to get correct value pair in the created request.
Below is the created request
GET /gateway/add.php?encode=false&name=toParamName&value=to&encode=false&name=textParamName&value=text&encode=false&name=SenderName&value=Support&encode=false&name=UserName&value=xyz&encode=false&name=Password&value=xyz&to=99&text=Hello+World+from+an+SMS+message HTTP/1.1
Also in created request shared by you, I am noticing different username value than given in sms settings.
Could you please tell us how you are checking the request. We are using wireshark to capture.
the below configuration works with me but it force me to accept to and text parameters.
{
"port": "80",
"programName": "/sendsms",
"host": "xyz.com",
"name": "SMSGateway",
"parameters": [{
"SenderName": "Support",
"MessageType": "text",
"UserName": "xyz",
"Password": "xyz"
}]
}
HTTP GET /send.aspx?SenderName=Support&MessageType=text&UserName=xyz&Password=xyz&to=083127312763&to=hello+world

Resources