Spring Boot Quartz Scheduler Tutorial 2 - Configuring Quartz, MySQL and Mail Properties

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in the previous video we talked about setting up a very basic spring boot application which you can see here on the screen it has a very simple uh stutter which just has a main function and runs the spring application and we also now need to set up our run for configuration for our app so in intellij what you can do is go on to this little piece of information go to edit configurations now you need to select an application called as quartz runner and then run it if not you can also use the springboot's way of running the application but i would say uh the application way helps you to understand how quartz or how a springboard application works behind the scenes so all you have to do is let's do it again so we do a plus application we can give it a name as quartz email runner running it on local machine the main class is something which we need to talk about so it's going to be called schedule application and that's it so that's all you need to have your uh runner ready and you can always just run it whenever you want to so that's it it gets easier to have a runner ready you don't have to always click this you can always click it here or the debug mode and then have your application running so coming to this video uh we'll be talking about the configurations or the properties that our application needs to set up quartz to set up the database and also to set up our mailing properties so we'll be using uh an email id to actually send the emails right or to schedule the email so we need to also set up some properties there so let's get started so go to resources and to application.properties this is where basically we have all of our applications ready and the properties so now what we're going to do is uh have them write the application properties for our application so first comes the string data source so the spring data source is basically uh the database which will be connecting to your springboard application and some information regarding that which includes the url the username and the password so let me write uh the ones for mine i will not be giving it the values for now i'll be doing in the next video because the next video is going to be dealing about configuring configuring our database and how we can set up our mysql uh server and integrate it with intellij so spring dot data source dot url spring dot data start user name and we can do a spring dot username dot password now it is generally recommended that you do not have your password in plain text when it comes to enterprise applications or projects that you're deploying on let's say github or anywhere else so just for now uh for practice purposes will have a password in plain text but if you're using or using this to create an enterprise application or using it to create uh or deploy it on a provider or on github then make sure that your password is not there in plain text and it's modified or hashed in some way or the other so this is the proper these are the properties that we need for our spring data source which is going to be a mysql server which we'll talk about in the next video the second thing which we need is the quartz properties so let's start writing them so the first is going to be spring dot quartz dot job store type now as you can see these have these have two options one is jdbc which we are going to use where it stores your jobs in the database the upside or the advantage of this is that whenever you shut down the application then restart it again it takes up all the failed jobs or it restores the jobs from the database and then runs it again so that you always have that job running it's never in the failed scenario unless uh something happens from the user point of view next is storing it in memory this is basically a way of quads to show store your jobs in memory only not inside external database so whenever you should an application and then uh run it again the jobs get uh destroyed and then new jobs have to be created whenever you restart an application so since we need our jobs to be persistent and to be inside the database we'll be using jdbc method or the value the next is the thread pool count so the spring dot parts dot properties arc dot quad start so this is basically the amount of threads that you want your application to use when it's scheduling its jobs so for example if you have two or three jobs which are scheduled for the same time you can have five threads in which each of the thread will have its in its own job running at the same time so that it's easier it's less load for the application and for that particular thread so next comes our mail properties so since we'll be scheduling our mail using uh scheduling our mails we'll have to have an email from which we send it from and we also have to tell it what the protocol is what kind of things are we using so let's add them so the first property is the host and since i'll be using gmail to showcase uh the demo i'm using the i'm using gmail simple mail transfer protocol or smtp.gmail.com so the next two properties are the port and the user name so port is basically the port in which you would want to send the mail through so for here i have 587 and the username is my email id and you can also email me on this email id if you have any doubts regarding your resume if you want to talk about your cover letter how to get jobs uh how to get a software engineering job later on so this is the email which i use and next is going to be the password so i will not be writing that here but you know again you should not have your password in plain text but you would have them uh hashed so spring dot okay so these are the basic properties that you need to make sure that your application has enough uh it needs to build up the email scheduling app the next thing which comes in is two uh i would say unnecessary properties one being the authentication and the other being start tls so we'll have that for now and i'll talk about them later in the upcoming videos so let's just input those properties now so with these properties now we have our application ready uh to start building it and then schedule jobs and schedule emails but before we do this we need to have an additional step which we need to make sure that we are doing so that we uh have our emails which are actually being sent to the receiver so since we are using gmail gmail uh by default does not allow you to send emails to a less secure application and since we have literally no security in our application it will be hard for us to actually let google send our emails and we'll just prohibit it or mark it as spam or just not send them so what we need to do is go to this url so the url will also be in the description below and scroll down this is the security part of google's account scroll down to less secure apps and you should make sure that you turn it on so you can click here when it says turn on and then click it to turn on and make sure that you do this only after reading what's happening here i do not recommend this it's just something which i have done so make sure that this is turned on which you want to use smtp.gmail.com for your particular uh image scheduling app so this is all for this video in the next video we'll talk about how we can set up the database for quartz uh on intellij so we'll have our database ready here as you can see a quartz demo how to do this how do we actually have our quartz table so we'll have these kind of tables and we'll talk about what all of them mean we'll also talk about what quartz is the terminal the terminologies behind quartz and how powerful quartz is when you have to actually schedule an email and how easy it becomes when you want to do it so thank you for watching i'll see you in the next one
Info
Channel: ProgrammingKnowledge
Views: 17,635
Rating: undefined out of 5
Keywords: Windows 10, How-to (Website Category), JAVA_HOME, Oracle, Javaprogramming, Javatutorial, Spring Boot, Spring Boot Tutorials, Learn Spring Boot, Getting Started with Spring Boot, Spring MVC, Spring Boot Actuator, Spring Boot Projec, Learn Spring Boot Tutorial, Spring Boot Full Course, Spring Boot Online Course, Spring Boot - Online Courses, Classes, Training, Tutorials, Free Spring Boot Tutorial, Go full stack Spring: Spring + RESTFUL API + Spring Boot, Hands On Spring Boot Course
Id: Z9AcBUKoic8
Channel Id: undefined
Length: 10min 40sec (640 seconds)
Published: Wed May 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.