// Create a JMS context Context context = new InitialContext(); // Create a JMS connection ConnectionFactory factory = (ConnectionFactory) context.lookup("ConnectionFactory"); Connection connection = factory.createConnection(); // Create a JMS session Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // Create a JMS destination Destination destination = session.createQueue("myQueue"); // Create a JMS producer MessageProducer producer = session.createProducer(destination); // Create a JMS message TextMessage message = session.createTextMessage("Hello, World!"); // Send the JMS message producer.send(message); // Close the JMS connection connection.close();In this example code, we first create a JMS context and connection using the JMS API. We then create a JMS session and destination, and use these to create a JMS producer. Finally, we create a JMS message and send it using the producer. Overall, the JMS API provides a reliable and scalable way to exchange messages between different components in a distributed system.