Skip to content

Instantly share code, notes, and snippets.

View daneshk's full-sized avatar

Danesh Kuruppu daneshk

View GitHub Profile
syntax = "proto3";
package org.ballerinalang.net.grpc.stockquote;
service StockQuoteService {
rpc getQuotes(org.ballerinalang.net.grpc.stockquote.Void) returns (org.ballerinalang.net.grpc.stockquote.StockQuotes);
rpc addStock(org.ballerinalang.net.grpc.stockquote.StockQuote) returns (org.ballerinalang.net.grpc.stockquote.Void);
rpc getQuote(org.ballerinalang.net.grpc.stockquote.StockRequest) returns (org.ballerinalang.net.grpc.stockquote.StockQuote);
rpc getNames(org.ballerinalang.net.grpc.stockquote.Void) returns (org.ballerinalang.net.grpc.stockquote.StockNames);
}
message Void {
}
package org.ballerinalang.net.grpc.stockquote;
import ballerina.net.grpc;
service<grpc> StockQuoteService {
resource getQuote (StockRequest req, StockQuote res) {
println("Getting stock details for symbol: " + req.name);
res.symbol = "IBM";
res.name = "International Business Machines";
res.last = 149.52;
package org.ballerinalang.net.grpc.helloworld;
import ballerina.net.grpc;
service<grpc> helloWorld {
resource hello (HelloRequest req, HelloResponse res) {
println(req.name);
res.message = "First Hurray " + req.name;
}
}
service<grpc> helloWorld {
function sayHello (HelloRequest req) (HelloResponse res) {
HelloResponse response = {message:"Hello" + request.getName()};
return response;
}
}
String resourcePath = "/esb/abc.xml";
boolean resourceExists = configRegistry.resourceExists(resourcePath);
if (resourceExists) {
Resource registryResource = configRegistry.get(resourcePath);
try {
OMElement contentElement = AXIOMUtil.stringToOM(
new String((byte[]) registryResource.getContent()));
contentElement.addChild(garElement); //edit content
registryResource.setContent(contentElement.toString());
configRegistry.put(resourcePath, registryResource);
package org.wso2.carbon.transport.http.netty.config;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;