From the course: Java EE 8 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
JMSProducers - Java EE Tutorial
From the course: Java EE 8 Essential Training
JMSProducers
- [Announcer] Within the JMS API, the producer interface is used to send messages to a JMS Queue or topic. Since JMS 2.0, the approach for creating a producer and sending a message has been significantly simplified by annotations. Let's take a look. We're going to go ahead and create a new class within our JAX-RS project in the calm.LinkedIn package. So just use the dialogue to create a new class. And we're going to call this class JMS service. We'll go ahead and make it. And then we're going to add the application scoped annotation to this class to make it an application scoped bean. So we can go ahead, import that annotation. And then what we're going to do is add a method to this class that's simply going to be named send. And that method is going to take a string as a message. From here, we're going to inject the actual Queue that we would like to send the message to. To do that, we can use the resource annotation.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.