Skip to content

Instantly share code, notes, and snippets.

View daneshk's full-sized avatar

Danesh Kuruppu daneshk

View GitHub Profile
service "RouteGuide" on new grpc:Listener(8980) {
remote function GetFeature(Point point) returns Feature|error {
foreach Feature feature in FEATURES {
if feature.location == point {
return feature;
}
}
return {location: point, name: ""};
}
service RouteGuide {
rpc GetFeature(Point) returns (Feature) {}
}
import ballerina/io;
import ballerina/jballerina.java;
public function main() {
LogRecord logRecord = {
time: "2021-05-04T10:32:13.220+05:30",
level: "DEBUG",
module: "foo/bar",
message: "debug \n message",
// This is the server implementation for the client streaming scenario.
import ballerina/grpc;
import ballerina/log;
@grpc:ServiceConfig {
name: "HelloWorld",
clientStreaming: true
}
service HelloWorld on new grpc:Listener(9090) {
@daneshk
daneshk / HelloRequest.java
Last active September 10, 2018 18:52
Generated java code for HelloRequest message
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ExampleServices.proto
package com.example.grpc;
/**
* Protobuf type {@code com.example.grpc.HelloRequest}
*/
public final class HelloRequest extends
com.google.protobuf.GeneratedMessageV3 implements
import ballerina.log;
import ballerina.io;
import ballerina.net.http;
// This service is a participant in the distributed transaction. It will get infected when it receives a transaction
// context from the participant. The transaction context, in the HTTP case, will be passed in as custom HTTP headers.
@http:configuration {
basePath:"/",
host:"localhost",
port:8890
import ballerina.log;
import ballerina.io;
import ballerina.net.http;
// This service is a participant in the distributed transaction. It will get infected when it receives a transaction
// context from the participant. The transaction context, in the HTTP case, will be passed in as custom HTTP headers.
@http:configuration {
basePath:"/flight",
host:"localhost",
port:8889
import ballerina.math;
import ballerina.net.http;
import ballerina.log;
import ballerina.io;
// This is the initiator of the distributed transaction
@http:configuration {
basePath:"/",
host:"localhost",
port:8000
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ballerinalang.orbit.com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0.v1</version>
syntax = "proto3";
package org.ballerinalang.net.grpc.helloworld;
import "google/protobuf/wrappers.proto";
service helloWorld {
rpc hello(google.protobuf.StringValue) returns (google.protobuf.StringValue);
}