Commit 43cca290 by Girish A Nandolkar

spark create job instance is done for grpc

1 parent e6278bc6
syntax = "proto3";
package com.example.protos;
service CreateSparkJob {
rpc CreateJob (SparkJobRequest) returns (SparkJobReply) {}
}
// The request message containing the debug, dbName, filename, reporttype, instanceDbs, startDate,endDate, reportGenerateType,tallyCompanyName,allowCatogery.
message SparkJobRequest {
string debug = 1;
string dbName = 2;
string fileName = 3;
string reportType = 4;
string instanceDbs = 5;
string startDate = 6;
string endDate = 7;
string reportGenerateType = 8;
string tallyCompanyName = 9;
string allowedCatogery = 10;
}
// The response message containing the greetings
message SparkJobReply {
string message = 1;
}
\ No newline at end of file
import com.example.protos.sparkJob.CreateSparkJobGrpc.{CreateSparkJob, CreateSparkJobBlockingStub}
import com.example.protos.sparkJob.{CreateSparkJobGrpc, SparkJobReply, SparkJobRequest}
import io.grpc.ManagedChannelBuilder
object CreateSparkJobClient {
def main(args:Array[String]): Unit ={
val channel = ManagedChannelBuilder.forAddress("localhost",50051)
.usePlaintext(true).build()
val request = SparkJobRequest("true","rapidor_realmarketing","abc.csv","payment_collection","none","01/02/2017","15/02/2017","","","")
val sparkJobStub:CreateSparkJobBlockingStub = CreateSparkJobGrpc.blockingStub(channel)
val response:SparkJobReply = sparkJobStub.createJob(request)
println("response message--------------->\t"+response.message)
}
}
import com.example.protos.sparkJob.{CreateSparkJobGrpc, SparkJobReply, SparkJobRequest}
import com.example.protos.sparkJob.CreateSparkJobGrpc.CreateSparkJob
import scala.concurrent.{ExecutionContext, Future}
object CreateSparkJobServer extends TestServerConnect{
class CreateSparkJobServer extends CreateSparkJob {
def createJob(req:SparkJobRequest): Future[SparkJobReply] ={
println("-------------->"+req)
Future.successful(SparkJobReply(message = s"Success fully Done"))
}
}
def main(args:Array[String]): Unit ={
val ssd = CreateSparkJobGrpc.bindService(new CreateSparkJobServer, ExecutionContext.global)
runServer(ssd)
}
}
......@@ -14,11 +14,11 @@ object TestClient {
val request = HelloRequest("Good Morning Girish")
val helloWorld:GreeterStub = GreeterGrpc.stub(channel)
/* val helloWorld:GreeterStub = GreeterGrpc.stub(channel)
val greF:Future[HelloReply]= helloWorld.sayHello(request)
greF.foreach(res => println("Response message---------->"+{res.message}))
greF.foreach(res => println("Response message---------->"+{res.message}))*/
val blockingStub: GreeterBlockingStub = GreeterGrpc.blockingStub(channel)
val greeting: HelloReply = blockingStub.sayHello(request)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!