我们目前正在使用JMS和activemq(5.5.1)开发应用程序.我们希望为某些消息定义更高的优先级,这将使它们首先被消耗.设置生产者和消费者(通过spring(3.1)JMSTemplate)后,优先级不能完全发挥作用.实际上,当我们"关闭"消费者并发送一些消息时,优先级得到尊重,但是当我们在消费者开启时添加消息时,消息的接收顺序与发送消息的顺序相同.
配置很简单:
在activemq配置文件中激活优先级:
<policyEntries>
<policyEntry queue=">" prioritizedMessages="true"/>
...
</policyEntries>
Run Code Online (Sandbox Code Playgroud)
并且在生产者模板配置中启用了QoS:
<bean id="jmsOCRTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="defaultDestination" ref="destination_ocr" />
<property name="explicitQosEnabled" value="true" />
</bean>
Run Code Online (Sandbox Code Playgroud)
要发送具有高优先级的消息,我们只需更改生产者端的模板优先级属性:
template.setPriority(9);
Run Code Online (Sandbox Code Playgroud)
任何的想法?这是正常的行为,还是有一些我们会忘记的配置?
我只是想用Jade(0.20.3)和Express(2.5.8)在输入字段中显示一个值:
input(name='username', type='text', id="username", value=username)
Run Code Online (Sandbox Code Playgroud)
这很简单,但是当值未定义时会抛出错误:
username is not defined
Run Code Online (Sandbox Code Playgroud)
但是,文档指出:
When a value is undefined or null the attribute is not added, so this is fine, it will not compile 'something="null"'.
Run Code Online (Sandbox Code Playgroud)
有什么我会做错的吗?