如何解决无法使用 Kubernetes 中的 Dapr Pubsub 块将消息发布到 RabbitMQ
我正在使用 Dapr .NET SDK
并使用 PublishAsync
方法将消息发布到 RabbitMQ
。
我希望消息能顺利发布。我在 Kubernetes
中使用它。代码可以在 DaprPubsub
RabbitMQ 的配置很完美。组件定义是完美的。 Dapr SDK 可以到达RabbitMQ。实际上,在 RabbitMQ 交换中,我能够使用主题名称的名称创建 find an exchange
,但是没有创建队列,并且我打算放入队列的消息没有添加到队列中。
使用上面提供的代码链接在 local K8s cluster
上重现问题的步骤如下
- 使用
RabbitMQ
在Kubernetes
集群中安装Helm
Link - 使用 AMQP 配置更新组件文件。
- 将组件应用在与代码相同的命名空间中
- 部署代码。
- 执行
Kubectl
获取svc,获取服务daprpub的Loadbalancer外部IP。端口将为 5045。 - 假设外部 IP 类似于
localHost
。访问网址 作为 http://localHost:5045/swagger。将显示 swagger 页面 - 在 Swagger UI 中访问 Put in queue 方法。该方法无异常地执行。
其他日志
[40m[37mdbug[39m[22m[49m: Microsoft.Extensions.Hosting.Internal.Host[1]
Hosting starting
[40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[0]
Loaded hosting startup assembly DaprPub
[40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
[40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
[40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
Content root path: /app
[40m[37mdbug[39m[22m[49m: Microsoft.Extensions.Hosting.Internal.Host[2]
Hosting started
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[6]
Connection id "0HMAFT1T14KEF" received FIN.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HMAFT1T14KEF" accepted.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HMAFT1T14KEF" started.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HMAFT1T14KEG" accepted.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HMAFT1T14KEG" started.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[7]
Connection id "0HMAFT1T14KEF" sending FIN because: "The client closed the connection."
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[10]
Connection id "0HMAFT1T14KEF" disconnecting.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HMAFT1T14KEF" stopped.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://127.0.0.1:80/dapr/config application/json -
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware[0]
Wildcard detected,all requests with hosts will be allowed.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1000]
No candidates found for the request path '/dapr/config'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[2]
Request did not match any endpoints
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[3]
The request path does not match the path filter
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[9]
Connection id "0HMAFT1T14KEG" completed keep alive response.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://127.0.0.1:80/dapr/config application/json - - 404 0 - 43.9120ms
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://127.0.0.1:80/dapr/subscribe application/json -
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1001]
1 candidate(s) found for the request path '/dapr/subscribe'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[1]
Request matched endpoint 'dapr/subscribe HTTP: GET'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[15]
Static files was skipped as the request already matched an endpoint.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'dapr/subscribe HTTP: GET'
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'dapr/subscribe HTTP: GET'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[9]
Connection id "0HMAFT1T14KEG" completed keep alive response.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://127.0.0.1:80/dapr/subscribe application/json - - 200 - application/json 14.5314ms
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[6]
Connection id "0HMAFT1T14KEG" received FIN.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[7]
Connection id "0HMAFT1T14KEG" sending FIN because: "The client closed the connection."
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[10]
Connection id "0HMAFT1T14KEG" disconnecting.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HMAFT1T14KEG" stopped.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HMAFT1T14KEH" accepted.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HMAFT1T14KEH" started.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HMAFT1T14KEI" accepted.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HMAFT1T14KEI" started.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:5045/dapr/subscribe - -
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1001]
1 candidate(s) found for the request path '/dapr/subscribe'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[1]
Request matched endpoint 'dapr/subscribe HTTP: GET'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[15]
Static files was skipped as the request already matched an endpoint.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'dapr/subscribe HTTP: GET'
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'dapr/subscribe HTTP: GET'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[9]
Connection id "0HMAFT1T14KEH" completed keep alive response.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://localhost:5045/dapr/subscribe - - - 200 - application/json 1.3339ms
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[6]
Connection id "0HMAFT1T14KEI" received FIN.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[7]
Connection id "0HMAFT1T14KEI" sending FIN because: "The client closed the connection."
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[10]
Connection id "0HMAFT1T14KEI" disconnecting.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HMAFT1T14KEI" stopped.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[10]
Connection id "0HMAFT1T14KEH" disconnecting.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HMAFT1T14KEH" stopped.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[7]
Connection id "0HMAFT1T14KEH" sending FIN because: "The Socket transport's send loop completed gracefully."
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HMAFT1T14KEJ" accepted.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HMAFT1T14KEJ" started.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HMAFT1T14KEK" accepted.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HMAFT1T14KEK" started.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:5045/swagger/index.html - -
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1000]
No candidates found for the request path '/swagger/index.html'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[2]
Request did not match any endpoints
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[9]
Connection id "0HMAFT1T14KEJ" completed keep alive response.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://localhost:5045/swagger/index.html - - - 200 - text/html;charset=utf-8 66.3495ms
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:5045/swagger/v1/swagger.json - -
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1000]
No candidates found for the request path '/swagger/v1/swagger.json'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[2]
Request did not match any endpoints
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[9]
Connection id "0HMAFT1T14KEJ" completed keep alive response.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://localhost:5045/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 34.8034ms
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:5045/api/Publish/PutInQueue - -
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1001]
1 candidate(s) found for the request path '/api/Publish/PutInQueue'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1005]
Endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)' with route pattern 'api/Publish/PutInQueue' is valid for the request path '/api/Publish/PutInQueue'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[1]
Request matched endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[15]
Static files was skipped as the request already matched an endpoint.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderFactory[12]
Registered model binder providers,in the following order: Dapr.AspNetCore.StateEntryModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ServicesModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.HeaderModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.FloatingPointTypeModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.EnumTypeModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DateTimeModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.SimpleTypeModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.CancellationTokenModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.FormFileModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.FormCollectionModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.keyvaluePairModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ArrayModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.CollectionModelBinderProvider,Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexObjectModelBinderProvider
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
Route matched with {action = "GetDapr",controller = "Publish"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] GetDapr() on controller DaprPub.Controllers.PublishController (DaprPub).
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[1]
Execution plan of authorization filters (in the following order): None
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[1]
Execution plan of resource filters (in the following order): None
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[1]
Execution plan of action filters (in the following order): Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter (Order: -3000),Microsoft.AspNetCore.Mvc.Infrastructure.ModelStateInvalidFilter (Order: -2000)
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[1]
Execution plan of exception filters (in the following order): None
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[1]
Execution plan of result filters (in the following order): Microsoft.AspNetCore.Mvc.Infrastructure.ClientErrorResultFilter (Order: -2000)
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[1]
Executing controller factory for controller DaprPub.Controllers.PublishController (DaprPub)
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
Executed controller factory for controller DaprPub.Controllers.PublishController (DaprPub)
[40m[32minfo[39m[22m[49m: DaprPub.Controllers.PublishController[0]
Successfully published message in queue
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.StatusCodeResult[1]
Executing HttpStatusCodeResult,setting HTTP status code 200
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
Executed action DaprPub.Controllers.PublishController.GetDapr (DaprPub) in 98.2819ms
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[9]
Connection id "0HMAFT1T14KEJ" completed keep alive response.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://localhost:5045/api/Publish/PutInQueue - - - 200 0 - 128.8929ms
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[6]
Connection id "0HMAFT1T14KEK" received FIN.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[10]
Connection id "0HMAFT1T14KEK" disconnecting.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HMAFT1T14KEK" stopped.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[7]
Connection id "0HMAFT1T14KEK" sending FIN because: "The Socket transport's send loop completed gracefully."
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[10]
Connection id "0HMAFT1T14KEJ" disconnecting.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HMAFT1T14KEJ" stopped.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[7]
Connection id "0HMAFT1T14KEJ" sending FIN because: "The Socket transport's send loop completed gracefully."
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HMAFT1T14KEL" accepted.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HMAFT1T14KEL" started.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:5045/api/Publish/PutInQueue - -
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1001]
1 candidate(s) found for the request path '/api/Publish/PutInQueue'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1005]
Endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)' with route pattern 'api/Publish/PutInQueue' is valid for the request path '/api/Publish/PutInQueue'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[1]
Request matched endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[15]
Static files was skipped as the request already matched an endpoint.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)'
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
Route matched with {action = "GetDapr",setting HTTP status code 200
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
Executed action DaprPub.Controllers.PublishController.GetDapr (DaprPub) in 4.441ms
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'DaprPub.Controllers.PublishController.GetDapr (DaprPub)'
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[9]
Connection id "0HMAFT1T14KEL" completed keep alive response.
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://localhost:5045/api/Publish/PutInQueue - - - 200 0 - 6.3650ms
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[10]
Connection id "0HMAFT1T14KEL" disconnecting.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HMAFT1T14KEL" stopped.
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel.Transport.sockets[7]
Connection id "0HMAFT1T14KEL" sending FIN because: "The Socket transport's send loop completed gracefully."
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。