无法在分区中设置检查点

编程入门 行业动态 更新时间:2024-10-27 08:35:20
本文介绍了无法在分区中设置检查点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用此示例( docs.microsoft/zh-cn/azure/event-hubs/event-hubs-node-get-started-send ),但我无法读取未读数据只要.还有一件事,我得到两个不同的错误

I am trying to use this sample (docs.microsoft/en-us/azure/event-hubs/event-hubs-node-get-started-send) but I am not able to read unread data only. One more thing I am getting two different error

1)连接ETIMEDOUT 40.112.242.0:5671

1) connect ETIMEDOUT 40.112.242.0:5671

2)更新检查点时租约丢失

2) lease lost while updating checkpoint

在node js示例中,我无法设置检查点.我也尝试过Azure/azure-sdk-for-js.但是它显示了上面列出的相同错误.

In the node js sample, I am not able to set checkpoints. I have tried Azure/azure-sdk-for-js as well. But it is showing the same error listed above.

当我也运行core示例时,它们运行正常,所以我不明白为什么节点js示例运行不正常?

When I have also run core sample then they are working fine so I am not getting why node js sample is not working fine?

能否请您指导我如何解决此问题,以解决未读的只读数据和新数据?

Can you please guide me on how can fix this issue to read-only unread and new data?

推荐答案

对于node.js,请使用以下代码设置检查点,它对我而言效果很好:

For node.js, please use the code below to set checkpoint, it works well at my side:

const { EventProcessorHost, delay } = require("@azure/event-processor-host"); //your eventhub name const path = "myeventhub"; //your azure storage connection string const storageCS = "DefaultEndpointsProtocol=https;AccountName=xx;AccountKey=xx;EndpointSuffix=core.windows"; //your eventhub namespace connectionstring const ehCS = "Endpoint=sb://xxx.servicebus.windows/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxx" //your blob storage container name const storageContainerName = "test6"; async function main() { // Create the Event Processo Host const eph = EventProcessorHost.createFromConnectionString( EventProcessorHost.createHostName("my-host"), storageCS, storageContainerName, ehCS, { eventHubPath: path } ); let count = 0; // Message event handler const onMessage = async (context/*PartitionContext*/, data /*EventData*/) => { console.log(">>>>> Rx message from '%s': '%s'", context.partitionId, data.body); count++; return await context.checkpoint(); }; // Error event handler const onError = (error) => { console.log(">>>>> Received Error: %O", error); }; // start the EPH await eph.start(onMessage, onError); // After some time let' say 2 minutes await delay(120000); // This will stop the EPH. await eph.stop(); } main().catch((err) => { console.log(err); });

我可以看到在blob容器中检查点设置正确:

And I can see the checkpoint is set correctly in blob container:

更多推荐

无法在分区中设置检查点

本文发布于:2023-07-27 23:19:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1225246.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:检查点   区中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!