2012-12-07 73 views
2

我試圖讓我們的MDB在不同的環境中使用動態加載的屬性時遇到了一些困難。動態設置MessageDrivenBeans中的激活配置屬性

@MessageDriven(activationConfig = { 
@ActivationConfigProperty(propertyName = "providerURL", propertyValue = "localhost:7001"), 
@ActivationConfigProperty(propertyName = "destinationType", propertyValue ="javax.jms.Queue") }, mappedName = "jms.MyQueue", name = "MyQueueReader") 
public class QueueReaderBean implements MessageListener { 

} 

我們想在部署到不同的環境時更改providerURL。你有什麼建議嗎?

我們不想使用ejb.xml,而是以編程方式在構造函數或後構造方法中執行。

感謝

回答

0

或許這與此項connecting to a remote JMS provider from a Message Driven Bean (MDB)

和使用url白衣JNP協議可以做的工作要做:

@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName的=「providerURL」,propertyValue =「jnp:// hostname:1099」), @ActivationConfigProperty(propertyName =「destinationType」,propertyValue =「javax.jms.Queue」)},mappedName =「jms.MyQueue」,吶me =「MyQueueReader」) 公共類QueueReaderBean實現MessageListener {

}