Re: Problems with callbacks
"Manuel Fünfrocken" <[email protected]> Tue, 23 Aug 2005 10:22:50 +0200
| Newsgroups | gmane.comp.corba.orbacus |
|---|---|
| Message-ID | <[email protected]> |
Hi Stefan!
Your mail is very usefull I think! But I have some question and I think I have to get more detailed:
The server is already given I can`t change anything with it, but the idl already defines the callback interface and the register method.(By the way: I use a nameserver to connect to the server).
The idl: (only a part)
interface CallbackClient
{
void data(in String data);
void exit();
}
interface Server
{
boolean register(in CallbackClient client);
};
jidl already creates an _CallbackClientStub from that I inherit in my Client_impl.
My Question: How could I implement Client_impl as server, without be able to inherit from server relevatet classes?
First, I`ve think that the jidl has already created the Stub in a way, that make callbacks possible, but sending an reference of Client_impl (or _CallbackClientStub) to the register method, raises an exception (BAD_OPERATION ).
Kind Regards
Manuel Fünfrockne
---
University of Applied Science
Saarland/Germany
---------- Original Message ----------------------------------
From: Stefan Blum <[email protected]>
Date: Tue, 23 Aug 2005 09:52:30 +0200
>Hi Manuel,
>
>Manuel Fünfrocken wrote:
>
>>I`ve some questions about callbacks:
>>Is it necessary to implement the client as an server? (with starting a POA, binding to a nameserver etc.) Or does ORBacus handle this?
>>
>>
>Yes, you have to implement a callback interface resulting in a
>client-server. It seems to be a little bit circumstantial, but keeps
>CORBA flexible.
>
>Do the following:
>
>// the "client"
>interface Callback
>{
>void callback();
>}
>
>
>// the "server"
>interface Server
>{
>void someMethod(); // will invoke Callback::callback() within the
>implementation
>void registerClient(in Callback Cb); // to store the object reference
>}
>
>the implementation class (servant) of Server contains the object
>reference as a member.
>
>within booting the application:
>- start the server
>- start the client
>- register the client to the server before you invoke someMethod();
>
>Alternatively, you may use a nameserver. In this case, you can skip the
>registerCallback() method.
>- start the server
>- start the client
>- register the client to the nameserver
>- in someMethod(): fetch the Callback object reference from the nameserver.
>
>I prefer the first alternative, because you only need two "instances"
>and no nameserver.
>
>Isn't too complicated, is it?
>
>Best regards,
> Stefan
>
>
>
>
_______________________________________________
OB-Users Mailing List - [email protected]
http://mail.ooc.nf.ca/mailman/listinfo/ob-users
Visit our support FAQ before you send a message.
http://www.orbacus.com/faq/support.html