Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9136207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:55:21+00:00 2026-06-17T08:55:21+00:00

I started to use apache thrift (programming for java) and It’s very hard to

  • 0

I started to use apache thrift (programming for java) and It’s very hard to find documentation which explain in deeply about it – so I hope you’ll be able to help me.

I’m trying to make an service (interface) which has a function that return a field with functions (for example: another interface).

I tried this code:

namespace java test

service A {
  string somefunc()
}

service B {
  string somefunc2(),
  A getA()
}

But I didn’t success.. when I try to compile the thrift file I get an error that it in service B – A field is not defined.

I tried also:

namespace java test

struct A {
  1: string somefunc()
}

service B {
  A getA()
}

This time it compiled successfully but it didn’t count somefunc as a function however as a field in type of string.

Is there anyway make something like what I want?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:55:22+00:00Added an answer on June 17, 2026 at 8:55 am

    Thrift sends serialized data structures over the wire. There’s no standart way to send executable code. Various languages allow transferring code over the wire (i.e., java .class file or python script in text form) but can’t be made interoperable and thus not supported by thrift.

    However, thrift might be used for service discovery, if it’s what you need. Single thrift service is always bound on specific host/port. So, thrift definition for service discovery code might look like this:

    namespace java test
    
    struct Endpoint {
      1: required string host;
      2: required i32 port;
    }
    
    service A {
      string somefunc()
    }
    
    service B {
      string somefunc2(),
      Endpoint getA()
    }
    

    The service discovery code might look like this:

    B.Client bClient = <.....>
    
    Endpoint endpoint = bClient.getA();
    TTransport transport = new TSocket(endpoint.host, endpoint.port);
    transport.open();
    A.Client aClient = = new A.Client(new TBinaryProtocol(transport));
    aClient.somefunc2();
    

    If it’s needed, Endpoint definition might be extended with protocol/transport metadata allowing to choose between binary/compact/JSON protocols and TTransport/TFramedTransport/etc..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started reading the Apache commons documentation but its very extensive so I
I have just started to use Apache Maven. Now I would like to make
Solution: Use a better tutorial- http://hadoop.apache.org/mapreduce/docs/r0.22.0/mapred_tutorial.html I just started working with MapReduce, and I'm
I've recently started working with java and I'm facing some issues with the apache
I started using Thrift about a week ago. I got the latest source from
When I started my first bigger Rails application, I chose to use Apache (with
We started using Apache Felix Karaf for a project, and make use of Blueprint
I have very recently started development on a multiplayer browser game that will use
I started to use Lex for my homework. In my Lex file, I always
I started to use CakePHP (1.2) a few months ago to add small features

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.