简体   繁体   English

如何使用Azure Notification Hubs从事件中心接收消息并转发到android应用程序?

[英]How to receive messages from event hub and forward to android application using Azure Notification Hubs?

I want to receive messages from an event hub in .net and sending them to my android application (with notification hub). 我想从.net中的事件中心接收消息,并将其发送到我的android应用程序(带有通知中心)。

At the moment, I receive the messages from the event hub using Event processor . 目前,我使用事件处理器从事件中心接收消息

Now I want to forward them to my android application. 现在,我想将它们转发到我的android应用程序。 What is the best way to complete this? 完成此操作的最佳方法是什么?

You're asking a very generic question, so I'm giving a very generic answer. 您在问一个非常普通的问题,所以我给一个非常普通的答案。 If you'd like more information, please provide more details. 如果您需要更多信息,请提供更多详细信息。

The general model would probably be something like this: 通用模型可能是这样的:

  1. You need to 'register' every device that you would like to push to in the future. 您需要“注册”将来要推送到的每个设备
  2. Then somehow when the messages get into the event hub whoever sends them there needs to provide either an ID or a tag of the device(s) to send a push to. 然后,无论如何,当消息进入事件中心时,无论向谁发送消息,都需要提供ID或设备标签以向其发送推送。
  3. When you know the ID/tag, send a push from your back-end . 当您知道ID /标签后, 请从后端发送推送

I'd recommend linking your Event Hub with Notification Hubs via an Azure Function. 我建议通过Azure函数将事件中心与通知中心链接。

Step 1: Your Android device must register with the FCM to get a device token and then register the device with Notification Hubs. 步骤1:您的Android设备必须在FCM中注册以获得设备令牌,然后在Notification Hubs中注册该设备。 Since we are going to be dealing with Azure Functions, which is based on App Service, you can use App Service Push for this functionality - this will require a "HTTP POST" to the endpoint. 由于我们将要处理基于App Service的Azure Functions,因此您可以使用App Service Push来实现此功能-这将需要对端点的“ HTTP POST”。 See http://aka.ms/zumobook Chapter 5 for a Xamarin implementation of this. 有关此的Xamarin实现,请参见http://aka.ms/zumobook第5章。

Step 2: Create an Azure Function to link the event hub, do whatever processing you need and submit a push notification to the Notification Hub. 步骤2:创建一个Azure函数来链接事件中心,执行所需的任何处理,然后向通知中心提交推送通知。 See https://docs.microsoft.com/en-us/azure/azure-functions/ for the documentation source on this. 有关此文档的来源,请参见https://docs.microsoft.com/zh-cn/azure/azure-functions/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将数据从 android java 发送到 azure 事件中心 - How are send data from android java to azure event hubs 适用于 Android 的 Azure 通知中心:如何使用后台服务处理数据消息? - Azure Notification Hubs for Android: How do I handle Data-Messages with a Background-Service? 无法使用azure通知集线器接收特定的用户推送通知 - Cannot receive specific user push notification using azure notification hub 从Android进行Azure通知中心注册 - Azure Notification Hub Registration from Android 如何为Android中的Azure事件中心生成SAS令牌 - How to generate SAS Token for Azure Event Hubs in Android 具有Azure通知中心的Android FCM错误FirebaseInstanceId - Android FCM with Azure Notification Hubs Error FirebaseInstanceId 无法使用Azure Notification Hub在Android上发送通知 - Unable to send notification on android using Azure Notification Hub 来自Android的Azure Event Hub授权 - Azure Event Hub Authorization from Android 来自Azure通知中心的Null参考异常 - Null Reference Exception From Azure Notification Hubs 使用事件中心从 Android 上的 IoT 中心接收遥测数据。对于 IOT HUB 中的特定设备 - Receive telmetry from IoT hub on Android with Event Hub .for particular Device in IOT HUB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM