Problem with orber, alternate iiop and naming service rebind
Niclas Eklund
nick@REDACTED
Thu Jun 12 14:19:21 CEST 2003
Hello!
I'm affraid that this might cause problems:
CompleteChannel = corba:add_alternate_iiop_address(Channel,"localhost",1450),
If you create the event channel on hostA, the IOR will contain:
MainHost == hostA
MainPort == 1450
Adding the alternate-IIOP component using the above returns an IOR which
contains:
MainHost == hostA
MainPort == 1450
AltHost == localhost
AltPort == 1450
If the client, located on hostB, cannot connect to MainHost/MainPort, it
will try to use AltHost/AltPort. Since AltHost == localhost, which,
from the clients point of view, is hostB, this will not work.
When resolving the NameService you use a different port-number. Do you
intend to store the IOR using another ORB:s NameService? You also use
IIOP-version 1.0, which doesn't support alternate-IIOP components
(compliant with the OMG specification).
Naming = corba:string_to_object("corbaloc::1.0@REDACTED:1235/NameService"),
Naturally, it helps if your other ORB also supports
TAG_ALTERNATE_IIOP_ADDRESS. ;-)
If you want to access the local NameService you should use the following:
Naming = corba:resolve_initial_references("NameService"),
It would help a lot if you could tell me which versions (cosEvent & Orber)
you're using (cosEventApp:module_info(). & orber:module_info().)
I cannot recommend that you use any other way to start the event channel
besides the ones you find in the cosEvent documentation:
%% Start a channel using the default configuration
Ch = cosEventApp:start_channel(),
%% ... or use configuration parameters.
Ch = cosEventApp:start_channel(Options),
Options == [{pull_interval, Seconds} | {typecheck, Boolean} |
{maxEvents,Integer} |{blocking, Boolean}]
Best Regards,
Nick
> Hi,
>
> We are currently using the Erlang implementation of the CORBA Event
> Channel, replacing a previously existing one.
>
> We have one rather mischevious problem, though, and we can't seem to
> find our way out. Erlang version is 5.2
>
> We have the following code to start our event channel:
>
> -----------------
>
> -module(event_channel).
> -export([start/0,stop/0,start_orb/0,start_event/0]).
>
> start()->
> start_orb(),
> start_event().
>
> stop()->
> orber:uninstall().
>
> start_orb() ->
> orber:configure(iiop_port,1450),
>
> % Must use version 1.2 (for corba:add_alternate_iiop_address(...))
> orber:configure(giop_version,{1,2}),
>
> % Start orber
> mnesia:start(),
> corba:orb_init([{domain,"MyDomain"}]),
> orber:install([node()],[{ifr_storage_type,ram_copies}]),
> orber:start(),
> ok.
>
> start_event() ->
> cosEventApp:install(),
> cosEventApp:start(),
>
> % Create event channel
> Channel = 'oe_CosEventComm_Channel':oe_create([{domain,"MyDomain"},{blocking,false}],[{persistent,true}]),
>
> % Add additional iiop address
> CompleteChannel = corba:add_alternate_iiop_address(Channel, "localhost", 1450),
>
> % Register full reference (with both iiop addresses) in naming service
> Naming = corba:string_to_object("corbaloc::1.0@REDACTED:1235/NameService"),
> Name = lname:new(["CosEventService"]),
> 'CosNaming_NamingContext':rebind(Naming,Name,CompleteChannel),
>
> CompleteChannel.
>
> -----------------
>
> We would like our channel to listen for requests on two specific
> interfaces: a network card and the loopback (==localhost). Thus can we
> have robust CORBA connections locally to the machine where the event
> channel is running.
>
> So, we make our event channel listen on all interfaces (default), and
> we would like to publish (via the naming service) a double reference.
> With the previously used ORB, this resulted into having two IORs
> available under the same name in the naming service.
>
> With Orber, we could verify that only the network interface is visible
> in the registered CORBA reference. Our processes, when using the naming
> service, only get a reference to the network interface :b. When we lose
> the network, our local applications lose their event channel connection
> instead of using the local loopback.
>
> Apparently, the :rebind does not make the alternate IIOP visible in the
> IOR submitted to the naming service.
>
> Can anyone suggest a fix / workaround / hack for that?
>
> Alexandre Betis
More information about the erlang-questions
mailing list