Azure Event Grid Subscriptions on custom topic in different resource group - azure-eventgrid

I am trying to subscribe to a custom event grid topic that exists on a different resource group. For example if I have a custom event grid topic my-custom-topic in a resource group publisher-group. How do I create an event grid subscription to my topic from within the resource group subscriber-group?
The following ARM template only works if the my-custom-topic is in the same resource group that I am applying the template too
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"eventGridSubscriptionName": {
"type": "String",
"metadata": {
"description": "The name of the Event Grid custom topic's subscription."
}
},
"location": {
"defaultValue": "[resourceGroup().location]",
"type": "String",
"metadata": {
"description": "The location in which the Event Grid resources should be deployed."
}
}
},
"resources": [
{
"type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
"apiVersion": "2018-01-01",
"name": "[concat('my-custom-topic', '/Microsoft.EventGrid/', parameters('eventGridSubscriptionName'))]",
"location": "[parameters('location')]",
"properties": {
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "..."
}
},
"filter": {
"includedEventTypes": [
"All"
]
}
}
}
]
}
If I change name to be a the full path of the topic (e.g. subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/resourceGroups/publisher-group/providers/Microsoft.EventGrid/topics/my-custom-topic) then the template complains I have too many segments
I would have thought this was a very common use case having topics and subscriptions in different resource groups but I am unable to find concrete examples of this
How do I create an ARM template to subscribe to an event grid topic on a different resource group?

This isn't possible - Event Grid Topics and Subscriptions have to be in the same resource group.
I would suggest creating a separate resource group just for containing your Event Grid Topic and all of it's Subscriptions.
Logically you shouldn't think of a single event publisher as owning the Event Grid Topic it publishes to - rather think of a Topic as a shared resource which many publishers and subscribers depend on.

Related

Unable to Launch Alexa Hosted Skill which was created using Fact Skill template

Unable to Launch Alexa Hosted Skill which was created using Fact Skill template. This is a custom skill written in Python. I haven't changed any code except the class name of Launch Request handler.
class GetNewQuestionHandler(AbstractRequestHandler)
Above mentioned class is supposed to handle the Launch request, however request doesn't hit this code as I don't see any log printed from this class. CatchAllExceptionHandler also doesn't print any log.
Intent handlers and exception handlers are registered like this:
sb.add_request_handler(GetNewQuestionHandler())
sb.add_exception_handler(CatchAllExceptionHandler())
Here is the response json -
{
"header": {
"namespace": "SkillDebugger",
"name": "CaptureError",
"messageId": ""
},
"payload": {
"code": "SKILL_ENDPOINT_ERROR",
"description": "Skill execution returned an exception for requestId abcd",
"debuggingInfo": {
"type": "SkillExecutionInfo",
"content": {
"invocationRequest": {
"body": {
"version": "1.0",
"session": {
},
"context": {},
"request": {
"type": "SessionEndedRequest",
"reason": "ERROR",
"error": {
"type": "INTERNAL_SERVICE_ERROR",
"message": "Can't find skill bundle metadata for skillId abc locale xyz stage development"
}
}
}
}
}
}
}
}
Please let me know what is the issue with this skill.
Note: Please let me know in case any other info is required.

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

Merge profile based on 2 property in Apache-Unomi

I am trying to build an customize logic in action for profile merging, can anybody suggest me how to create a rule where I can merge profile based on email and phone-number, as of now I am able to do with only one property value email. you can find the sample rule below in code :
"metadata": {
"id": "exampleLogin",
"name": "Example Login",
"description": "Copy event properties to profile properties on login"
},
"condition": {
"parameterValues": {
"subConditions": [
{
"type": "eventTypeCondition",
"parameterValues": {
"eventTypeId": "click"
}
}
],
"operator": "and"
},
"type": "booleanCondition"
},
"actions": [
{
"parameterValues": {
"mergeProfilePropertyValue": "eventProperty::target.properties(email)",
"mergeProfilePropertyName": "mergeIdentifier"
},
"type": "mergeProfilesOnPropertyAction"
},
{
"parameterValues": {
},
"type": "allEventToProfilePropertiesAction"
}
]
}
In order to be able to merge based on multiple identifiers you would have to extend the default built-in action to support that.
This can be done by creating a module but it will require some Java knowledge since this is how Unomi is implemented.
The code for the default merge action is available here:
https://github.com/apache/unomi/blob/master/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java

Azure IoT event subscription with ARM template

