Java Messaging Service - Spring MVC, Spring Boot, ActiveMQ | Infybuzz | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Java Messaging Service - Spring MVC, Spring Boot, ActiveMQ

teacher avatar Infybuzz

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

11 Lessons (40m)
    • 1. Introduction To Java Messaging Service

      2:07
    • 2. Understanding Of Java Messaging Service

      2:06
    • 3. Installing Apache ActiveMQ

      3:48
    • 4. Project Set Up

      3:52
    • 5. JMS Publisher Configuration

      3:43
    • 6. Publishing Message To Queue

      7:09
    • 7. JMS Consumer Using Spring JMS Template

      6:31
    • 8. Introduction To JMS With Spring Boot

      0:47
    • 9. Spring Boot Project Set Up For JMS

      2:33
    • 10. JMS Publisher Using Spring Boot

      4:23
    • 11. JMS Consumer Using Spring Boot

      3:08
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

72

Students

--

Projects

About This Class

You will learn Java Messaging Service (JMS) from this course.

You will get idea of Apache ActiveMQ.

You will learn to publish the message to queue using Spring MVC and Spring JMS template. This message can be in any format like simple text OR Json OR XML.

You will learn to consume this message from Queue.

You will learn to create message publisher and consumer using Spring MVC and Spring Boot separately.

Meet Your Teacher

Teacher Profile Image

Infybuzz

