Passing data between C# and Java Apps

I have an API in C# .Net for uploading files whose size vary between 10 B - 100 KB. Per second, the system receives around 5 such calls. Now I want to pass this file to a JAVA process (Because it is a producer of Kafka, and we want it to be JVM based, while C# API is legacy). Both are going to reside on the same machine almost always. What is the best way of doing that?

I read about jni4net, IKVM for interacting with Java from C#. Would they be better or should I make it socket based (Web API in Java accepting the files), or should I read from the local filesystem where C# App has uploaded or any other option that I am missing?

-------------Problems Reply------------

In environment with high concurrency, reading from the local file-system might not be good idea.

You could use memory mapped files which java supports with FileChannel.

Depending on operating system, you could also use Named pipes for IPC, here is an article showing how to use pipes between .Net and Java:

All options considered, i would go with sockets. They are portable and easy to do and will most likely meet performance requirements you have.

You may also use a message queue. You can either put a binary message, serialize the file or put the location of file on the queue if you are storing the files in the file system.

A solution with sockets and message queues will allow you to have a more distributed architecture i.e. not loading a single machine with too much work.

If you want to actually use the C# API from Java, a bridge is probably the way to go. It'll likely be more efficient than a Web API. Some bridges will also allow you to run the C# and the Java in the same process, which is more efficient still.

In addition to the bridges you mention, you might want to consider JNBridgePro. You can find more information at our website.

Disclosure -- I am affiliated with JNBridge.

Category:java Views:0 Time:2018-02-10

