A queue class is generated for a specific interface, usually an EventListener
interface. For example, consider the atg.nucleus.logging.LogListener
interface:
package atg.nucleus.logging; import java.util.EventListener; public interface LogListener extends EventListener { public void logEvent (LogEvent logEvent); }
This is a simple EventListener
interface where the relevant methods return void
—a good candidate for queuing.
EventQueueGenerator Utility
To create the appropriate queuing class for this interface, the Oracle Commerce Platform includes a utility class called atg.service.queue.EventQueueGenerator
. The class is run using the java
command, like this:
javan ATG.service.queue.EventQueueGenerator\
atg.nucleus.logging.LogListener\
mypackage.queues\
LogListenerQueue
The first argument is the name of the interface for which you wish to generate a queuing class. The second and third arguments are the package and class name of the new queuing class.
The output of the command is written to stdout
, so you can redirect the contents to a file like this:
javan ATG.service.queue.EventQueueGenerator\
atg.nucleus.logging.LogListener\
mypackage.queues\
LogListenerQueue > LogListenerQueue.java
You should place the resulting .java
file into the correct package of your source hierarchy. Like all of your other source files, you must compile this one and add it to source control as if you created this class yourself.
The resulting class looks fairly cryptic if you examine it yourself. But it has the following important characteristics:
It implements
LogListener
, so anything that used to send events to aLogListener
can send events to this queue instead.It implements
addLogListener
andremoveLogListener
. This means that the class is a source ofLogEvents
, as well as a listener forLogEvents
.