Skip to content

Commit

Permalink
Migrate to ntex-0.7 (#7)
Browse files Browse the repository at this point in the history
* Migrate to ntex 0.7
  • Loading branch information
fafhrd91 authored Jun 16, 2023
1 parent 3c989ce commit db47ed3
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 330 deletions.
15 changes: 7 additions & 8 deletions examples/custom/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
[package]
name = "custom"
version = "0.1.0"
version = "0.4.0"
edition = "2018"

[[bin]]
name = "client"
path = "src/client.rs"

[dependencies]
ntex = "0.6.0-alpha.0"
ntex-grpc = "0.3.0-alpha.0"
ntex = "0.7.0-beta.0"
ntex-grpc = "0.4.0-beta.0"

async-trait = "0.1.0"
clap = "3.2"
bitflags = "1.3"
log = "0.4"
env_logger = "0.9"
env_logger = "0.10"
num_cpus = "1"
openssl = "0.10"
uuid = { version = "1.1", features = ["v4"] }
uuid = { version = "1.3", features = ["v4"] }

[dev-dependencies]
env_logger = { version = "0.9", default-features = false }
ntex = { version = "0.6.0-alpha.0", features = ["openssl", "tokio"] }
env_logger = { version = "0.10", default-features = false }
ntex = { version = "0.7.0-beta.0", features = ["openssl", "tokio"] }
16 changes: 7 additions & 9 deletions examples/helloworld/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "helloworld"
version = "0.1.0"
version = "0.4.0"
edition = "2018"

[[bin]]
Expand All @@ -12,19 +12,17 @@ name = "server"
path = "src/server.rs"

[dependencies]
ntex = "0.6.0-alpha.0"
ntex-grpc = "0.3.0-alpha.0"
ntex = "0.7.0-beta.0"
ntex-grpc = "0.4.0-beta.0"

async-trait = "0.1.0"
clap = "2"
bitflags = "1.3"
log = "0.4"
env_logger = "0.9"
env_logger = "0.10"
num_cpus = "1"
openssl = "0.10"

[dev-dependencies]
env_logger = { version = "0.9", default-features = false }
ntex = { version = "0.6.0-alpha.0", features = ["openssl", "tokio"] }
ntex-tls = { version = "0.2.0-alpha.0", features = ["openssl"] }
ntex-connect = { version = "0.2.0-alpha.0", features = ["openssl", "tokio"] }
ntex = { version = "0.7.0-beta.0", features = ["openssl", "tokio"] }
ntex-tls = { version = "0.3.0-beta.0", features = ["openssl"] }
ntex-connect = { version = "0.3.0-beta.0", features = ["openssl", "tokio"] }
38 changes: 18 additions & 20 deletions examples/helloworld/helloworld.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,28 @@ service Greeter {
// The request message containing the user's name.
message HelloRequest {
string name = 1;
repeated int64 data1 = 2;
repeated DocumentType data2 = 3;
}

// The response message containing the greetings
message HelloReply {
oneof Result {
ResponseResult success = 1;
int64 serviceError = 2;
int64 invalidRequest = 3;
string errorMessage = 4;
}
int64 metadata = 5;

enum Type {
UNIVERSAL = 0;
WEB = 1;
IMAGES = 2;
LOCAL = 3;
NEWS = 4;
PRODUCTS = 5;
VIDEO = 6;
}
Type replyType = 6;
repeated DocumentType data5 = 1;
repeated int64 data6 = 2;
string message = 3;
uint32 tag = 4;
repeated uint32 data1 = 5;
repeated string data2 = 6;
map<string, uint32> data3 = 7;
DocumentType data4 = 8;
}

message ResponseResult {
string message = 1;
enum DocumentType {
BROKER = 0;
NAMESPACE = 1;
TOPIC_SPACE = 2;
CERTIFICATE_LIST = 3;
PERMISSION_BINDING_LIST = 4;
CLIENT_GROUP_LIST = 5;
QUOTA = 6;
}
8 changes: 5 additions & 3 deletions examples/helloworld/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod helloworld;
use self::helloworld::{GreeterClient, HelloRequest};

fn main() {
std::env::set_var("RUST_LOG", "trace");
std::env::set_var("RUST_LOG", "ntex_h2=info");
env_logger::init();

let matches = clap::App::new("helloworld client")
Expand Down Expand Up @@ -49,6 +49,8 @@ fn main() {
client
.say_hello(&HelloRequest {
name: "world".into(),
data1: vec![-234234234, 123412414, 45456],
data2: vec![helloworld::DocumentType::Namespace],
})
.await
.unwrap();
Expand All @@ -61,12 +63,12 @@ fn main() {
let res = client
.say_hello(&HelloRequest {
name: "world".into(),
data1: vec![-234234234, 123412414, 45456],
data2: vec![helloworld::DocumentType::Namespace],
})
.await
.unwrap();
println!("RES: {:?}", res);
counters.register_request();
break;
}
});
});
Expand Down
Loading

0 comments on commit db47ed3

Please sign in to comment.