Related post

  • How to pass Date between PHP and Java? 2012-04-08

    I'm building a small webservice and the client is an android client. I must use dates and I want to save it in my database. The server side is in PHP and the client is in Java. What format is the best to send date to PHP and how can I convert it easi

  • Passing pointers between C and Java through JNI 2009-10-27

    At the moment, i'm trying to create a Java-application which uses CUDA-functionality. The connection between CUDA and Java works fine, but i've got another problem and wanted to ask, if my thoughts about it are correct. When i call a native function

  • How should I pass data between classes and application layers? 2010-03-05

    For example, if I am creating a 3 layer application (data / business / UI) and the data layer is grabbing single or multiple records. Do I convert everything from data layer into generic list/collections before sending to the business layer? Is it ok

  • How to pass data between controls and persist the values in WPF 2010-05-27

    I am stuck on how to pass data from one control to another. If I have a listbox control and the Contol Item contains a datatemplate which renders out 5 fields ( first name, last name, email, phone and DOB) all of which come from an observable collect

  • How do I pass data between controllers and overloaded actions? 2011-03-13

    I have one controller that takes a username and pass and checks against a database. IF the user is authenticated, I want to call an overloaded action on another controller. My end goal is to authenticate a user against an old table from a MySQL db (I

  • Spring: passing data between server and client (Java objects to JS objects) 2012-04-23

    I want to implement transparent data passing between my server (using Spring) and client (in ExtJS). On the server side I have Spring Controllers returning ModelAndView objects (using JSPs). I usually don't create model objects, I just put items into

  • How to pass data between BLL and UI in 3-layer (single tier) application? 2009-12-04

    I am a fairly rookie programmer who is trying to learn the basics of n-layered architecture (DAL, BLL, UI). The application I am programming is a single tier, 3-layer application written in VB.NET (.Net 3.5). Layers as follows: DAL BLL UI COMMON - co

  • Passing data between HTTPS and HTTP 2010-01-01

    I've recently faced a problem involving passing data (small amount), from a page to an iframe. It was simple when both pages were http - i've used query string to pass information to the iframe and javascript to signal the parent page of process comp

  • Please suggest infrastructure for passing data between C# and C++ 2011-05-18

    I'm using P/invoke to interoperate between C# and C++ in this project. I'd like to pass data structures that are symmetrically defined. What's the best infrastructure to use? Could protocol buffers be useful here? --------------Solutions-------------

  • how to pass data between service and it's application in the right way? 2012-02-13

    i'm a newbie in android. In my app i create a many-to-many chat, and need to update from server a list of Messages. In order to do so, i created a service that updates every second from the server. My problem is that i don't know how to pass data bac

  • Passing data between PHP and C executable in linux 2011-11-19

    Under Linux ,if I want to pass pure string from PHP to C, how do i do that? what I've tried do far is: exec("./myexec.bin -a mystring"); in PHP and getopt(argc,argv, "a:"); in C everything works, but when i pass strings longers than MAX_ARG_STRLEN (1

  • plist as persistent storage for storing and retrieving data between closing and restarting app 2010-11-16

    I am trying to save few property into the plist when the user starts the app for the first time, and then I have to retrieve those data and show it to the user, when the user restart the app, so that I don't have to ask for the same data again. I am

  • Passing data between dialog and panel 2011-04-18

    I am new to swing, i have a box which gets opened from a frame. User has options to fill some data in the dialog, now this data needs to be passed to the frame and updated in table. will firepropertychange work in this case? Any help will be apprecia

  • Passing data between driver and Windows service 2011-05-27

    What is the cleanest way to pass data from device driver to windows service and back? --------------Solutions------------- This is normally achieved using Device Input and Output Control (IOCTL). You can define your own private control code and then

  • Eclipse, Android, 2.2, Attempting to pass data between Activities and then place data in a email intent 2011-05-28

    I am attempting to pass data from Activity B back to Activity A and then through a button with an email Intent (on Activity A) I would like to add the data from Activity B to the text of the email. this is what I have so far: Activity B String firein

  • How to pass xml data between c# and java sockets 2010-07-23

    I have a c# server and a java client. Currently they pass plain text between each other using sockets. Now I want to change these sockets to communicate in XML. I can implement the java side, But i do not know how to implement the c# server side so t

  • Passing data between jQuery and Servlet 2011-11-15

    I have a HTML form: <head> <script src="//"></script> <script type="text/javascript"> $(document).ready(function() { $('#convert').click(function(){ //pairno tis times ap tin

  • Reading and writing data between c# and java sockets 2012-01-19

    I've been fighting with this all day. I need to send Strings (JSON) between a C# server and a Java client. I have to have the first 4 bytes (always 4 bytes) as the length of the message (the header so we know how long the rest of the message is) and

  • Android: Passing data between service and activity 2010-09-19

    So I'm getting really confused on how to do this whole thing and I was hoping someone could break it down for me a little bit. I have a service that should always be running, and at certain times it needs to alert the user that a task is to be comple

  • Passing Data Between Views and Controllers 2010-02-04

    I'm working on an application that manages people and their spouses, if married. Essentially a person will be entered and then from that person I want to be able to add a spouse. My database schema is like this. Persons (Person_ID, Name, BirthDate, e

  • Performance of passing data between .Net and COM assemblies 2010-02-22

    I am in the process of migrating a legacy VB6 app to .Net, however since it is a high-profile business critical application, it is being done piece by piece. In the interest of improving performance, there is one method which gets hit a lot,thousands

  • Eclipse: Pass data between IMarker and IMarkerResolution 2010-10-18

    What is the established way to pass some data — more than int, boolean, String because those can be handled as marker attributes — from the class that creates an IMarker to an IMarkerResolution so that the quick fix can be "smart" about what it displ

  • maintain session/connection between php and java app 2010-10-29

    A) If I have a java application which starts up and waits for socket connections on a specified port. Is there a way i could maintain a session connection in php after a user validates, i.e a persistent connection? B) I mean, I'm trying to understand

  • Sync Core Data Between iPhone and iPad app 2011-08-04

    I have an iPhone app and I want to make it universal so it works on the iPad. Is there an easy way to setup sync between the iPhone and iPad? I'm absolutely a noob when it comes to URL and HTML requests and json etc. --------------Solutions----------

Copyright (C), All Rights Reserved.

processed in 0.225 (s). 11 q(s)