我已經在2個分區(0和1)的Azure門戶中創建了一個事件中心。由於在服務總線等事件中心沒有任何主題概念。我試圖存儲在分區0和分區1不同的數據使用Azure Event Hub中是否有類似於Azure Service Bus Topics的內容?
ehClient = EventHubClient.createFromConnectionStringSync(eventHubConnectionString.toString());
byte[] payload = "Storing data in partion 0".getBytes("UTF-8");
/** Storing data in partion 0*/
EventData data = new EventData(payload);
ehClient .send(data, "0");
即使我試圖存儲在分區0是默認的數據得到存儲在分區1.
我recieiver邏輯是:
eventHubClient = EventHubClient.create(Constant.EVENTHUB_SASKEYNAME,
Constant.EVENTHUB_SASKEY, Constant.EVENTHUB_NAMESPACE, Constant.EVENTHUB_NAME);
EventHubConsumerGroup eventHubConsumerGroup = eventHubClient.getConsumerGroup("$Default");
eventHubReceiver = eventHubConsumerGroup.createReceiver("0", null, -1);
while (true) {
message = eventHubReceiver.receive(-1);
if (null != message)
System.out.println("The message that is delivered is : " + message.getPayload());
else
System.out.println("No message in the hub");
}
這是將數據存儲在分區中的正確方法嗎?我們可以使用分區等同於Azure服務總線主題嗎?
沒有,看http://stackoverflow.com/questions/42255265/how-are-different-events-handled-in-azure-event-hubs –