Teacher

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction To Java Messaging Service: Hello, friends. Welcome back. For the next few lectures, we are going to implement dollar messaging service using Spring Embassy. So you may have us Christian that what is Java messaging service? So in sort it is called us Jamey's. So basically, Jamis is a kind of service by which to Java applications can interact with each other. Now let's take an example off mobile text message service. So in that one person sends a text message to another person, and by that way they can interact with each other. So same thing applies over here by GM is to Java application Skin interact with each other by sending them messages. But here, message delivery is not direct like we have for mobile text message service. So here Q is using her as a intermediate er. So you is a kind off Boone where all messages will arrive from one job application and then you will send those messages to receiver, which is another job application. In our case, we are going to use it to em que and that we will create and you so here we can say that sender is message publisher and we see what is message consumer and what are different job applications. Now Spring provides Jamie's template to integrate Jamie's using spring framework so it makes our job easy to integrate Jamie's using spring framework. In the next lecture, I will explain you more about Jamie's using diagram. So see you in the next elective. Thank you very much. 2. Understanding Of Java Messaging Service: Hello, Prince. Welcome back in this lecture. I will further explain you about GMs. So, as you can see in the diagram application, one will send a message to Q and then you will send a message to consumer. Now here there are three consumers. Potato took you. There can be a number of consumers possible. Retired art teacher Toa que It all depends on your application requirements and the architecture of the application. But one thing you need to keep in your mind is that only one consumer religious you message from Q out off, all the consumers are Tater took you so say there are three consumers Arteta, Tokyu. So only one consumer will receive the message from Q. Not all. So let's take a real time example Say we have a e commerce website and when user will place an order, we want to perform some the ground task like sending an email to user and setting the sick men details with career team. So here what we can do when user real place in order, we can build a message and we will send it to you and from Q, it will be possible to consumer now inside the consumer, we can write the business logic to send out an email to user and to serve the submit details with career team. So this is just an example. So that you will get an idea when to use Jamey's. Now in our case, message publisher and message receiver will be two different spring and missy applications . And for two, we are going to use active. Thank you. So in the next lecture, we will proceed for the active mq. See you in the next lecture. Thank you very much. 3. Installing Apache ActiveMQ: Hello, friends. Welcome back. So in this lecture, we are going to install about active mq and then we will create you over there. So open your browser and navy get toe Oficial website off a party active Mq. Now click on the download Ling, click on the latest stable release. Now use the comparison A file according to your operating system and downloaded. I'm already having that compressing the file and I have extracted it toe a particular location. So let me go over there. So now first we need to start the active mq on our local host. So for that goto been military. Now, according toa, your bit operating system go inside the folder. So I am going inside the 32. Now let's run the active MQ bed file. So this will take a few seconds by default. Active mq will get started on 8161 port. Okay, so now it's up. Let's go to a browser and never get to local host 8161 So back to em que is successfully running on our local host on 8161 port. Now let's click on the managing, so it will ask you for the credit sales by default, user name and password. Our admin admin. So let's do logging that mean admin on hit the enter. Now click on the queues, so there are no queues as up now because we haven't created any. So let's create a new Q provide the you name over here, so let's give it has demo. You can provide any name for the Q. Now click on the create. So you has been created successfully and you can see the name over here. Right now, there are no consumers are natural. Do this you So the county zero. So what will happen when there are no consumers? Are tater toe this Q and publisher is still sending messages to you. So in that case, the messages will recite in the cube as pending messages, and that count will be sewn over here. And once there is at least one consumer will get attention to rescue. Then you will start to send those spending messages to consumer. So this is the information that we are getting from these counts. So now we have installed active MQ one of our local host, and we have created to as well. So we are ready to send messages from publisher. But before that, we need to set up our spring replication. So in the next lecture, we will do that. So see you in the next lecture. Thank you very much. 4. Project Set Up: Hello, Prince. Welcome back. So till now we have installed active mq and it's running on over local host on 8161 port and we have created you over there. Now, in this lecture, we will set up our spring application so that we can start sending out messages to you. So open your palm dot xml and add these two. Dependence is first is Border Spring active? Mq and 2nd 1 is for spring Germany's template. Now let's go toe spring surveyed dot xml and here I have given calmed or demo as base pickets for the components skin. Now let's proceed further and create separate package for Jamie's. So new Could he have pick, edge and give it a name like condor demo dot Jamis. So inside this Beckett, we will write the Logic four. Jamis, as I already mentioned our publisher and consumer both our spring applications, so I will use the same Corby's. The only difference is this package. Condor Demo Dort, Jamie's for Publisher. This package will have the logic to send messages to you and for consumer. This package will have the logic to consume messages from you. That's the only difference Now let's run our application on Tom Kitt. So Ron is going on server, so it will take a few seconds to get started. So wait for a few seconds. Mm. Now let's do logging. So user name is demo and passed What is also demo. Now click on products. So here is products list that we have in the back end. And for each and every product we have you button or here. Now, click on this view. So what we want to do over here is that when user clicks on the view button for a particular product, we want to build the message from our publisher, and we want to send it to consumer using you. And our message will be in Justin format, which will contain the details of the product. So in the next lecture, we will see the publisher part to send the message to you using spring Jamis template. So see you in the next lecture. Thank you very much. 5. JMS Publisher Configuration: Hello, friends. Welcome back In this lecture we will do the configuration Toe published the message Tokyu Using Spring Jamis template. So let's create a separate class for that configuration and give the name is Jamie's convict. Now let's mark it as a configuration. Now we need to enable Jamie's using at in Able Jamis in addition, which is part off spring. Jamey's template. So here we need to create a couple of beans. So let's start by creating being off like two mq connection factory. Give the Met Her name is connection factory. Now let's create object off like, um que connection factory called to new. Let's said the user name and password. So said user name and we have using them. Is ed mean now? Let's it password. Now let's it the broccoli. Well, so sick broker, you are ill. So here we need to provide a two mq broker. You are using TCP protocol. So let's give it like TCP local host and Baltes 61616 So this port and this bold both are different. So don't get confused between these two poles. Now let's return the object. Now let's create the being off Jamie's template. So Jamis template. Let's create object off Jamie's template, the call to new Jamis template. Now let's it, the connects in factory that we have created about so said connects in factory and colder matter that has been defined about. Now let's return the object off Jamis template. So that's it, guys for the configuration, using Spring Jamie's template to publish the message. Tokyu. Now, in the next lecture, we will implement the logic to send the message Tokyu from over publisher application. So see you in the next lecture. Thank you very much. 6. Publishing Message To Queue: Hello, Prince. Welcome back. Now, in this lecture we will write the logic to publish the message Tokyu using Spring Jamis template. So let's create a separate last for it and give the name like message. Probably, sir, You can give it any. Let's mark it as a component. Let's create a matter to send the message. So send message and there will be two parameters 1st 1 sq and 2nd 1 is message, which is in the type of string. So here we will use the Jamis template toe published. The message took you. So let's get the object optimise template using auto wire annotation. No, called the matter that is send and that are two parameters. 1st 1 is the destination, which is basically the Q name so that we have que and second barometer is object off message creator. So let's create object off message Creator, which is basically interferes. Now let's create object off object message from the season and pas de message string. So here we got the compilers and heather. So it is giving other that we cannot use a non final variable at this location. So let's declare the string variable is final So now we are good to go. So let's modify the written statement and returned the object off object message. So that's it, guys. So this is the logic to send the message Tokyu from our publisher application. So basically, this is General Corps because we haven't hardcore did any value. Here is the Q. And here is the message that we want to publish. So if you want to publish message toe any Q than just call this matter past the queue name and the message. So throughout, in publisher replication, we can call this matter to publish the message to a particular que Now let's open the view controller. So here is the view product mapping, which is a TDP. Get mapping. And here I am re driving them product from the back end. And this is products entity, which is May potato products stable off databases. So this class has all the details regarding product. Now, when user clicks on the particular product for the view, we want to build the message in the form it off Jason string and then we want to send it to you. So here we can utilize the product object off products entity because it has all the details off the product, and that's what we won't do having over message. So let's convert this. Tell object in tow. Jason String, using Object may per create the new object member. Now let's builder Jason String, which is basically over message. So Member Dart right value as string on and pas thes object off products entity No, we will call the matter which is send message inside message publisher class to publish the message to you. So let's get the object off message publisher using or the wire in addition, No, let's colder. Send message metal From what? Here. Send message on the Q. Name is demo and the message and save it. So, guys, we are ready with the logic to publish. The message took you. So let's run our replication on. Dunk it. No, no one said a word and wait for Concord. It will take a few seconds to get started. Let's do Logan. Now click on products and let's click on view product. Now let's go toe active in Q and reload the queues. So as you can see over here, there are no consumers are Tater toe this. Q. So whatever message we have just sent to the Q is pending, and that's why this county's one. So guys, we are done with the publisher part. And in the next lecture we will attach the consumer toe this Q. And we will get the message that we have sent from over publisher application. So see you in the next lecture. Thank you very much. 7. JMS Consumer Using Spring JMS Template: Hello, friends. Welcome back. So in this lecture you will create the consumer and we will attach it to you and we will receive the message that was sent by our publisher Replication. So here is my consumer replication on this is the same configuration file that we have created for our publisher replication. So we need the same beings for our consumer application as well. And you can see inside this package We don't have any class for publishing the message, Tokyu. Because it's our consumer replication. Now, in our consumer replication, we need one additional being. So let's edit on that is default. Jamis Listener Factory. Let's view met her name is Jamie's Listener Container factory. Now let's create object off that new. Now let's it the connection factory. Let's call the matter that we have defined about. Then let's return object. So, guys, we are done with configuration for our consumer application. Now let's create a separate class to consume the message from the U and give it name as message consumer. You can give it any name market as component and let's create one matter that is Rizu message and, uh, better meter is message string So this is the message that we will get from the queue and it is type of string. Now we need toe attach this consumer toe over Q, which is nameless demo using spring Jamis template. So spring Jamis template provides one an addition, and that is Jamis Listener. And here in the destination parameter, we need to pause the name of the queue. So you know, work is your name is Demo, so whatever messages will be sent toe demo cue from over. Publisher replication will get received by this matter or say this consumer because we have listener on the demo que using Spring Germany's template. Now let's put a simple sis out statement, and we will bring the message that we just got from you. So this is basically Jason String, which has information regarding product, the product that we have a clicker. Now let's go inward, this Jason String to Object op products, plus so create object member New Object member and rocks the call to member dot reid value and passed the message spring and last type but order dot class, So regard some mirror. So let's said throws declaration. Now let's display the product name Product Dart. Good name. So, guys, we are ready with our consumer. So let's run our consumer application on Tom Kitt and wait for a few seconds to get it started. So, guys, as you can see over here at the very first moment, whenever consumer has been started, we have received the message from Q and we can see to Prince ST Man's and the console. And these are the same statements that we have plays Ling our consumer. So 1st 1 is Jason String, and the 2nd 1 is product name. So this is the same product that we have click alone in our publisher replication on Here it is. Now let's go to our active Thank you and reload the Jews. So see, it is solving one active consumer, and there are no pending messages because the message, which was earlier pending, is now received by our consumer replication. So, guys, that's it for the job. A messaging service using Spring Embassy and spring Jamis template, happy learning and happy Golding. See you in the next lecture. Thank you very much. 8. Introduction To JMS With Spring Boot: Hello, Prince. Welcome back. So for the next three videos, we are going to implement jobber messaging service using springboard. So it will be very easy to configure Jamis using Springboard application and Spring Jamis template, we will use spring Jamis template to publish and consumed the message from the queue. And we're going to use a party act. Um que So here, our publisher and consumer. Both applications will be springboard application. So in the next lecture, we've been set up our spring good application. So see you in the next lecture. Thank you very much. 9. Spring Boot Project Set Up For JMS: Hello, Prince. Welcome back. So in this lecture we will set up our spring boot application so that we can process for Jamis. So open your palm dot XML and along with spring boot dependencies just at these two dependencies in that So 1st 1 is for spring boot active income and 2nd 1 is for active MQ broker. Now let's go to our main class. And here we don't need to do anything. Let it me as it is. No, let's come toe application dot properties. So here we need to provide active MQ properties. So 1st 1 is broker, you are ill. So spring not active in Q not broker. You are ill DCP local host and 61616 is the board. Now let's set the use The name spring active in Q start User. So he used the name is Ed me and last one is password. So that is also add mean So that's it, guys, we don't need to do any other configures and we don't need toe create any other beings like we need to do in Spring embassy. So here we just need to provide these three properties in our application dot properties file and rest of the things will be handled by spring boot. So that's the I'd want a job spring boot that it requires very less configuration. Now, this configuration will remain same for our publisher and consumer application. As both hope, this applications are springboard application. There is no separate contribution for publisher and consumer. So in the next lecture, we will publish The message took you using spring boot and Spring Jamis template. So see you in the next lecture. Thank you very much. 10. JMS Publisher Using Spring Boot: Hello, friends. Welcome back. So in this lecture, we are going to publish the message Tokyu using spring boot and spring Jamis template. So first, let's remove this extra cool toe from the password. Now let's create a controller and give you the name as send controller so you can give it any name. It's up to you. No, let's market as wrist controller because we are going to create an FBI and Broida request mapping as solicit P. A. It's less we won. Now let's create Get it be I So public string send. So this is simple gate, FBI. Let's provide, Get mapping and you are less. It's less sand and then we will receive the message in the epi. A. Now let's get this part variable would here. So here. What we want to do is that whatever messages coming in the gate FBI, we want to publicity to our Q using spring Jamis template. So let's get object off. Spring Germans template using Auto Wired In addition, now let's in the message so Jamie's dem plate dart send and provide the distance, and so that is basically que name in over keys. Your name is Demo and let's create object off message creator interface. And here we need to create object off object message from Season North, create and cause the message. Let's modify the return statement as well and save it. So now we are ready with the logic to publish. The message took you. So let's run our spring boot application and read for Tom Kitt to get started so it will take a few seconds and then it will start on the port 80 80. No, let's go toe browser and hid a B A. Now let's go toe active in Q. So see, there are no consumers toe this cube. So the message is spending. So once there will be a least one consumer Get a taste, a little disc you then this Cuba will pass the message toe that consumer. So in the next lecture, we will create the consumer using springboard and spring Jamis template and we will receive the message. So see you in the next lecture. Thank you very much. 11. JMS Consumer Using Spring Boot: Hello, friends. Welcome back. So in this lecture we will create the consumer using spring boot and spring Jamie's template. So here it's the same configuration that we did for publisher. There is no additional configuration is required for consumer, unlike Spring Embassy. So let's create consumer Andrea to separate class and give it The name is message Consumer . You can give any name. Let's mark it as a component. Now let's create a method to receive the message. So we will use Spring Jamie's template. And it's an audition that is Jamie's listener and Broida you name in the destination. So your name is demo. So this annotation will bind the consumer to de McCue, and we will receive the message in this variable. So let's put a simple sis out. So that's it, guys, we are done with the logic for our consumer using spring Jamie's and spring boot. So let's run our consumer replication read for Dunk it toe, get it started. Soc! Hello is the message that we have sent from our publisher. You can take over here, and it is the same message that we have received in the consumer and that is printed in our console. Now let's go toe active in Q and C year is one pending message. So let's reload this. So now there is one consumer that is solving and there are no pending messages. So the message, which was earlier pending, is now delivered to our consumer. So, guys, that's it for Java messaging service using spring boot and spring Jamie's template. So happy learning and happy cording See you in the next lecture. Thank you very much.