Patterns in ProcessEvent annotation

In the ProcessEvent annotation entry i built a sample portlet to demonstrate how we can use @ProcessEvent annotation.

When the processEvent() method in GenericPortlet gets invoked, first it checks if there there is exact match of event name and the value of name attribute of @ProcessEvent annotation. If it does not find exact match it tries to find the longest possible match using following rule

"If the local part of the event name has a wildcard at the end (“.”) the GenericPortlet will try to match the received event either to the same wildcard event name or to the longest matching event name for this wildcard. E.g. if an event with the local part of the event name of "a.b.c.d" is being received and there are methods annotated for handling "a.b." and "a.b.c." events in this portlet, the GenericPortlet will dispatch the event to the method annotated with "a.b.c."

Lets say this is how portelt.xml of my target portlet looks like

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns=""
version="2.0" xmlns:xsi=""
<display-name>Process Event Annotation Portlet</display-name>
<title>Process Event Annotation Portlet</title>
<short-title>Process Event Annotation Portlet</short-title>
<keywords>Process Event Annotation Portlet</keywords>


The ProcessEventAnnotationPortlet can consume event. So these are some of the @ProcessEvent combination that i can use to handle this event

  1. @ProcessEvent(qname="{}"): Fully qualified event name

  2. @ProcessEvent(qname="{}com.webspherenotes."): Fully qualified event name, so this method can handle all the events starting with com.webspherenotes.*, it could be,

  3. @ProcessEvent(name = "com.webspherenotes."): Means it can handle all the events where local name starts with com.webspherenotes.*

No comments: