I am trying to work on a tibco JMS CDC product. I have issues setting up the configuration and could not find a solution to my problem.
import com.tibco.tibjms.TibjmsConnectionFactory;
import javax.jms.JMSException;
@Configuration
@EnableJms
public class TibcoBusConfiguration {
@Value("${ems.password}")
private String password;
@Value("${ems.port}")
private String port;
@Value("${ems.topic}")
private String queue;
@Value("${ems.server}")
private String server;
@Value("${ems.user}")
private String user;
@Bean(name = "tibjmsConnectionFactory")
public TibjmsConnectionFactory jmsConnectionFactory() throws javax.jms.JMSException {
final TibjmsConnectionFactory factory = new TibjmsConnectionFactory();
factory.setServerUrl(serverURL());
factory.setUserName(user);
factory.setUserPassword(password);
return factory;
}
@Bean
public JmsTemplate jmsTemplate(
@Autowired TibjmsConnectionFactory tibjmsConnectionFactory) throws JMSException {
final JmsTemplate jmsTemplate = new JmsTemplate();
jmsTemplate.setConnectionFactory(jmsConnectionFactory());
jmsTemplate.setDefaultDestinationName(queue);
jmsTemplate.setExplicitQosEnabled(true);
jmsTemplate.setDeliveryMode(DeliveryMode.PERSISTENT);
jmsTemplate.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
jmsTemplate.setSessionTransacted(false);
return jmsTemplate;
}
private String serverURL() {
return "tcp://" + server + ":" + port;
}
}
Unfortunately JmsTemplate only allows jakarta.jms.ConnectionFactory, how do I pass in the TibcoConnectionFactory, because casting is not allowed since the classes do not match. Is my understanding of this incorrect?
I have the following JAR's in my maven setup: tibjms.jar jakarta.jms-api-3.0 javax.jms-api-2.0
Thanks in Advance
Boot 3/Spring 6 moved from the javax
to the jakarta
namespace for JEE support - you either need to find a Tibco jar for JEE 9 or drop back to Boot 2.7/Spring 5.3.