package org.mockejb.jms;
import javax.jms.*;
class TopicPublisherImpl extends MockProducer implements TopicPublisher {
public TopicPublisherImpl(MockTopic topic) {
super(topic);
}
public Topic getTopic() throws JMSException {
return (Topic) getDestination();
}
public void publish(Message msg) throws JMSException {
send(msg);
}
public void publish(
Message msg,
int deliveryMode,
int priority,
long timeToLive)
throws JMSException {
send(msg, deliveryMode, priority, timeToLive);
}
public void publish(Topic topic, Message msg) throws JMSException {
publish(topic, msg, getDeliveryMode(), getPriority(), 0);
}
public void publish(
Topic topic,
Message msg,
int deliveryMode,
int priority,
long timeToLive)
throws JMSException {
checkDestination(true);
if (topic instanceof MockTopic) {
MockProducer.sendMessage(
(MockTopic) topic,
msg,
deliveryMode,
priority,
timeToLive);
}
throw new InvalidDestinationException("Invalid topic specified!");
}
}