r3mbol
r3mbol

Reputation: 261

How can I use java-specific types in Thrift service?

I'm writing a Thrift service which basic function is to proxy all the queries to EJB Beans. Basically service would receive a call, look up a local bean, forward a query to the bean and forward the answer back to client.

Main problem is that thrift IDL doesn't support language-specific types. For example, one of the method parameter is an object implementing interface Inamed (which extends Serializable).

How can I tell thrift that I want to import this interface from, say, "my.package.interfaces.INamed" and use it as a valid parameter/return type?

Upvotes: 1

Views: 395

Answers (1)

DNA
DNA

Reputation: 42597

If you want to send arbitrary objects via Thrift, you can serialize them and send them as Thrift binary data and deserialize them at the other end. This would bypass type-checking though.

But Thrift is designed to be language-independent, so I don't think you can express language-specific types in the IDL.

Can you just define a Thrift struct that matches INamed and then use this in your other Thrift methods?

Upvotes: 2

Related Questions