JMS CreateQueue 问题

发布于 2024-08-06 05:01:36 字数 99 浏览 5 评论 0原文

我有一个关于 JMS createQueue 方法的一般性问题。在 WebSphere MQ 中,此方法是否用作 JNDI 查找的替代方法?我想我可以动态创建一个队列。这可能吗?谢谢。

I have a general question about the JMS createQueue method. In WebSphere MQ is this method used as an alternative to the JNDI lookup? I was thinking that I could dynamically create a queue. Is this possible? Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多像笑话 2024-08-13 05:01:36

假设您指的是QueueSession.createQueue,这是一个非常具有误导性的方法,并且不会执行您可能认为的操作:

根据给定的队列创建队列标识
名称。

此设施是为稀有的人提供的
客户需要的情况
动态操纵队列标识。
它允许创建队列
具有特定提供者的身份
姓名。依赖于此的客户
能力不可移植。

请注意,此方法不适用于
创建物理队列。这
队列的物理创建是
行政任务,而不是
由 JMS API 发起。那个
例外是创建临时的
队列,这是通过
createTemporaryQueue 方法。

JMS API 不提供动态创建队列的方法(除非您指的是临时队列,这是请求-响应消息传递使用的一种非常不同的野兽)。如果您想在运行时创建队列,那将是 WebSphere 专有的。

Assuming you mean QueueSession.createQueue, this is a very misleading method, and doesn't do what you might think:

Creates a queue identity given a Queue
name.

This facility is provided for the rare
cases where clients need to
dynamically manipulate queue identity.
It allows the creation of a queue
identity with a provider-specific
name. Clients that depend on this
ability are not portable.

Note that this method is not for
creating the physical queue. The
physical creation of queues is an
administrative task and is not to be
initiated by the JMS API. The one
exception is the creation of temporary
queues, which is accomplished with the
createTemporaryQueue method.

The JMS API does not provide a way of dynamically creating queues (unless you mean temporary queues, which are a very different beast used by request-response messaging). If you want to create queues are runtime, that's going to be proprietary to WebSphere.

烙印 2024-08-13 05:01:36

是的,根据规范并在上面的答案中正确指出,

Creates a queue identity given a Queue name.

This facility is provided for the rare cases where clients need to dynamically
manipulate queue identity. It allows the creation of a queue identity with a
provider-specific name. Clients that depend on this ability are not portable.

Note that this method is not for creating the physical queue.
The physical creation of queues is an administrative task and is not to be
initiated by the JMS API. The one exception is the creation of temporary queues,
which is accomplished with the createTemporaryQueue method.

因此 JMS 不提供动态创建队列的直接方法。其完成方式将特定于 JMS 提供者。 JMS 提供商可能会提供某种控制台或管理 API,您可以通过它们来执行此操作。

就Session的createQueue()方法而言,如果队列已经创建,它将返回对队列的引用。如果不是,将抛出JMSException

另请注意,createTemporaryQueue() 创建实际的物理队列。您必须调用delete()来清理相关资源。

Yes as per specs and correctly pointed out in above answer

Creates a queue identity given a Queue name.

This facility is provided for the rare cases where clients need to dynamically
manipulate queue identity. It allows the creation of a queue identity with a
provider-specific name. Clients that depend on this ability are not portable.

Note that this method is not for creating the physical queue.
The physical creation of queues is an administrative task and is not to be
initiated by the JMS API. The one exception is the creation of temporary queues,
which is accomplished with the createTemporaryQueue method.

So JMS does not provide a direct way to create queues dynamically. The way it will be done will be specific to the JMS provider. JMS provider may provide some kind of console or admin APIs by which you can do so.

As far as createQueue() method of Session is considered, it will return the reference to the Queue if it is already created. If not JMSException will be thrown.

Also point to note is createTemporaryQueue() creates actual physical queue. You will have to call delete() to cleanup related resources.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文