Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
RefreshStartEvent Listener
April 16, 2012
13:43, EEST
Avatar
fred
Member
Members
Forum Posts: 41
Member Since:
January 27, 2012
sp_UserOfflineSmall Offline

I figured out that whenever an Event is subscribed, also a RefreshStartEvent and a RefreshEndEvent is triggered by the client.

When there is a need to provide fields in these System Events (e.g. NodeId, Stamp, …), how will a Listener for these events look like? Is there a method in an EventListener to hook in or do I need to implement such listener on top of all NodeManagers.

Thanks for any help.

Regards

April 16, 2012
14:30, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 869
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

These are kind of notification events that the events that are sent between them correspond to “currently active” events, so that the client can differentiate between the initial state and new change events after that.

You can basically just check the EventTypeId. I do not think that you need to define a separate listener for these events: they are special events that are sent for every subscription anyway.

In general, if you need to listen to “any events” from the server, you can listen to the Server object. If you want to filter only “normal” events and no Conditions, you would need to use something like “Not IsTypeOf(ConditionType)”

April 18, 2012
8:38, EEST
Avatar
fred
Member
Members
Forum Posts: 41
Member Since:
January 27, 2012
sp_UserOfflineSmall Offline

I figured out that method onConditionRefresh() of my EventListener is called when these refresh events are created. How will I get access to the corresponding RefreshStartEvent or EndEvent fields from either ServiceContext or Subscription, which are the 2 parameters for this method?

April 19, 2012
8:20, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 869
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

These events have no fields except for the EventType.

And you do not see these events in the EventListener.

This is the method in EventManager that does it:

protected boolean refresh(ServiceContext serviceContext,
Subscription subscription) throws StatusException {
fireConditionRefresh(serviceContext, subscription); // calls EventListener.onConditionRefresh
for (MonitoredItemBase item : subscription.getItems())
if (item instanceof MonitoredEventItem) {
final MonitoredEventItem eventItem = (MonitoredEventItem) item;
refreshStartEvent(eventItem);
try {
refreshItem(eventItem);
} finally {
refreshEndEvent(eventItem);
}
}
return true;
}
April 19, 2012
8:40, EEST
Avatar
fred
Member
Members
Forum Posts: 41
Member Since:
January 27, 2012
sp_UserOfflineSmall Offline

If I understand correctly, these events do not provide any fields except EventType. Even if I implement my own EventManager incl. overwriting method refresh using your snippet above, there will be no more fields to set for this kind of events.

April 19, 2012
14:10, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 869
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, they are just “indicator” events.

What would you like to do with them?

April 20, 2012
6:38, EEST
Avatar
fred
Member
Members
Forum Posts: 41
Member Since:
January 27, 2012
sp_UserOfflineSmall Offline

Well, I will do nothing with it 😉

It was a request by the client developer, because he figured out that these events do not provide data like Stamp or NodeId. However, as I also understand these events as only being “indicators” I will discuss with him why I should try to change these events.

Thank you.

April 20, 2012
14:19, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 869
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, they are just Events, compared to Alarms, which have a state and include more fields, defined in ConditionType.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 109

pramanj: 86

ibrahim: 71

kapsl: 57

gjevremovic: 49

TimK: 41

fred: 41

Fransua33: 39

Xavier: 34

rocket science: 33

Member Stats:

Guest Posters: 0

Members: 1283

Moderators: 15

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1100

Posts: 4643

Newest Members:

henryking123, pcygraig5029, corejavatuts, jaynelumpkin4, nandant07, vnd18, arnetteleverett, autumnzzi6, vickiviera, dianames129491

Moderators: Jouni Aro: 869, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 633, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Teppo Uimonen: 21, Markus Johansson: 30, Matti Siponen: 100, Lusetti: 0

Administrators: admin: 1