I am trying to read from multiple JMS queues of Solace and then publish message to weblogic JMS Queue. The problem is, as both of the source and target are JMS, I am getting a conflicting bean. The class for reading message from Solace Queues work good until the config class for weblogic JMS is introduced to the code. As soon as I introduce the Appconfig class the SolcaeListner.class starts listening to the queues on weblogic(which is not present) and hence errors out.
SolaceListner class:
@EnableJms @Component public class SolaceListner implements JmsListenerConfigurer {
@Value("${sol.InQueues}")
private String[] inQueues;
@Qualifier("default")
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
int i = 0;
for (String inQueue : inQueues) {
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
endpoint.setId("myJmsEndpoint-" + i++);
endpoint.setDestination(inQueue);
endpoint.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
System.out.println("Message received is : " + message);
TextMessage tm = (TextMessage) message;
try {
System.out.println("TextMessage= " + tm.getText());
JMSSender js = new JMSSender();
js.sender(tm.getText());
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
registrar.registerEndpoint(endpoint);
System.out.println("Registered the endpoint for queue: " + inQueue);
}
}
}
question from:
https://stackoverflow.com/questions/65936870/conflicting-beans-while-using-solace-and-jms 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…