大众运输临时队列 [英] Masstransit temporary queue

查看:44
本文介绍了大众运输临时队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用masstransit和Rabbitmq的客户端应用程序.在应用程序启动时,我正在创建具有唯一名称的新队列,以便通过masstransit(请求/响应模型)与服务器应用程序进行通信.在关闭应用程序时,我应该删除此队列,但是如果客户端应用程序崩溃,则Rabbitmq上将出现队列.

I'm developing client application which use masstransit and rabbitmq. On application start I'm creating new queue with unique name for communication with server applications via masstransit(request/response model). On application closing I should delete this queue, but if client application crushes queue will present on rabbitmq.

是否可以通过masstransit创建临时队列,当客户端与队列断开连接时,Rabbitmq会自动删除该临时队列?

Is it possible to create temporary queue via masstransit which rabbitmq will automatically delete when client disconnects from queue?

推荐答案

您可以使用?temporary=true查询字符串参数创建一个临时队列.

You can create a temporary queue by using the ?temporary=true query string parameter.

使用RabbitMQ,您还可以通过使用*作为队列名称来动态创建队列名称.如:

With RabbitMQ, you can also dynamically create the queue name by using * as the queue name. Such as:

x.ReceiveFrom("rabbitmq://localhost/vhost/*?temporary=true");

这将创建一个具有随机生成名称的临时队列,该名称在连接关闭时将被删除.

This would create a temporary queue with a randomly generated name that is deleted when the connection is closed.

这篇关于大众运输临时队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