Configure channel in C# app
Javonet allows you to reference and use modules or packages written in (Java/Kotlin/Groovy/Clojure, C#/VB.NET, Ruby, Perl, Python, JavaScript/TypeScript) like they were created in your technology. If have not yet created your first project check Javonet overview and quick start guides for your technology.
With Javonet it is possible to configure communication channel with foreign runtimes via configuration file. Example of such file is presented below:
{
"licenseKey": "your-license-key",
"runtimes": {
"jvm": [
{
"name": "default",
"customOptions": "",
"modules": "",
"channel": {
"type": "inMemory"
}
},
{
"name": "custom1",
"customOptions": "",
"modules": "",
"channel": {
"type": "tcp",
"host": "127.0.0.1",
"port": 8083
}
}
],
"netcore": [
{
"name": "default",
"customOptions": "",
"modules": "",
"channel": {
"type": "tcp",
"host": "127.0.0.1",
"port": 8080
}
},
{
"name": "custom1",
"customOptions": "",
"modules": "",
"channel": {
"type": "tcp",
"host": "127.0.0.1",
"port": 8081
}
}
],
"python": {
"name": "default",
"customOptions": "",
"modules": "",
"channel": {
"type": "inMemory"
}
},
"ruby": {
"name": "default",
"customOptions": "",
"modules": "",
"channel": {
"type": "tcp",
"host": "127.0.0.1",
"port": 8082
}
},
"nodejs": {
"name": "default",
"customOptions": "",
"modules": "",
"channel": {
"type": "inMemory"
}
},
"clr": {
"name": "default",
"customOptions": "",
"modules": "",
"channel": {
"type": "inMemory"
}
},
"perl": {
"name": "default",
"customOptions": "",
"modules": "",
"channel": {
"type": "inMemory"
}
}
}
}
To use this file load it using:
// use Activate only once in your app
Javonet.Activate("your-license-key");
// set up variables
string configFilePath = resourcesDirectory + "/javonetconf.json";
var communicationChannel = Javonet.WithConfig(configFilePath);
// use communicationChannel to create runtimes to interact with
Was this article helpful?