3

I have a task that involves talking to a .NET-based API (namely AutoCAD) to retrieve data, send commands, and react to events.

I want to separate the API operations and the proper program logic (largely already implemented in Python) by using natural tools for both: a C# DLL for the former and a Python app for the latter.

To connect these two pieces, I began exchanging JSON in ZeroMQ messages. I'm at early development stages but having recently discovered that ZeroMQ does not guarantee message delivery/order, I have reservations about whether this is a feasible way to go. Right now my app is a very basic REQ/REP pair and I plan to handle reacting to events and executing different commands by adding some sort of 'recipient-function' field to my message format.

The reason that I want to use ZMQ is that I might be able to scale the software into a larger, multi-user, distributed solution sometime.

I am a lay programmer so I would ask for your advice about this architecture. Should I just go ahead with it and plan to deal with message reliability/ordering when problems appear? Should I consider developing some kind of a REST wrapper around ZMQ?

4
  • Are you sure it's not just worth writing this in C# or F#? Commented Oct 17, 2013 at 11:21
  • I understand your concern but yes, I'm pretty sure. My reasons are having almost zero experience in C#, much better authoring productivity in Python and the need to show a proof-of-concept to automate AutoCAD with Python scripts. It seems that I practically end up writing a socket-based wrapper around C# methods but I want to give it a try anyways.
    – Alex Bausk
    Commented Oct 17, 2013 at 11:50
  • pythonnet.sourceforge.net - Do both. Write a .NET Assembly using the Python language. Commented Oct 17, 2013 at 12:28
  • Tried and failed. I don't know if it's my inability to implement the binding to .NET correctly or there are objective issues with PythonNET.
    – Alex Bausk
    Commented Oct 17, 2013 at 12:30

1 Answer 1

2

ZeroMQ probably wouldn't be my first choice for this, but it should be doable. The ZeroMQ manual has a section on reliability with REQ/REP sockets is there something you need beyond that? As far as ordering goes would a simple 1 up counter work? It would work more or less like TCP does if you receive a message before its time hold on to it and wait for the earlier message and perhaps send a response asking for a repeat of the missing message.

4
  • Thanks, that's valuable feedback. Any additional advice on what alternatives I could explore? It needs mentioning that the target is a Windows desktop so I try to avoid adding any demon processes that are (to my understanding) involved in using RabbitMQ or similar message brokers.
    – Alex Bausk
    Commented Oct 17, 2013 at 11:48
  • The ZMQ manual on reliablility (chapter 4) is awesome, I overlooked it! So, doable then. zguide.zeromq.org/page:all#reliable-request-reply
    – Alex Bausk
    Commented Oct 17, 2013 at 12:06
  • 1
    @AlexBausk You might investigate MSMQ. It has a max message size of 4MB so it may not work depending on how big your messages can get. It is built into the OS so deployment is relatively easy.
    – stonemetal
    Commented Oct 17, 2013 at 20:31
  • They can get pretty big (thousands of graphical entities with attributes). I think I'll stick with ZeroMQ, thanks!
    – Alex Bausk
    Commented Oct 19, 2013 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.