From the course: Learning Java Enterprise Edition

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

JMS in practice: Fire observe

JMS in practice: Fire observe - Java EE Tutorial

From the course: Learning Java Enterprise Edition

Start my 1-month free trial

JMS in practice: Fire observe

- [Narrator] Okay and that's it for the Java message service. But let's now have a quick look at the in memory pub to subscribe service. I'm going to open up the default cargo inspection service. Look at the end of the inspectCargo method, we can see a cool surefire method. What this does is pass a cargo object to any method that is observing for cargo events. So if we scroll up we can see how this is set up. What we do is we specify the type of event that we want to pass to the observer methods as cargo. And it's as simple as that. Now let's have a look at a method that is observing for cargos. I'm to know that there is a method observing for cargos in the real time cargo tracking service. As you can see, in the onCargoInspect method, that the parameter of the method signature is annotate observes. This indicates that any event of type cargo should be observed and that this method should be wrote for each cargo event that is fired. You can have as many methods observing for cargo…

Contents