It's all about the answers!

Ask a question

How to set up notification mechanism?


0
1
Andreas Meissner (363) | asked Oct 21 '08, 1:02 a.m.
Hi,

I've already set up a feed service for my own Jazz component (meaning my
service plugin is firing IChangeEvents).

Now I also wanted to set up a notification mechanism for my component so
that dependending on the fired event certain users will be notified
about changes (newly created or updated items) via, for example, an
alert-notifier.

I've already seen that there are several extension points to specify
notifiers, notifications and triggers.
https://jazz.net/wiki/bin/view/Main/FoundationNotifierTutorial

However, my attempts to get that working with the help of the linked
tutorial did fail. Could anyone please explain briefly what extension
points are necessary and how to set up a simple notification mechanism.
How can an IChangeEvent specify beside its eventCategory an eventtype
that can be referenced by a trigger (defined in the extension point
com.ibm.team.foundation.rcp.core.notification).

Thanks for your help!

Andreas

9 answers



permanent link
Work Item & UI Commons Team (1.3k1) | answered Oct 29 '08, 5:28 a.m.
It seems it actually adds the contributors to the news item, but not as custom attributes. However, the feed parser is not respecting those values simply because we haven't used them yet. In the future we will likely extend the parser to recognize more values related to contributors and the renderer will likely add more of those values to the feed XML.

permanent link
Andreas Meissner (363) | answered Oct 28 '08, 1:37 p.m.
Thanks again! Your hint was exactly what I was looking for.

After defining a feed renderer for my component I can know easily
determine the author and contributors information in my news listener
and thus send notifications based on those values.

However, I still can not understand why the default renderer does not
handle the creation of the custom attributes creator, modifier, author,
subscribers, etc. for the IFeedEntry based on the given IChangeEvent.

Andreas

permanent link
Work Item & UI Commons Team (1.3k1) | answered Oct 28 '08, 6:12 a.m.
You should add contributors as custom elements to the news items you create from the feed service. Custom elements can be accessed on the client using NewsItem#getCustomFieldValue(). Based on those values you could decide to send the notification or not.

To create custom elements, see com.ibm.team.workitem.service.internal.save.notify.WorkItemFeedRenderer.renderFeedEntry(IFeedFactory, IFeedEntry, IChangeEvent) as an example and com.ibm.team.repository.service.feed.IFeedEntry.addTextElement(String, IFeedText) as the related API.

Hope that helps!

permanent link
Andreas Meissner (363) | answered Oct 28 '08, 2:07 a.m.
Hi,

the feed and notification mechanism of my component works generally fine
now. However, I still have some problems with my INewsListener. In my
case, I want to send notifications only for certain users. Meaning that
I only want to invoke Notification#send() in my INewsListener when the
logged-in contributor is contained in the contributor-list of the fired
IChangeEvent.

My problem is: how to determine the set contributors of a NewsItem. I've
already seen that com.ibm.team.feed.core.ClientFeedUtils seems to
provide some useful methods for this issue. However, the NewsItems that
my NewsListener receives do not have any custom attribute set. Besides,
the custom fields map (NewsItem#getCustomFields()) does not contain any
entries regarding the author or contributors of the fired IChangeEvent.

My feed service sets beside category, title and description also an
author and a list of contributors. Is there still anything missing in my
feed/notification structure so that contributors and author information
don't show up in the NewsItems?

Thanks for your help!

Andreas

permanent link
Rafik Jaouani (5.0k16) | answered Oct 22 '08, 2:07 p.m.
JAZZ DEVELOPER
For client side eventing, the client side classes that fire events need to extend com.ibm.team.repository.client.util.EventSource and call queueEvent to queue new events. Check the java doc for EventSource.

permanent link
Work Item & UI Commons Team (1.3k1) | answered Oct 22 '08, 5:08 a.m.
Great, thats the right way to do it!

Ben

permanent link
Andreas Meissner (363) | answered Oct 21 '08, 11:35 p.m.
I've registered the INewsListener now via the corresponding extension
point "com.ibm.team.feed.core.newsListener". That works fine.

Andreas

permanent link
Andreas Meissner (363) | answered Oct 21 '08, 11:22 a.m.
First of all thanks for your help. I've overseen the INewsListener part.

Regarding the INewsListener I have some more questions:

What is the recommended way to register an INewsListener. I've seen that
you can do that programmatically using FeedManager#addNewsListener() but
there also exists an extension point "com.ibm.team.feed.core.newsListener".

However, the extension point does not seem to work in my configuration.
When I want to add an extension for the extension point
"com.ibm.team.feed.core.newsListener" I can only add a "Generic" element
instead of a "newsListener" element I've seen in other projects.

Andreas

permanent link
Work Item & UI Commons Team (1.3k1) | answered Oct 21 '08, 5:52 a.m.
Hi Andreas,

so, you seem to provide a feed (via your feed service) that loads certain change events and provides them as news items inside the feed. What you can do now to make those events show up in an Alert is:

- contribute your own event category and event type for the events
- contribute a trigger for the event type with the alert as notifier

Now, register a INewsListener to FeedManager to listen to news being downloaded to the client. In that listener you should check if the news belongs to your feed service (you can use the news-item category to encode this information) and if so, use Notification#send() to submit the event. In that method you are asked for the event-type-id and the actual NotificationInfo serving as the POJO to contain all necesary information that is presented to the user in the alert.

Hope that helps, let me know otherwise!
Ben

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.