Complete Java Enterprise Edition 8 specification APIs providing all standardized enterprise application development interfaces
—
JMS API for asynchronous messaging with support for queues, topics, and message-driven beans.
public interface ConnectionFactory;
public interface Connection extends AutoCloseable {
Session createSession() throws JMSException;
Session createSession(boolean transacted, int acknowledgeMode) throws JMSException;
void start() throws JMSException;
void stop() throws JMSException;
void close() throws JMSException;
}
public interface Session extends Runnable, AutoCloseable {
MessageProducer createProducer(Destination destination) throws JMSException;
MessageConsumer createConsumer(Destination destination) throws JMSException;
Message createMessage() throws JMSException;
TextMessage createTextMessage() throws JMSException;
TextMessage createTextMessage(String text) throws JMSException;
void commit() throws JMSException;
void rollback() throws JMSException;
void close() throws JMSException;
}public interface Message {
String getJMSMessageID() throws JMSException;
void setJMSMessageID(String id) throws JMSException;
long getJMSTimestamp() throws JMSException;
void setJMSTimestamp(long timestamp) throws JMSException;
Destination getJMSDestination() throws JMSException;
void setJMSDestination(Destination destination) throws JMSException;
}
public interface TextMessage extends Message {
void setText(String string) throws JMSException;
String getText() throws JMSException;
}@MessageDriven
public class OrderMessageBean implements MessageListener {
@Override
public void onMessage(Message message) {
try {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
String orderData = textMessage.getText();
// Process order
}
} catch (JMSException e) {
// Handle exception
}
}
}Install with Tessl CLI
npx tessl i tessl/maven-javax--javaee-api