Discussion:
[omniORB] omnievents between 2 separate machines
Paul McMahon
2007-02-01 15:35:47 UTC
Permalink
When using omnievents between 2 machines, does the client need to have
omnievents daemon running?

Or is it sufficient for client to just link with a local copy of omnievents
library and use the naming service on the server to obtain the EventChannel
and then receive events?

So far I have got the following working:

server
------------
omnievents running on server
eventchannelfactory and eventchannel created (and appear in nameclt list)
pushes events correctly according
to /var/lib/omniEvents/omnievents-hostname.log

client
----------
uses PushConn.java example supplied with omnievents.
obtains namingservice correctly from server
BUT search for eventchannel always returns "Failed to find EventChannel in
NameService. NamingContext::NotFound"

//
// Obtain object reference to EventChannel
// (from command-line argument or from the Naming Service).
if (g.getOptind() < args.length) {
action = "convert URI from command line into object reference";
obj = orb.string_to_object(args[g.getOptind()]);
} else {
action = "resolve initial reference 'NameService'";
obj = orb.resolve_initial_references("NameService");
NamingContext rootContext = NamingContextHelper.narrow(obj);
if (rootContext == null)
throw new OBJECT_NOT_EXIST();

NameComponent name[] = { new NameComponent(channelName,
channelKind) };

action = "find EventChannel in NameService";
System.out.println(action);

Following line throws NotFound Exception--->
obj = rootContext.resolve(name);
}

(channelName and channelKind are set to "EventChannel" which matches what's on
the server).

Any help much appreciated.

-Paul McMahon
Alex Tingle
2007-02-01 20:03:39 UTC
Permalink
Hi Paul,
Post by Paul McMahon
When using omnievents between 2 machines, does the client need to have
omnievents daemon running?
You only need one omniEvents daemon running,
Post by Paul McMahon
Or is it sufficient for client to just link with a local copy of omnievents
library and use the naming service on the server to obtain the
EventChannel
and then receive events?
You are best off using libCOS that comes with omniorb, rather than the
client library that comes with omniEvents. That way you don;t need to
install anything special on the client machine.
Post by Paul McMahon
server
------------
omnievents running on server
eventchannelfactory and eventchannel created (and appear in nameclt list)
How do they appear in nameclt list? Do you see

EventChannel
(id=EventChannel)

or

EventChannel.EventChannel
(id=EventChannel, kind=EventChannel)
Post by Paul McMahon
pushes events correctly according
to /var/lib/omniEvents/omnievents-hostname.log
What are you using to push events? If it can find the channel, then the
consumer ought to be able to find it too.
Post by Paul McMahon
client
----------
uses PushConn.java example supplied with omnievents.
obtains namingservice correctly from server
BUT search for eventchannel always returns "Failed to find
EventChannel in
NameService. NamingContext::NotFound"
//
// Obtain object reference to EventChannel
// (from command-line argument or from the Naming Service).
if (g.getOptind() < args.length) {
action = "convert URI from command line into object reference";
obj = orb.string_to_object(args[g.getOptind()]);
} else {
action = "resolve initial reference 'NameService'";
obj = orb.resolve_initial_references("NameService");
NamingContext rootContext = NamingContextHelper.narrow(obj);
if (rootContext == null)
throw new OBJECT_NOT_EXIST();
NameComponent name[] = { new NameComponent(channelName,
channelKind) };
action = "find EventChannel in NameService";
System.out.println(action);
Following line throws NotFound Exception--->
obj = rootContext.resolve(name);
}
(channelName and channelKind are set to "EventChannel" which matches what's on
the server).
Are you sure that the id and kind match? By default kind is set to "".

Are you sure that your client machine is talking to the same naming
service as the server? What does 'nameclt list' say when you run it on
the client?

You realise that Java has to be told where to find the naming service
in its own ideosyncratic way?

-Alex

--
:: Let me solve your problems: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net +44-7901-552763
Paul McMahon
2007-02-02 15:50:35 UTC
Permalink
Hi Alex,

Thanks for your help.

The problem turned out to be on the java side. I found that I had to
explicitly code the reference of the eventchannel to the following to get it
to narrow the eventchannel successfully.

obj=orb.string_to_object("corbaname::serveripaddress:2809#EventChannel");

My attempts at getting this reference from the naming service failed from
java, something to do with setting up equivalent of InitRef (omniORB.cfg) on
java side. I tried -ORB parameters but these didn't work. Of course java has
it's own way of setting this up which I couldn't find any good documentation
for. If anyone has any good tips let the list know.

Anyway the hard coded name is good enough for the time being as this is only
required temporarily for some test purposes.
Post by Alex Tingle
Hi Paul,
Post by Paul McMahon
When using omnievents between 2 machines, does the client need to have
omnievents daemon running?
You only need one omniEvents daemon running,
Post by Paul McMahon
Or is it sufficient for client to just link with a local copy of omnievents
library and use the naming service on the server to obtain the EventChannel
and then receive events?
You are best off using libCOS that comes with omniorb, rather than the
client library that comes with omniEvents. That way you don;t need to
install anything special on the client machine.
Post by Paul McMahon
server
------------
omnievents running on server
eventchannelfactory and eventchannel created (and appear in nameclt list)
How do they appear in nameclt list? Do you see
EventChannel
(id=EventChannel)
or
EventChannel.EventChannel
(id=EventChannel, kind=EventChannel)
Post by Paul McMahon
pushes events correctly according
to /var/lib/omniEvents/omnievents-hostname.log
What are you using to push events? If it can find the channel, then the
consumer ought to be able to find it too.
Post by Paul McMahon
client
----------
uses PushConn.java example supplied with omnievents.
obtains namingservice correctly from server
BUT search for eventchannel always returns "Failed to find
EventChannel in
NameService. NamingContext::NotFound"
//
// Obtain object reference to EventChannel
// (from command-line argument or from the Naming Service).
if (g.getOptind() < args.length) {
action = "convert URI from command line into object reference";
obj = orb.string_to_object(args[g.getOptind()]);
} else {
action = "resolve initial reference 'NameService'";
obj = orb.resolve_initial_references("NameService");
NamingContext rootContext = NamingContextHelper.narrow(obj);
if (rootContext == null)
throw new OBJECT_NOT_EXIST();
NameComponent name[] = { new NameComponent(channelName,
channelKind) };
action = "find EventChannel in NameService";
System.out.println(action);
Following line throws NotFound Exception--->
obj = rootContext.resolve(name);
}
(channelName and channelKind are set to "EventChannel" which matches what's on
the server).
Are you sure that the id and kind match? By default kind is set to "".
Are you sure that your client machine is talking to the same naming
service as the server? What does 'nameclt list' say when you run it on
the client?
You realise that Java has to be told where to find the naming service
in its own ideosyncratic way?
-Alex
--
:: Let me solve your problems: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net +44-7901-552763
Loading...