Search code examples
c#thrift

How to use a service as a type in Thrift


When I compile this example.thrift file with command thrift-0.11.0.exe --gen charp .\example.thrift I got this error: Type "Interface1" not defined

service Interface1 
{
    void add(1:list<string> a)
}

service Interface2
{
    bool isThere(1:Interface1 item)
}

How to use Interface1 as a type of a method in Interface2?


Solution

  • Passing interface references is not supported in Apache Thrift. You could pass a struct with a service end point (hostname/ip, port and service name) however, then the receiver could use those coordinates to make a call back if that is what you are after.