Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 0.16 #244

Draft
wants to merge 48 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d0b6490
feat: conversation api initial implementation
mikeee Nov 7, 2024
01d2214
fix(ci): trim blank spaces from version strings
mikeee Nov 7, 2024
78ad9fd
Merge pull request #235 from mikeee/remove-version-spaces
mikeee Nov 7, 2024
f70a18f
Merge branch 'release-0.16' into conversation-api
mikeee Nov 7, 2024
8f00930
fix(ci): fix installer bundle creation logic (#237)
mikeee Nov 7, 2024
7322ec4
Merge branch 'release-0.16' into conversation-api
mikeee Nov 7, 2024
5fd49f1
fix(ci): fix installer bundle creation logic (#238)
mikeee Nov 7, 2024
981340a
Merge branch 'release-0.16' into conversation-api
mikeee Nov 7, 2024
0f29428
fix(ci): fix installer bundle creation logic (#239)
mikeee Nov 7, 2024
12dd8af
Merge branch 'release-0.16' into conversation-api
mikeee Nov 7, 2024
dbc7a80
fix(test): close step token
mikeee Nov 7, 2024
fbb81bf
fix(test): example run
mikeee Nov 7, 2024
80a3a90
fix(test): example validation
mikeee Nov 7, 2024
04375f4
Merge pull request #234 from mikeee/conversation-api
mikeee Nov 7, 2024
df0bf88
Merge branch 'main' into release-0.16
mikeee Nov 16, 2024
b81f8f3
docs: fix typo
mikeee Nov 21, 2024
e04157d
docs: address #240 - update to 0.16.0 in anticipation of the release
mikeee Nov 21, 2024
580b88f
docs: address #241 with updated guidance on instantiating a client
mikeee Nov 21, 2024
0183be5
feat(state)!: add state and bulk state methods
mikeee Nov 24, 2024
597aa46
chore(lint): fmt
mikeee Nov 25, 2024
b1cacef
docs(state): update daprdocs
mikeee Nov 25, 2024
709c67e
Merge pull request #246 from mikeee/226-state_metadata
mikeee Nov 25, 2024
e78cab4
Merge branch 'release-0.16' into dapr-docs
mikeee Nov 25, 2024
4cfa9a3
Merge pull request #245 from mikeee/dapr-docs
mikeee Nov 25, 2024
b2be904
chore: bump rc versions
mikeee Nov 25, 2024
851abca
feat: add proto check and make directives
mikeee Nov 25, 2024
ae9bcda
ci: rename steps
mikeee Nov 25, 2024
fcff470
Merge pull request #247 from mikeee/rc3
mikeee Nov 25, 2024
e15f65b
ci: refactor doc test
mikeee Nov 25, 2024
95b009b
chore: remove macro dep from main crate
mikeee Nov 25, 2024
85ed911
chore: add macro dev-dependency and bump axum-test crate version
mikeee Nov 25, 2024
c4675a6
Merge branch 'release-0.16' into check-proto-diff
mikeee Nov 25, 2024
1ac0191
Merge pull request #248 from mikeee/check-proto-diff
mikeee Nov 25, 2024
1d88e20
Merge branch 'release-0.16' into rm-macro-dep
mikeee Nov 25, 2024
4da565c
Merge pull request #249 from mikeee/rm-macro-dep
mikeee Nov 25, 2024
abecc5c
ci: add dry publish test
mikeee Nov 25, 2024
f0498dc
Merge pull request #250 from mikeee/dry-publish
mikeee Nov 25, 2024
0c909c5
docs: clarify and fix mistakes
mikeee Dec 3, 2024
b9de85f
chore: bump protos to 1.15.0-rc.1 tag
mikeee Dec 3, 2024
2deed2b
Merge pull request #252 from mikeee/proto-update
mikeee Dec 3, 2024
5241ce6
Merge pull request #251 from mikeee/docs
mikeee Dec 3, 2024
6973b7d
Return Result when creating DaprHttpServer (#253)
LeonMatthesKDAB Dec 10, 2024
8bf6013
Cleanup (#254)
mikeee Jan 15, 2025
a532ee1
chore: bump runtime to 1.15.0-rc.2 (#255)
mikeee Jan 15, 2025
52f095f
Add fallback handler to axum Router (#258)
LeonMatthesKDAB Jan 28, 2025
93322c0
release: bump (#256)
mikeee Feb 3, 2025
57347e7
feat(client): add a client port override method (#259)
mikeee Feb 9, 2025
ab21904
refactor(conversations): rename message to content (#261)
mikeee Feb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Return Result when creating DaprHttpServer (#253)
Especially when running custom docker setups, the container that
contains the sidecar may not be running exactly when the Rust code
starts running.

With this patch, this can be handled on the user side (e.g. the
connection can be retried multiple times with timeouts in between).

Signed-off-by: Leon Matthes <leon.matthes@kdab.com>
Co-authored-by: Mike Nguyen <hey@mike.ee>
  • Loading branch information
LeonMatthesKDAB and mikeee authored Dec 10, 2024
commit 6973b7d9be0b824320fa0576e9820af9e185199b
39 changes: 32 additions & 7 deletions dapr/src/server/http.rs
Original file line number Diff line number Diff line change
@@ -84,6 +84,12 @@ pub struct DaprHttpServer {

impl DaprHttpServer {
/// Creates a new instance of the Dapr HTTP server with default options.
///
/// # Panics
///
/// This function panics if the Dapr Sidecar cannot be reached!
/// For a non-panicking version that allows you to handle any errors yourself, see:
/// [DaprHttpServer::try_new_with_dapr_port]
pub async fn new() -> Self {
let dapr_port: u16 = std::env::var("DAPR_GRPC_PORT")
.unwrap_or("3501".into())
@@ -92,19 +98,38 @@ impl DaprHttpServer {
Self::with_dapr_port(dapr_port).await
}

/// Creates a new instance of the Dapr HTTP server that connects to the Dapr sidecar on the
/// given dapr_port.
///
/// # Panics
///
/// This function panics if the Dapr Sidecar cannot be reached!
/// For a non-panicking version that allows you to handle any errors yourself, see:
/// [DaprHttpServer::try_new_with_dapr_port]
pub async fn with_dapr_port(dapr_port: u16) -> Self {
let dapr_addr = format!("https://127.0.0.1:{}", dapr_port);

let cc = match TonicClient::connect(dapr_addr).await {
match Self::try_new_with_dapr_port(dapr_port).await {
Ok(c) => c,
Err(err) => panic!("failed to connect to dapr: {}", err),
};
}
}

/// Creates a new instance of the Dapr HTTP server that connects to the Dapr sidecar on the
/// given dapr_port.
///
/// In contrast to the other functions that create a DaprHttpServer, this function does
/// not panic, but instead returns a Result.
pub async fn try_new_with_dapr_port(
dapr_port: u16,
) -> Result<Self, Box<dyn std::error::Error>> {
let dapr_addr = format!("https://127.0.0.1:{}", dapr_port);

let cc = TonicClient::connect(dapr_addr).await?;
let rt = ActorRuntime::new(cc);

DaprHttpServer {
Ok(DaprHttpServer {
actor_runtime: Arc::new(rt),
shutdown_signal: None,
}
})
}

pub fn with_graceful_shutdown<F>(self, signal: F) -> Self
@@ -138,7 +163,7 @@ impl DaprHttpServer {
.unwrap_or(8080);

let address = format!("127.0.0.1:{}", port.unwrap_or(default_port));
let listener = TcpListener::bind(address).await.unwrap();
let listener = TcpListener::bind(address).await?;

let server = axum::serve(listener, app.into_make_service());