Configure channel in GoLang 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
_, err := Javonet.Activate("your-license-key")
if err != nil {
fmt.Println("Error: " + err.Error())
}
// set up variables
configFilePath := resourcesDirectory + "/javonetconf.json"
communicationChannel := Javonet.WithConfig(configFilePath)
// use communicationChannel to create runtimes to interact with
Was this article helpful?