TServiceInterface
- Service interface.
The provided service type must be an interface fulfilling following criteria:
// Declaring the service.
public interface IHello
{
// Declares event which notifies String.
// Note: This event would not be compatible in cross Java/C# communication.
Event<String> someEventHappend();
// Declares event which notifies EventArgs.
// Note: event arguments derived from EventArgs can be used in cross Java/C# communication.
Event<EventArgs> otherEventHappened();
// Declares method taking arguments and returning a value.
int calculate(int a, int b);
// Declares method taking arguments and returning void.
// Note: MyArgumentType must be serializable. It means the serializer used for the communication
// must be able to serialize it.
void performSomething(MyArgumentType param);
}
The following example shows how to declare interface that can be used for Java/C# communication.
// C# interface
public interface IMyInterface
{
// Event without arguments.
event EventHandler SomethingHappened;
// Event with arguments.
event EventHandler<MyEventArgs> SomethingElseHappened;
// Simple method.
void DoSomething();
// Method with arguments.
int Calculate(int a, int b);
}
.
// Java equivalent
// Note: Names of methods and events must be same. So e.g. if the interface is declared in .NET with
// then you may need to start method names with Capital.
public interface IMyInterface
{
// Event without arguments.
Event<EventArgs> SomethingHappened();
// Event with arguments.
Event<MyArgs> SomethingElseHappened();
// Simple method.
void DoSomething();
// Method with arguments.
int Calculate(int a, int b);
}
public interface IRpcService<TServiceInterface> extends IAttachableDuplexInputChannel
Modifier and Type | Method and Description |
---|---|
Event<ResponseReceiverEventArgs> |
responseReceiverConnected()
Event raised when a client connected the service.
|
Event<ResponseReceiverEventArgs> |
responseReceiverDisconnected()
Event raised when a client got disconnected from the service.
|
attachDuplexInputChannel, detachDuplexInputChannel, getAttachedDuplexInputChannel, isDuplexInputChannelAttached
Event<ResponseReceiverEventArgs> responseReceiverConnected()
Event<ResponseReceiverEventArgs> responseReceiverDisconnected()