The document discusses GRPC in Android. It provides an overview of GRPC, explaining that GRPC is Protobuf + RPC made by Google. It supports many languages and uses Protobuf format to transfer data. The document then outlines the step-by-step process to use GRPC in an Android project, including defining a Protobuf file, generating code, creating a GRPC server, adding libraries to Android, and making calls. It also mentions the four types of RPC methods and provides a reference link for more information on GRPC in Android.
What do you mean, Backwards Compatibility?Trisha Gee
Lessons learnt developing the new Java driver for MongoDB. This is a totally different version of my backwards compatibility talk, delivered at JFokus.
Java Persistence Frameworks for MongoDBTobias Trelle
After a short introduction to the MongoDB Java driver we'll have a detailed look at higher level persistence frameworks like Morphia, Spring Data MongoDB and Hibernate OGM with lots of examples.
After a short introduction to the Java driver for MongoDB, we'll have a look at the more abtract persistence frameworks like Morphia, Spring Data, Jongo and Hibernate OGM.
High Performance Python Microservice CommunicationJoe Cabrera
Python Microservices are becoming increasingly popular for large scale web applications. We’ll start by talking about some of the trade-offs of different microservice communication designs. Afterwards we’ll dive into code regarding specific configurations including RPC and traditional REST.
MongoDB + Java - Everything you need to know Norberto Leite
Learn everything you need to know to get started building a MongoDB-based app in Java. We'll explore the relationship between MongoDB and various languages on the Java Virtual Machine such as Java, Scala, and Clojure. From there, we'll examine the popular frameworks and integration points between MongoDB and the JVM including Spring Data and object-document mappers like Morphia.
What do you mean, Backwards Compatibility?Trisha Gee
Lessons learnt developing the new Java driver for MongoDB. This is a totally different version of my backwards compatibility talk, delivered at JFokus.
Java Persistence Frameworks for MongoDBTobias Trelle
After a short introduction to the MongoDB Java driver we'll have a detailed look at higher level persistence frameworks like Morphia, Spring Data MongoDB and Hibernate OGM with lots of examples.
After a short introduction to the Java driver for MongoDB, we'll have a look at the more abtract persistence frameworks like Morphia, Spring Data, Jongo and Hibernate OGM.
High Performance Python Microservice CommunicationJoe Cabrera
Python Microservices are becoming increasingly popular for large scale web applications. We’ll start by talking about some of the trade-offs of different microservice communication designs. Afterwards we’ll dive into code regarding specific configurations including RPC and traditional REST.
MongoDB + Java - Everything you need to know Norberto Leite
Learn everything you need to know to get started building a MongoDB-based app in Java. We'll explore the relationship between MongoDB and various languages on the Java Virtual Machine such as Java, Scala, and Clojure. From there, we'll examine the popular frameworks and integration points between MongoDB and the JVM including Spring Data and object-document mappers like Morphia.
Lambico is a project aiming to simplify the persistence layer of your applications by providing a manner for easily defining the DAOs that manage the data stored in your database.
With Lambico you can define the DAOs for your entities just writing their interfaces, with no implementation at all.
Parancoe 3 is a Web meta-framework which is using Lambico for its persistence layer, and the more recent features of Spring MVC.
Webinar: Building Your First App with MongoDB and JavaMongoDB
This webinar will walk you through building a simple Java-based application in MongoDB. We’ll cover the basics of MongoDB’s document model, query language, aggregation framework, and deployment architecture.
In this webinar, you will discover:
- How easy it is to start building Java applications with MongoDB
- Key features for manipulating and accessing data
- High availability and scale-out architecture
- WriteConcerns and ReadPreference
Introduces the use of JSON-Like data structures within DivConq. Includes how to create and access the structures within Java, as well as how to declare structures in dcSchema for data validation.
Spray Json and MongoDB Queries: Insights and Simple Tricks.Andrii Lashchenko
This presentation will cover the history of creation, implementation details and various challenges related to embedded documents querying in MongoDB, along with examples of how to properly create and utilize the extension on top of official MongoDB Scala Driver. This newly introduced extension allows to fully utilize Spray JSON and represents bidirectional serialization for case classes in BSON, as well as flexible DSL for MongoDB query operators, documents and collections.
I talk about my work on "BSON", a Perl module (https://metacpan.org/pod/BSON) for the binary encoded data format (http://bsonspec.org/) used by MongoDB, and the challenge of serializing strongly-typed data into and out of Perl.
Building Services With gRPC, Docker and GoMartin Kess
gRPC is an open-source framework for building language agnostic services and clients. This hands-on session will cover techniques for building, testing and monitoring gRPC services using Docker and Go. During this session you will build a simple gRPC service and client, as well as an HTTP reverse-proxy to allow your service to also receive HTTP traffic.
Database Trends for Modern Applications: Why the Database You Choose Matters MongoDB
Matt Kalan, Senior Solutions Architect, MongoDB
Matt will explain how modern technology requirements have changed the requirements of the database. In order to handle agile development, big data, cloud, APIs, continuous availability, and unlimited scale while lowering costs, new capabilities are required. Do you need to tolerate the impedance mismatch between an object model and the relational model, or is there another way? We will walk through the application development process, to the code level, to compare using an RDBMS with MongoDB.
Back to Basics Webinar 5: Introduction to the Aggregation FrameworkMongoDB
This is the fifth webinar of a Back to Basics series that will introduce you to the MongoDB database. This webinar will introduce you to the aggregation framework.
2018 colombia deconstruyendo y evolucionando la seguridad en servicios restCésar Hernández
La curva de aprendizaje para la seguridad es severa e implacable. Las especificaciones prometen una flexibilidad infinita y habitualmente dan nuevos nombres a los conceptos antiguos. Esta sesión profundiza el estado actual y evolución que la seguridad en arquitecturas basadas en servicios REST han requerido con conceptos competitivos como OAuth 2.0 en el mundo mobile y HTTP signatures utilizado por Amazon en API's B2B. Finalmente, se analiza un nuevo borrador de Internet lanzado este año que los combina a ambos en el sistema perfecto de dos factores que podría proporcionar una consolidación para los escenarios de REST mobile y de negocios.
MongoDB London 2013: Data Modeling Examples from the Real World presented by ...MongoDB
In this session, we'll examine schema design insights and trade-offs using real world examples. We'll look at three example applications: building an email inbox, selecting a shard key for a large scale web application, and using MongoDB to store user profiles. From these examples you should leave the session with an idea of the advantages and disadvantages of various approaches to modeling your data in MongoDB. Attendees should be well versed in basic schema design and familiar with concepts in the morning's basic schema design talk. No beginner topics will be covered in this session.
Code Example: https://github.com/vladimir-dejanovic/grpc-bank-example
You heard of "new thing" called gRPC and promises that it will solve all issues for you, so now you are not sure if you should use it for breaking up your monolith to Microservices.
On the other hand, you have been using REST API's for some time now, at least as a consumer, so maybe this would be better approach in Microservices waters, or would it?
Which one to chose and which one will fit your use case better?
Join me in this talk were I will try to explain both approaches, good and bad. I will give some points and tips, which will help you in understanding better which one will be better for you. By doing this I will also share some best practices for both approaches
Lambico is a project aiming to simplify the persistence layer of your applications by providing a manner for easily defining the DAOs that manage the data stored in your database.
With Lambico you can define the DAOs for your entities just writing their interfaces, with no implementation at all.
Parancoe 3 is a Web meta-framework which is using Lambico for its persistence layer, and the more recent features of Spring MVC.
Webinar: Building Your First App with MongoDB and JavaMongoDB
This webinar will walk you through building a simple Java-based application in MongoDB. We’ll cover the basics of MongoDB’s document model, query language, aggregation framework, and deployment architecture.
In this webinar, you will discover:
- How easy it is to start building Java applications with MongoDB
- Key features for manipulating and accessing data
- High availability and scale-out architecture
- WriteConcerns and ReadPreference
Introduces the use of JSON-Like data structures within DivConq. Includes how to create and access the structures within Java, as well as how to declare structures in dcSchema for data validation.
Spray Json and MongoDB Queries: Insights and Simple Tricks.Andrii Lashchenko
This presentation will cover the history of creation, implementation details and various challenges related to embedded documents querying in MongoDB, along with examples of how to properly create and utilize the extension on top of official MongoDB Scala Driver. This newly introduced extension allows to fully utilize Spray JSON and represents bidirectional serialization for case classes in BSON, as well as flexible DSL for MongoDB query operators, documents and collections.
I talk about my work on "BSON", a Perl module (https://metacpan.org/pod/BSON) for the binary encoded data format (http://bsonspec.org/) used by MongoDB, and the challenge of serializing strongly-typed data into and out of Perl.
Building Services With gRPC, Docker and GoMartin Kess
gRPC is an open-source framework for building language agnostic services and clients. This hands-on session will cover techniques for building, testing and monitoring gRPC services using Docker and Go. During this session you will build a simple gRPC service and client, as well as an HTTP reverse-proxy to allow your service to also receive HTTP traffic.
Database Trends for Modern Applications: Why the Database You Choose Matters MongoDB
Matt Kalan, Senior Solutions Architect, MongoDB
Matt will explain how modern technology requirements have changed the requirements of the database. In order to handle agile development, big data, cloud, APIs, continuous availability, and unlimited scale while lowering costs, new capabilities are required. Do you need to tolerate the impedance mismatch between an object model and the relational model, or is there another way? We will walk through the application development process, to the code level, to compare using an RDBMS with MongoDB.
Back to Basics Webinar 5: Introduction to the Aggregation FrameworkMongoDB
This is the fifth webinar of a Back to Basics series that will introduce you to the MongoDB database. This webinar will introduce you to the aggregation framework.
2018 colombia deconstruyendo y evolucionando la seguridad en servicios restCésar Hernández
La curva de aprendizaje para la seguridad es severa e implacable. Las especificaciones prometen una flexibilidad infinita y habitualmente dan nuevos nombres a los conceptos antiguos. Esta sesión profundiza el estado actual y evolución que la seguridad en arquitecturas basadas en servicios REST han requerido con conceptos competitivos como OAuth 2.0 en el mundo mobile y HTTP signatures utilizado por Amazon en API's B2B. Finalmente, se analiza un nuevo borrador de Internet lanzado este año que los combina a ambos en el sistema perfecto de dos factores que podría proporcionar una consolidación para los escenarios de REST mobile y de negocios.
MongoDB London 2013: Data Modeling Examples from the Real World presented by ...MongoDB
In this session, we'll examine schema design insights and trade-offs using real world examples. We'll look at three example applications: building an email inbox, selecting a shard key for a large scale web application, and using MongoDB to store user profiles. From these examples you should leave the session with an idea of the advantages and disadvantages of various approaches to modeling your data in MongoDB. Attendees should be well versed in basic schema design and familiar with concepts in the morning's basic schema design talk. No beginner topics will be covered in this session.
Code Example: https://github.com/vladimir-dejanovic/grpc-bank-example
You heard of "new thing" called gRPC and promises that it will solve all issues for you, so now you are not sure if you should use it for breaking up your monolith to Microservices.
On the other hand, you have been using REST API's for some time now, at least as a consumer, so maybe this would be better approach in Microservices waters, or would it?
Which one to chose and which one will fit your use case better?
Join me in this talk were I will try to explain both approaches, good and bad. I will give some points and tips, which will help you in understanding better which one will be better for you. By doing this I will also share some best practices for both approaches
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays
apidays LIVE Helsinki - APIs, Platforms, And Ecosystems - Transforming Industries And Experiences
Implementing OpenAPI and GraphQL Services with gRPC
Tim Burks, Software Engineer at Google
This presentation was given by course moderator Phill Jones of MoreBrains Cooperative during the initial session of the NISO Spring training series "Working with Scholarly APIs." Session One, Foundational Specifics, was held on April 28, 2022.
Generating Unified APIs with Protocol Buffers and gRPCC4Media
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/2k1eZ00.
Chris Roche and Christopher Burnett discuss how they extended the Protocol Buffer (PB) IDL to create unified APIs and data models. From validation logic to automatic logging and statistics, PBs allows them to speed up development across Go, Python, and PHP stacks. They also show how they leverage the Envoy proxy to transparently upgrade HTTP/1.1 services to speak gRPC on the wire. Filmed at qconnewyork.com.
Chris Roche is a Core Libraries Engineer at Lyft focused on enriching the tools to create distributed systems. Christopher Burnett is Lead Core Libraries Engineer at Lyft, where he designs software for distributed systems.
Python RESTful webservices with Python: Flask and Django solutionsSolution4Future
Slides contain RESTful solutions based on Python frameworks like Flask and Django. The presentation introduce in REST concept, presents benchmarks and research for best solutions, analyzes performance problems and shows how to simple get better results. Finally presents soruce code in Flask and Django how to make your own RESTful API in 15 minutes.
Teach your (micro)services talk Protocol Buffers with gRPC.Mihai Iachimovschi
When it comes to microservices, there’re a lot of things worth keeping in mind. Designing such fine-grained, loosely-coupled services requires paying lots of attention to various patterns and approaches to make them future-proof. A very important thing to consider, is the way those services will communicate with each-other in production. Usually the communication is done over the network using a technology-agnostic protocol. At the next level the service should provide an API for its friend services. Then, the data should be serialized without altering its meaning and transferred to the picked endpoint.
Nowadays, exposing a REST API that operates with JSON over plain HTTP is a usual way to lay the grounds of communication for the services. It is easy to accomplish, but it has some drawbacks. First of all, JSON is a human readable format, and it’s not as other serialization approaches. Also, with JSON it’s not possible to natively enforce the schema, and evolving the API may be painful.
This talk’s purpose is to describe in deep detail the benefits of protocol buffers, that offer us for free an easy way to define the API messages in the proto format, and then reuse them inside different services, without even being locked to use the same programming language for them. Moreover, with gRPC we can define the API’s endpoints easily in the same proto format. All these offer us a robust schema enforcement, compact binary serialization, and easy backward compatibility.
This session will provide attendees with hands-on experience and in-depth knowledge of using Node.js as a runtime environment and Express.js as a web framework to build scalable and fast backend systems. Additionally, attendees will learn about Passport.js, a popular authentication middleware for Node.js, and how to use Prisma ORM to handle database operations in a type-safe and efficient manner.
The session will be conducted by experienced developers who have worked with these technologies and will be able to provide valuable insights and best practices. The session will be interactive and include plenty of opportunities for attendees to ask questions and work on real-world projects.
CocoaConf: The Language of Mobile Software is APIsTim Burks
We’re all excited about using the same language to write our mobile apps and cloud services, but as we do, we’ll still need to work with a few things that aren’t written with Swift. Fortunately, there are some great patterns that we can use for doing that. In this session we’ll talk about two technologies that you can use to make your app speak with APIs written in any language: OpenAPI and Protocol Buffers, and then we’ll see how to use them from clients and servers that are written in Swift.
Presented Friday November 4, 2016 in San Jose.
gRPC is a modern high performance RPC (Remote Procedure Call) framework that can run in any environment. gRPC is based on HTTP/2, Protocol Buffers and other modern standard-based technologies. Together with excellent tooling, it helps you create high throughput, low latency, real-time services.
People are leaving WhatsApp for Signal and Telegram. Privacy becomes important more than ever. Have we ever stepped back and rethought carefully how these applications handle end-users’ privacy? Is that a myth; a promise; or back-up by some scientific evidence? How can we, as an end-user, can verify and make sure these claims?
This presentation will explain the history of the development of Signal and Telegram; and how they handle user’s data privacy under the technical microscope.
Prerequisites: Some fundamental knowledge about cryptography: symmetric encryption; asymmetric encryption; public key; private key;
Consensus and Raft Algorithm in Distributed SystemThao Huynh Quang
A modern computing system requires multiple components distributed on different machines to provide scalability, high availability, fault tolerance, and low latency. Therefore, consensus is essential when communicating between nodes to agree on some data value required during computation.
There are many examples of consensus around our tooling:
- Google Chubby uses Paxos, which is a consensus algorithm.
- Kubernetes uses etcd as the backing store for all cluster data. Etcd uses Raft, which is a consensus algorithm.
- Hadoop; Kafka uses ZooKeeper for service discovery; leader’s election, ... ZooKeeper uses a Paxos-variant algorithm.
- Blockchain cannot exist without consensus algorithms such as Proof-of-work; Proof-of-stake; ...
As the result, knowledge of consensus in the distributed system is crucial to understand the behavior of those systems. This presentation will:
Brief introduction about the consensus; challenges and achieved result.
Raft algorithm - the main consensus algorithm used in most of the recent systems.
Some references to get our hand wet on this topic:
https://medium.com/@isuruboyagane.16/what-is-consensus-in-distributed-system-6d51d0802b8c
https://www.youtube.com/watch?v=5m3eBWKjHtM&ab_channel=HasgeekTV
Consensus and Raft algorithm (Vietnamese version)Thao Huynh Quang
Giới thiệu tổng quan về bài toán đồng thuận trong hệ thống phân tán: Two General Problem; FLP;...
Trình bày về thuật toán Raft:
- Leader election
- Log Replication
- Safety property
Các paper / blog ... tham khảo.
- Discuss Java pros and cons
- Kool features in Kotlin.
- How to use Kotlin in Android development.
- How to migrate old Android java code to new Kotlin code.
Designed and presented by Telco internships.
- Explain all basic components in Git: commit, commit hash, branch, git logs, reflogs ...
- Explain some common use operations and the differences between them: merge, rebase, revert, reset, pull, push ...
- How to use GitHub in daily work.
- Discuss the Android Jetpack: New Android libraries officially developed by Google.
- Discuss the Room persistence library in Jetpack. How does Room library help developer life easier when working with databases.
This presentation gives audiences a broad viewpoint from old to modern architecture. How Kubernetes and service mesh (istio) can help developers in those missions:
- Explain from traditional to modern architecture. The role of Kubernetes in modern architecture.
- Build basic k8s components from the ground up with illustrations: Pod; Node; Service; ReplicaSet; Deployment; Namespace; Ingress ...
- Kubernetes under the developer viewpoint: write a YAML application file and deploy k8s application to the cluster.
- Kubernetes advanced concepts: master node design, how does the auto-scale for pods/nodes work, Kubernetes networking model.
- Discuss microservice challenges. The role of the service mesh in the microservice ecosystem.
- Introduce Envoy, istio and their application in the service mesh.
This presentation introduces every aspects of the Kafka ecosystem:
- Concepts: explain all misleading concepts such as topic vs partition vs replication, producer vs consumer vs consumer group, group leader vs group coordinator, ...
- Advanced concepts: delivery semantic; idempotent producers; isolation levels; differences between the offsets such as High Watermark, Log End Offset, Last Stable Offset ...
- Kafka architecture: explain all Kafka components such as brokers, controllers, zookeeper, ...
- Overview of Kafka security: TLS/SSL, SASL, Kerberos, ...
- Overview of Kafka ecosystem: Kafka Stream, Kafka Connect, Schema Registry, monitoring tools.
- Kafka in Golang: How to use Kafka client in Golang.
- Comparison with other message queues such as RabbitMQ.
This is the short presentation of how does the theorem works at a high level.
This presentation introduces Metamask, Infura, Etherscan, ... and how those systems interact with smart contracts.
- Discuss coroutines and channels in modern architecture.
- Concurrency vs Parallelism with real-world examples.
- Simple to advanced concurrency patterns in Kotlin.
- Discuss the role of Observability (Logging; Tracing; and Metric) in modern architecture.
- How to implement observability in Golang using OpenCensus.
- The 4 golden signals when designing the metrics.
- How to apply observability into the process.
Most developers are familiar with making network requests using RESTFUL APIs. However, there are some disadvantages to this approach: very coupling between the backend and the client. For instance, they must communicate back with the backend team when a mobile client wants to change or add some fields to the response. The time for discussions among teams and service deployment might delay project deadlines, hence affecting business opportunities. This topic will discuss the newer approach, GraphQL, and how to apply libraries to the Android world to solve this problem.
Slide for speaking at Droidcon Vietnam 2017
Introduction:
Million of android developers around the world are making great apps. But very few really take care about their compiled code really looks like. How do reverse engineers view their app under different perspective.
This speaking will explain in detail about android reverse engineering from the ground up. Attendee will learn about reading byte code, modify and compile apk file, hooking framework and all additional tools for reverse engineering life.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
17. {
"name": "Thao",
"school": "Le Hong Phong",
"year": 1993
}
{
"name": "Thao",
"school": "Le Hong Phong",
"class": "12CT"
}
1 2
18. {
"name": "Thao",
"school": "Le Hong Phong",
"year": 1993
}
{
"name": "Thao",
"school": "Le Hong Phong",
"class": "12CT"
}
1 2
- 1 is missed “class” attribute.
- 2 is missed “year” attribute.
- Both 1 and 2 are redundant attributes “year” and “class”
- …
55. require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "sphinyx.ChatRequest" do
optional :id, :string, 1
optional :client, :string, 2
optional :message, :string, 3
end
add_message "sphinyx.ChatResponse" do
optional :id, :string, 1
optional :message, :string, 2
end
end
module Sphinyx
ChatRequest =
Google::Protobuf::DescriptorPool.generated_pool.lookup("sphinyx.ChatRequest").msgclass
ChatResponse =
Google::Protobuf::DescriptorPool.generated_pool.lookup("sphinyx.ChatResponse").msgclass
end
56. require 'grpc'
require 'message_pb'
module Sphinyx
module ChatService
# This is the service for our API
class Service
include GRPC::GenericService
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
self.service_name = 'sphinyx.ChatService'
rpc :Connect, ChatRequest, ChatResponse
rpc :SendMessage, ChatRequest, ChatResponse
end
Stub = Service.rpc_stub_class
end
end
57. Step 3: Create GRPC from generated code
class GrpcChatServer < Sphinyx::ChatService::Service
@clients = []
def connect(hello_req, _unused_call)
puts "Hello Client:#{hello_req.client} with id=#{hello_req.id}"
new_id = "#{hello_req.client}-#{hello_req.id}"
Sphinyx::ChatResponse.new(id: new_id, message: "Hello #{new_id}")
end
end
def main
s = GRPC::RpcServer.new
s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)
s.handle(GrpcChatServer)
s.run_till_terminated
end
main
65. Step 6: Using
Step 3: Get result
Message.ChatResponse response = stub.connect(message);
String newId = response.getId();
Log.e("hqthao", response.getMessage());