memphis icon indicating copy to clipboard operation
memphis copied to clipboard

Feature: C Client

Open rupurt opened this issue 2 years ago • 5 comments

Current behavior

Add an officially supported C client. This would enable any language that supports the C ABI to create bindings e.g. C++, Zig, ...

Suggested solution

No response

Additional context

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Contributing Docs

  • [X] I agree to follow this project's Contribution Docs

rupurt avatar Jul 18 '23 04:07 rupurt

Hey @rupurt, Thanks for the request. Adding it to the "future discussion" board.

yanivbh1 avatar Jul 18 '23 07:07 yanivbh1

Hey @rupurt, could you please add short description of required flows? (this is also a check that you still need this functionality)

i am thinking about possibility to add gRPC access to memphis it will allow to generate code of the client side and as far as i understand c++ is supported by gRPC i am not sure regarding C :-(

g41797 avatar Nov 13 '23 08:11 g41797

I am looking for a C++ SDK. gRPC would definitely solve produce and consume but would probably not work for other SDK functions like creating a station.

I started on compiling the go SDK as a c library and building a C++ wrapper around it. It worked for simple string consume and produce. I haven't had time to dive deeper into all functions, e.g. protobuf or json.

ChibangLW avatar Nov 14 '23 23:11 ChibangLW

I'd like to clarify proposed solution:

  • proto files - definitions of structures and apis
  • generation of go code for client and server
  • implementation of go based gRPC server process (memphis bridge)
    • receive grpc "requests"
    • "translates" to memphis
    • this process runs as stand alone or as part of memphis containers
  • you can generate C++/PHP/etc client code and use it in own application

see grpcadapter repo

g41797 avatar Nov 15 '23 07:11 g41797

Supported APIs:

service AdapterService {
	rpc CreateStation(CreateStationRequest) returns (Status) {}
	rpc DestroyStation(DestroyStationRequest) returns (Status) {}
	rpc Produce(stream ProduceMessages) returns (Status) {}
	rpc Consume(stream ConsumeMessages) returns (stream ConsumeResponse) {}
}

see proto files

g41797 avatar Dec 03 '23 05:12 g41797