* Bidirectional Subscriptions
Adds support for bidirectional subscriptions to PubSubs. Adds two
methods for subscribing- one using a callback and one using an
imperative approach. Both giving support to different programming styles
or use cases.
Adds example with tests.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Linting: Remove unused `closeCh`
Signed-off-by: joshvanl <me@joshvanl.dev>
* Fixes comment order in bidisub.go
Signed-off-by: joshvanl <me@joshvanl.dev>
* Add comment about processing message
Signed-off-by: joshvanl <me@joshvanl.dev>
* Adds dead letter topic example
Signed-off-by: joshvanl <me@joshvanl.dev>
* chore: remove go.mod
Signed-off-by: mikeee <hey@mike.ee>
* Updates go mod to v1.14.0-rc.1
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: mikeee <hey@mike.ee>
Signed-off-by: Mike Nguyen <hey@mike.ee>
Co-authored-by: mikeee <hey@mike.ee>
* Adds `DAPR_GRPC_ENPOINT` support to client
PR adds `DAPR_GRPC_ENPOINT` environment variable support to client.
Address parser respects http[s] schemes, and TLS query options, as per
[0008-S-sidecar-endpoint-tls.md](https://github.com/dapr/proposals/blob/main/0008-S-sidecar-endpoint-tls.md).
`DAPR_GRPC_ENDPONT` takes precedence over `DAPR_GRPC_PORT`.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Remove errors.Join to have compatibility with Go 1.19
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
This is needed in components-contrib as we cannot pin an updated runtime in cert tests without an updated Go SDK, due to a complex circular dependency
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Adds context to rest of funcs, so context can always be propagated.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Adds `//nolint:interfacebloat` to StateManager interface due to new
`xxxContext` methods.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Use separate interface for structs with context funcs
Signed-off-by: joshvanl <me@joshvanl.dev>
* Adds more locks to actor functions
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
* Various fixed and cleanups
1. Fixed SDK not compiling and tests failing
2. Increased minimum Go version to 1.18
3. Removed `github.com/pkg/errors` and `go.uber.org/atomic` - replaced with the standard library instead (the old packages have been added to the "depguard" linter)
4. Upgraded all dependencies
5. Upgraded golangci-lint to support Go 1.18+
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Do not wrap error if nil
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Run CI on Go 1.18 and 1.19
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Restore compatibility with Go 1.18
Looks like the newer methods were added in Go 1.19 only
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Should fix validate_examples CI
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Updated (most) deprecated Actions
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Fix helm repo
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Determine latest Dapr version in a better way
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Fix validate.sh
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Add wait() method to block until Sidecar is up.
App might depend on sidecar right away. This PR adds a Wait() method to
enable app to wait for sidecar to be up before invoking the first call.
GRPC client creation on Dapr Go SDK is blocking, so waiting for client
readiness is less of a problem here than on SDKs where client
connection establishment is async.
Closes#287
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Move Wait its own file.
If anything, this will make testing and the change more localized.
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Adding unresponsive TCP and Unix servers and tests
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Remove comments, clean code up
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Remove a bit of code duplication on tests
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Fix Wait and test server setup.
* Multiple state changes can happen for a single GRPC Connection.
previous code assume a single one and was failing miserably. Fixed.
* The logic for the test server's tear down was lacking. Fixed
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Rename on aux. method
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Add link to gRPC documentation about connectivity semantics
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Fixing lint errors
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
* Fixing more lint errors
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
In the state API there's an existing DeleteStateWithETag() convenience
function but there does not appear to be an equivalent
SaveStateWithETag(). This commit adds SetStateWithETag() so that
consumers of the SDK don't have to employ the more verbose
SaveBulkState() when they only need to update a singular item.
Client code updating a single item with an etag prior to this commit
looks like:
--
item := &dapr.SetStateItem{
Etag: &dapr.ETag{
Value: "deadbeef",
},
Key: "order_1",
Value: []byte(data),
}
err := client.SaveBulkState(ctx, store, item)
--
Client code after this commit can reduce to:
--
err := client.SaveStateWithEtag(ctx, store, "order_1", []byte(data), "deadbeef")
--
Signed-off-by: Mike Brown <github@torvosoft.com>
Signed-off-by: Mike Brown <github@torvosoft.com>
* add distributed lock api support
Signed-off-by: yaron2 <schneider.yaron@live.com>
* go mod tidy for pub/sub
Signed-off-by: yaron2 <schneider.yaron@live.com>
* go mod tidy for state
Signed-off-by: yaron2 <schneider.yaron@live.com>
* go mod tidy for service invocation
Signed-off-by: yaron2 <schneider.yaron@live.com>
* linter
Signed-off-by: yaron2 <schneider.yaron@live.com>
* added unlock tests
Signed-off-by: yaron2 <schneider.yaron@live.com>
* ftr: init go-sdk action
* fix: finished design of actor-api's invoke feature
* fix: add readme
* fix: lint
* fix: add manager unit test
* fix: add actor state suport
* fix: add comments
* fix: add comment
* fix the change reqeust of pr
* fix: validate example test
* fix: linter
* add actor validation
* add actor validation
* fix: update actor validation init sleep time
* fix: add init time for validate example server
* fix: change actor to the end of test in order not to let reminder bother other test
* fix: validate test
* fix: typo of factory
* fix: add init time
* fix: ut
Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
Co-authored-by: Long Dai <long.dai@intel.com>
* Make client init fail if server connection fails
This prevents client/server connectivity issues from resulting in silent
failure modes and ensures they're caught as early as possible
* Fix linter errors
Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
* Rationalize PublishEvent* APIs
Allow passing options such as Content-Type and Metadata in a flexible and future-proof way.
The method `PublishEventfromCustomContent` is now deprecated and shows a warning in the console when used.
Fixes#174, #164
* Do not wrap errors for invocations
Fix#186
* Updated variable name
* Added error check
* Oops
* Linting
Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
Co-authored-by: Phil Kedy <phil.kedy@gmail.com>