I\'m working on a project where I\'ll have one application in C# and another one in Python. The C# application will continuously analyse stream of data and raise a flag each
Redis pub/sub is awesome... or ZeroMQ.
Simplest way is PIPE
communication. another simple way that not suggested is SOCKET
programming. Pipes and Named pipes are good solution to communicate between different processes (over different programming languages). SOCKET
programming is like this but may need more Access Level and may be less security.
other type of IPCs seems be unusable.
see for more info:
C# - Pipes
python - Pipes
You may use our aktos-dcs and aktos-dcs-cs libraries. I have successfully used these libraries in production in order to make an RFID Reader (from Impinj) communicate with (actually, integrated in) our telemetry system. The RFID reader has a C# API and we are heavily using Python in our telemetry system.
The simplest test case is a pinger-ponger application, and here is how it looks like with these libraries:
pinger.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using aktos_dcs_cs;
namespace pinger
{
class Pinger : Actor
{
public void handle_PingMessage(Dictionary<string, object> msg)
{
Console.WriteLine("Pinger handled PingMessage: {0} ", msg["text"]);
string msg_ser = @"
{""PongMessage"":
{""text"": ""this is proper message from csharp implementation""}
}
";
System.Threading.Thread.Sleep(2000);
send(msg_ser);
}
}
class Program
{
static void Main(string[] args)
{
Pinger x = new Pinger();
Actor.wait_all();
}
}
}
ponger.py:
from aktos_dcs import *
class Pinger(Actor):
def handle_PingMessage(self, msg_raw):
msg = get_msg_body(msg_raw)
print "Pinger got ping message: ", msg['text'], (time.time() - msg_raw['timestamp'])
sleep(2)
self.send({'PongMessage': {'text': "Hello ponger, this is pinger 1!"}})
if __name__ == "__main__":
ProxyActor()
pinger = Pinger()
pinger.send({'PongMessage': {'text': "Hello ponger, this is STARTUP MESSAGE!"}})
wait_all()