Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » EventHandler not being called!
EventHandler not being called! [message #642858] Fri, 03 December 2010 01:12 Go to next message
AppleJus Mising name is currently offline AppleJus Mising nameFriend
Messages: 46
Registered: July 2010
Member
Hi there,

I am really stuck on this one, I appreciate any help:

I have two parts in my app. In the code of the first part, I create and initialize an eventBroker using the IEContext, and pass to it an object via post().
In the second part, I want to get this object, so I create and initialize an eventBroker again using the IEContext, and also create an eventHandler. The problem I am getting is that the method handleEvent(...) is not being called.
I put some System.err.println() there and it is just confirming is it not being called, even though the .subscribe() call is returning successful. I have subscribed and posted data on the same topic string, I call "NEWDATA".

eventHandler = new EventHandler() {


@Override
public void handleEvent(org.osgi.service.event.Event event) {

System.err.println("TEST2: ");

CNCE_E.CNCE = (CreateNewCaseEncapsulate) event
.getProperty("NewCaseCreated");

}
};

System.err.println("SUCCESS: "
+ eventBroker.subscribe("NEWDATA", eventHandler));
Re: EventHandler not being called! [message #642880 is a reply to message #642858] Fri, 03 December 2010 07:43 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
How does your subscription look like? How does your post code look like?
Maybe there's a missmatch in your topics?

Tom

Am 03.12.10 02:12, schrieb AppleJus:
> Hi there,
>
> I am really stuck on this one, I appreciate any help:
>
> I have two parts in my app. In the code of the first part, I create and
> initialize an eventBroker using the IEContext, and pass to it an object
> via post().
> In the second part, I want to get this object, so I create and
> initialize an eventBroker again using the IEContext, and also create an
> eventHandler. The problem I am getting is that the method
> handleEvent(...) is not being called.
> I put some System.err.println() there and it is just confirming is it
> not being called, even though the .subscribe() call is returning
> successful. I have subscribed and posted data on the same topic string,
> I call "NEWDATA".
>
> eventHandler = new EventHandler() {
>
>
> @Override
> public void handleEvent(org.osgi.service.event.Event
> event) {
>
> System.err.println("TEST2: ");
>
> CNCE_E.CNCE = (CreateNewCaseEncapsulate) event
> .getProperty("NewCaseCreated");
>
> }
> };
>
> System.err.println("SUCCESS: "
> + eventBroker.subscribe("NEWDATA", eventHandler));
Re: EventHandler not being called! [message #643227 is a reply to message #642880] Mon, 06 December 2010 07:48 Go to previous message
AppleJus Mising name is currently offline AppleJus Mising nameFriend
Messages: 46
Registered: July 2010
Member
Hi, here is the post code, in the other part class:

//send the CNCE object

eventBroker = (IEventBroker) context.get( IEventBroker.class.getName() );

if (eventBroker != null) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("NewCaseCreated", CNCE);
eventBroker.post("NEWDATA", map);

}
Previous Topic:Problems migrating to 4.1 (creating target platform)
Next Topic:Problems between 4.0 based target platform and 4.1 based target platform.
Goto Forum:
  


Current Time: Thu Apr 25 00:40:45 GMT 2024

Powered by FUDForum. Page generated in 0.02894 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top