Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Nov 19, 2023
1 parent 553e112 commit 0a1cb8c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ serde = { version = "1.0.140", features = ["derive"] }
mime = "0.3.16"
futures-util = "0.3.21"
tokio-stream = "0.1.8"
prost = "0.11.0"
prost = "0.12.0"
7 changes: 4 additions & 3 deletions examples/poem/tonic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ publish.workspace = true
[dependencies]
poem = { workspace = true, features = ["tower-compat"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
prost = "0.9.0"
tonic = "0.6.2"
prost = "0.12.0"
tonic = "0.10.2"
tracing-subscriber.workspace = true
tower = { version = "0.4.8", features = ["buffer"] }

[build-dependencies]
tonic-build = "0.5.2"
tonic-build = "0.10.2"

[[bin]]
name = "example-tonic-client"
Expand Down
9 changes: 5 additions & 4 deletions examples/poem/tonic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use hello_world::{
};
use poem::{endpoint::TowerCompatExt, listener::TcpListener, Route, Server};
use tonic::{Request, Response, Status};
use tower::buffer::Buffer;

pub mod hello_world {
tonic::include_proto!("helloworld");
Expand Down Expand Up @@ -31,13 +32,13 @@ async fn main() -> Result<(), std::io::Error> {
}
tracing_subscriber::fmt::init();

let app = Route::new().nest_no_strip(
"/",
let service = Buffer::new(
tonic::transport::Server::builder()
.add_service(GreeterServer::new(MyGreeter))
.into_service()
.compat(),
.into_service(),
1024,
);
let app = Route::new().nest_no_strip("/", service.compat());

Server::new(TcpListener::bind("0.0.0.0:3000"))
.run(app)
Expand Down

0 comments on commit 0a1cb8c

Please sign in to comment.