com.github.marschall.jakartajmsadapter.JakartaTopicPublisher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakarta-jms-adapter Show documentation
Show all versions of jakarta-jms-adapter Show documentation
Adapts a javax.jms JMS provider to a jakarta.jms JMS provider.
The newest version!
package com.github.marschall.jakartajmsadapter;
import jakarta.jms.JMSException;
import jakarta.jms.Message;
import jakarta.jms.Topic;
import jakarta.jms.TopicPublisher;
final class JakartaTopicPublisher extends JakartaMessageProducer implements TopicPublisher {
private final javax.jms.TopicPublisher javaxTopicPublisher;
JakartaTopicPublisher(javax.jms.TopicPublisher javaxTopicPublisher) {
super(javaxTopicPublisher);
this.javaxTopicPublisher = javaxTopicPublisher;
}
@Override
public Topic getTopic() throws JMSException {
try {
return new JakartaTopic(this.javaxTopicPublisher.getTopic());
} catch (javax.jms.JMSException e) {
throw JMSExceptionUtil.adaptException(e);
}
}
@Override
public void publish(Message message) throws JMSException {
javax.jms.Message javaxMessage = Wrapper.unwrapObject(message, javax.jms.Message.class);
try {
this.javaxTopicPublisher.send(javaxMessage);
} catch (javax.jms.JMSException e) {
throw JMSExceptionUtil.adaptException(e);
}
}
@Override
public void publish(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
javax.jms.Message javaxMessage = Wrapper.unwrapObject(message, javax.jms.Message.class);
try {
this.javaxTopicPublisher.send(javaxMessage, deliveryMode, priority, timeToLive);
} catch (javax.jms.JMSException e) {
throw JMSExceptionUtil.adaptException(e);
}
}
@Override
public void publish(Topic topic, Message message) throws JMSException {
javax.jms.Topic javaxTopic = Wrapper.unwrapObject(topic, javax.jms.Topic.class);
javax.jms.Message javaxMessage = Wrapper.unwrapObject(message, javax.jms.Message.class);
try {
this.javaxTopicPublisher.send(javaxTopic, javaxMessage);
} catch (javax.jms.JMSException e) {
throw JMSExceptionUtil.adaptException(e);
}
}
@Override
public void publish(Topic topic, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
javax.jms.Topic javaxTopic = Wrapper.unwrapObject(topic, javax.jms.Topic.class);
javax.jms.Message javaxMessage = Wrapper.unwrapObject(message, javax.jms.Message.class);
try {
this.javaxTopicPublisher.send(javaxTopic, javaxMessage, deliveryMode, priority, timeToLive);
} catch (javax.jms.JMSException e) {
throw JMSExceptionUtil.adaptException(e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy