[jacorb-developer] Typed Push Consumer will reconnect after second Supplier failure

Troy Hicks troy.a.hicks at gmail.com
Thu Jun 7 18:38:19 CEST 2012


I have a solution that seems to work empirically.  Basically what I did to
work around this issue was to allow the typed push consumer ( which extends
org.omg.PortableServer.Servant and implements
org.omg.CORBA.portable.InvokeHandler ) to reconnect the first time after
having its disconnect_push_consumer() method called upon loss of connection
to the supplier.  However, upon subsequent calls to my consumer's
disconnect_push_consumer() method an exception is generated when this
consumer attempts to reconnect to the supplier.  In this case, I set a flag
internally indicating that the reconnect failed and I have the consumer
disconnect itself from the push supplier and also have the consumer
deactivate itself via the POA. Once this disconnection and deactivation
have been done, the consumer object reference (in an a different class) is
set to null (abandoned) and a new one is created, which just mirrors the
start-up case.  At this point the (new) consumer can receive events again
from the supplier.  A code snippet from the consumer object that catches
the exception, sets the flag, disconnects from the supplier and deactivates
itself with the POA is shown below for reference.

Aside:  I'm not 100% on why this works, especially given the fact that the
consumer can reconnect once to a new supplier but not subsequent times...
 (Maybe this is corba 101, or maybe this will help someone else...)

Snippet from consumer:

            catch (Exception ex)
            {
               System.err.println("Exception while narrowing event service,
disconnect from supplier and deactivate:  " + ex);
               reconnectFailed = true;
               odsEventChannelProxyPushSupplier.disconnect_push_supplier();
               try
               {

ODSClientIF.instance.poa.deactivate_object(activatedObjectID);
               }


On Tue, May 22, 2012 at 9:40 PM, Troy Hicks <troy.a.hicks at gmail.com> wrote:

> I have a typed push consumer that senses the failure of the supplier
> via the disconnect_push_consumer() method, when the supplier app is
> stopped and started, and will reconnect and receive events via the
> event channel.  However, when the supplier is stopped and started a
> second time, the consumer will again sense the failure of the
> supplier, but it will not successfully reconnect and fails when I call
> the ProxyPushSupplier.connect_push_consumer(....) method with the
> following exception:
>
> Exception:
> "org.omg.ProtableServer.CurrentPackage.NoContext:
> IDL:omg.org/ProtableServer/Current/NoContext:1.0"
>
> Code snippet:
>                // NPES-.OVERLAYS-.Overlay_ev-active
>                cds.CosTypedEventChannelAdmin.TypedConsumerAdmin
> ttypeConsumerAdmin
>                   = teventChannel.for_consumers();
>                cds.CosEventChannelAdmin.ProxyPushSupplier
> tproxyPushSupplier
>                   =
> ttypeConsumerAdmin.obtain_typed_push_supplier("Overlay_ev");
>                tproxyPushSupplier.connect_push_consumer(
>                   cds.CosTypedEventComm.TypedPushConsumerHelper.narrow(
>
> ODSClientIF.instance.poa.servant_to_reference(this)));
>  // fails here the second time around....
>                connectedToEventService = true;
>
> How might I improve my application to survive the supplier going away
> and then coming back whether due to a network outage or stopping and
> starting the supplier?
> Any help would be greatly appreciated,
> Troy
>


More information about the jacorb-developer mailing list