假设您有一个JMS队列,并且多个消费者正在查看队列中的消息.您希望其中一个消费者获得所有特定类型的消息,因此您决定使用消息选择器.
例如,您可以在名为的JMS消息头中定义一个属性targetConsumer.您的消息选择器,您应用于称为的消费者A,就像是WHERE targetConsumer = 'CONSUMER_A'.
很明显,消费者A现在只是抓住具有属性集的消息,就像在示例中一样.但是,其他消费者是否会意识到这一点?IOW,CONSUMER_A如果它在消费者之前查看队列,那么另一个不受消息选择器限制的消费者会抓取消息A吗?我是否需要将消息选择器应用于WHERE targetConsumer <> 'CONSUMER_A'其他人?
我现在正在RTFMing并收集经验数据,但希望有人可能知道他们的头脑.
我正在研究Smith和Ledbrook的Grails in Action.本书中的示例是针对Grails 1.1和Hibernate 1.1编写的(根据下载的源代码的application.properties).
其中一个例子是"喧哗".我的机器上有Grails 2.0.3.我使用"grails create-app hubbub"创建了我自己的应用程序副本,使用Grails命令创建了我的域类和测试,然后在书中输入了源代码.换句话说,我不是想在Grails 2.0.3环境中运行使用Grails 1.1生成的源代码树.Grails 2.0.3生成了不是该示例唯一的所有配置和类.我只是输入了Grails首先没有生成的示例中的少量源代码.
这是我的问题 - 其中一个集成测试使用save()方法来持久化对象.当我运行测试时,它只包含一个save(),它会成功.但是,如果测试包含多个save()方法,则在第一个调用之后对save()的所有调用都会失败:
| Failure: testSaveAndUpdate(com.grailsinaction.UserIntegrationTests)
| groovy.lang.MissingMethodException: No signature of method:
com.grailsinaction.User.save() is applicable for argument
types: () values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(),
any(), wait(long)
at
com.grailsinaction.UserIntegrationTests.testSaveAndUpdate
(UserIntegrationTests.groovy:46)
Run Code Online (Sandbox Code Playgroud)
我重新安排了对save()的调用,第一个调用总是有效,而后续调用总是失败.我已经注释掉测试来运行每个调用以自行保存,每个调用都可以自己成功.
这是我调用save()方法的类:
package com.grailsinaction
class User {
String userId
String password
String homepage
Date dateCreated
static constraints = {
userId(size: 3..20, unique: true)
password(size: 6..8)
homepage(url: true, nullable: true)
}
Run Code Online (Sandbox Code Playgroud)
这是在User上调用save()的集成测试: …