I am trying to deploy Azure IoT device connected event subscription to Azure storage queue using ARM template and PowerShell. I have used the following template for deploying this. Also, I have read a lot of articles on Microsoft. But could not find any solution. Please help me to figure it out.
"resources": [
{
"type": "Microsoft.EventGrid/eventSubscriptions",
"name": "DeviceConnected",
"location": "[resourceGroup().location]",
"apiVersion": "2018-01-01",
"dependsOn": [
"[resourceId('Microsoft.Devices/IotHubs', variables('iotHubName'))]"
],
"properties": {
"destination": {
"endpointType": "storagequeue",
"properties": {
"queueName":"device-connnection-state-queue",
"resourceId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageName'))]"
}
},
"filter": {
"includedEventTypes": [
"Microsoft.Devices.DeviceConnected"
]
}
}
}
],
The error is showing like
The error you're seeing is related to the dependsOn property you've specified.
From MS documentation
Resources that must be deployed before this resource is deployed. Resource Manager evaluates the dependencies between resources and deploys them in the correct order. When resources aren't dependent on each other, they're deployed in parallel. The value can be a comma-separated list of a resource names or resource unique identifiers. Only list resources that are deployed in this template. Resources that aren't defined in this template must already exist. Avoid adding unnecessary dependencies as they can slow your deployment and create circular dependencies. For guidance on setting dependencies, see Defining dependencies in Azure Resource Manager templates.
So a resource that is not defined in an ARM template cannot be used in a DependsOn property.
Here is the documentation related to event subscription creation:
Microsoft.EventGrid eventSubscriptions template reference
There are not so much samples on how to create event subscription but you can extract some part of the template from the Azure Portal:
Click + Event Subscription
Fill in the details
Click the Advanced Editor button link on the top right corner
It will show you some of the details you need to create your ARM Template
Here is how a sample ARM template can look likes:
"resources": [
{
"type": "Microsoft.Devices/IotHubs/providers/eventSubscriptions",
"apiVersion": "2019-01-01",
"name": "[concat(parameters('iotHubName'), '/Microsoft.EventGrid/', parameters('eventSubName'))]",
"location": "[resourceGroup().location]",
"properties": {
"topic": "[resourceId('Microsoft.Devices/IotHubs', parameters('iotHubName'))]",
"destination": {
"endpointType": "StorageQueue",
"properties": {
"resourceId": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
"queueName": "[parameters('queueName')]"
}
},
"filter": {
"includedEventTypes": [
"Microsoft.Devices.DeviceConnected"
],
"advancedFilters": []
},
"labels": [],
"eventDeliverySchema": "EventGridSchema"
}
}
]

How do we get to know to which response user has reacted(like/dislike) on MS teams?

We need help in understanding how Microsoft teams like and dislike works with BotFramework. When user clicks on like option provided in background we are getting reactionID but how do we get to know for which specific message user has given his feedback. Do we have this feasibility on Teams?
You can find it in the replyToId. Example from the docs:
The messageReaction event is sent when a user adds or removes his or her reaction to a message which was originally sent by your bot. replyToId contains the ID of the specific message.
{
"reactionsAdded": [
{
"type": "like"
}
],
"type": "messageReaction",
"timestamp": "2017-10-16T18:45:41.943Z",
"id": "f:9f78d1f3",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/",
"from": {
"id": "29:1I9Is_Sx0O-Iy2rQ7Xz1lcaPKlO9eqmBRTBuW6XzkFtcjqxTjPaCMij8BVMdBcL9L_RwWNJyAHFQb0TRzXgyQvA",
"aadObjectId": "c33aafc4-646d-4543-9d4c-abd28e4d2110"
},
"conversation": {
"isGroup": true,
"id": "19:3629591d4b774aa08cb0887902eee7c1#thread.skype"
},
"recipient": {
"id": "28:f5d48856-5b42-41a0-8c3a-c5f944b679b0",
"name": "SongsuggesterLocal"
},
"channelData": {
"channel": {
"id": "19:3629591d4b774aa08cb0887902eee7c1#thread.skype"
},
"team": {
"id": "19:efa9296d959346209fea44151c742e73#thread.skype"
},
"tenant": {
"id": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
},
"replyToId": "1:19uJ8TZA1cZcms7-2HLOW3pWRF4nSWEoVnRqc0DPa_kY"
}
Note, however, that this replyToId is specific to Teams and I don't believe it will persist if you set it yourself. Once you have that, you can update the activity.
If you're trying to analyze which messages are reacted to, you might want to log the outgoing activity's Id and Text in TurnContext.OnSendActivities. Then, when a reaction comes in, you can use the new Activity Handler to handle the message and add the reaction to your log. I believe this would come in OnUnrecognizedActivityTypeAsync. This is similar to the previous link, update the activity.

Resources