dapr-dev 1.17.0.dev76__tar.gz → 1.17.0.dev77__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dapr_dev-1.17.0.dev76/dapr_dev.egg-info → dapr_dev-1.17.0.dev77}/PKG-INFO +1 -1
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/grpc/client.py +93 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/_response.py +58 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/client.py +93 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77/dapr_dev.egg-info}/PKG-INFO +1 -1
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/LICENSE +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/README.md +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/__init__.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/actor_interface.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/client/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/client/proxy.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/id.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/_call_type.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/_method_context.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/_reminder_data.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/_state_provider.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/_timer_data.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/_type_information.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/_type_utils.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/actor.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/config.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/context.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/manager.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/method_dispatcher.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/mock_actor.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/mock_state_manager.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/reentrancy_context.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/remindable.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/runtime.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/state_change.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/actor/runtime/state_manager.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/grpc/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/grpc/_request.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/grpc/_response.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/grpc/interceptors.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/grpc/subscription.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/aio/clients/health.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/_constants.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/base.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/exceptions.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/_conversation_helpers.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/_crypto.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/_helpers.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/_jobs.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/_request.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/_state.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/conversation.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/interceptors.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/grpc/subscription.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/health.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/http/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/http/client.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/http/conf.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/http/dapr_actor_http_client.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/http/dapr_invocation_http_client.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/http/helpers.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/retry.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/common/pubsub/subscription.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/conf/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/conf/global_settings.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/conf/helpers.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/common/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/common/v1/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/common/v1/common_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/common/v1/common_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/common/v1/common_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/actors_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/actors_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/actors_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/ai_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/ai_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/ai_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/appcallback_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/appcallback_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/appcallback_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/binding_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/binding_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/binding_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/configuration_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/configuration_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/configuration_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/crypto_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/crypto_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/crypto_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/dapr_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/dapr_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/dapr_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/invoke_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/invoke_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/invoke_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/jobs_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/jobs_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/jobs_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/lock_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/lock_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/lock_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/metadata_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/metadata_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/metadata_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/pubsub_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/pubsub_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/pubsub_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/secret_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/secret_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/secret_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/state_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/state_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/state_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/workflow_pb2.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/workflow_pb2.pyi +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/workflow_pb2_grpc.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/py.typed +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/serializers/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/serializers/base.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/serializers/json.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/serializers/util.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/version/__init__.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/version/version.py +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr_dev.egg-info/SOURCES.txt +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr_dev.egg-info/dependency_links.txt +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr_dev.egg-info/not-zip-safe +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr_dev.egg-info/requires.txt +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr_dev.egg-info/top_level.txt +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/pyproject.toml +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/setup.cfg +0 -0
- {dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/setup.py +0 -0
|
@@ -27,6 +27,7 @@ import grpc.aio # type: ignore
|
|
|
27
27
|
from google.protobuf.any_pb2 import Any as GrpcAny
|
|
28
28
|
from google.protobuf.empty_pb2 import Empty as GrpcEmpty
|
|
29
29
|
from google.protobuf.message import Message as GrpcMessage
|
|
30
|
+
from grpc import StatusCode # type: ignore
|
|
30
31
|
from grpc.aio import ( # type: ignore
|
|
31
32
|
AioRpcError,
|
|
32
33
|
StreamStreamClientInterceptor,
|
|
@@ -69,6 +70,8 @@ from dapr.clients.grpc._request import (
|
|
|
69
70
|
)
|
|
70
71
|
from dapr.clients.grpc._response import (
|
|
71
72
|
BindingResponse,
|
|
73
|
+
BulkPublishResponse,
|
|
74
|
+
BulkPublishResponseFailedEntry,
|
|
72
75
|
BulkStateItem,
|
|
73
76
|
BulkStatesResponse,
|
|
74
77
|
ConfigurationResponse,
|
|
@@ -484,6 +487,96 @@ class DaprGrpcClientAsync:
|
|
|
484
487
|
|
|
485
488
|
return DaprResponse(await call.initial_metadata())
|
|
486
489
|
|
|
490
|
+
async def publish_events(
|
|
491
|
+
self,
|
|
492
|
+
pubsub_name: str,
|
|
493
|
+
topic_name: str,
|
|
494
|
+
data: Sequence[Union[bytes, str]],
|
|
495
|
+
publish_metadata: Dict[str, str] = {},
|
|
496
|
+
data_content_type: Optional[str] = None,
|
|
497
|
+
) -> BulkPublishResponse:
|
|
498
|
+
"""Bulk publish multiple events to a given topic.
|
|
499
|
+
This publishes multiple events to a specified topic and pubsub component.
|
|
500
|
+
Each event can be bytes or str. The str data is encoded into bytes with
|
|
501
|
+
default charset of utf-8.
|
|
502
|
+
|
|
503
|
+
The example publishes multiple string events to a topic:
|
|
504
|
+
|
|
505
|
+
from dapr.aio.clients import DaprClient
|
|
506
|
+
async with DaprClient() as d:
|
|
507
|
+
resp = await d.publish_events(
|
|
508
|
+
pubsub_name='pubsub_1',
|
|
509
|
+
topic_name='TOPIC_A',
|
|
510
|
+
data=['message1', 'message2', 'message3'],
|
|
511
|
+
data_content_type='text/plain',
|
|
512
|
+
)
|
|
513
|
+
# resp.failed_entries includes any entries that failed to publish.
|
|
514
|
+
|
|
515
|
+
Args:
|
|
516
|
+
pubsub_name (str): the name of the pubsub component
|
|
517
|
+
topic_name (str): the topic name to publish to
|
|
518
|
+
data (Sequence[Union[bytes, str]]): sequence of events to publish;
|
|
519
|
+
each event must be bytes or str
|
|
520
|
+
publish_metadata (Dict[str, str], optional): Dapr metadata for the
|
|
521
|
+
bulk publish request
|
|
522
|
+
data_content_type (str, optional): content type of the event data
|
|
523
|
+
|
|
524
|
+
Returns:
|
|
525
|
+
:class:`BulkPublishResponse` with any failed entries
|
|
526
|
+
"""
|
|
527
|
+
entries = []
|
|
528
|
+
for event in data:
|
|
529
|
+
entry_id = str(uuid.uuid4())
|
|
530
|
+
if isinstance(event, bytes):
|
|
531
|
+
event_data = event
|
|
532
|
+
content_type = data_content_type or 'application/octet-stream'
|
|
533
|
+
elif isinstance(event, str):
|
|
534
|
+
event_data = event.encode('utf-8')
|
|
535
|
+
content_type = data_content_type or 'text/plain'
|
|
536
|
+
else:
|
|
537
|
+
raise ValueError(f'invalid type for event {type(event)}')
|
|
538
|
+
|
|
539
|
+
entries.append(
|
|
540
|
+
api_v1.BulkPublishRequestEntry(
|
|
541
|
+
entry_id=entry_id,
|
|
542
|
+
event=event_data,
|
|
543
|
+
content_type=content_type,
|
|
544
|
+
)
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
req = api_v1.BulkPublishRequest(
|
|
548
|
+
pubsub_name=pubsub_name,
|
|
549
|
+
topic=topic_name,
|
|
550
|
+
entries=entries,
|
|
551
|
+
metadata=publish_metadata,
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
try:
|
|
555
|
+
call = self._stub.BulkPublishEvent(req)
|
|
556
|
+
response = await call
|
|
557
|
+
except AioRpcError as err:
|
|
558
|
+
if err.code() == StatusCode.UNIMPLEMENTED:
|
|
559
|
+
try:
|
|
560
|
+
call = self._stub.BulkPublishEventAlpha1(req)
|
|
561
|
+
response = await call
|
|
562
|
+
except AioRpcError as err2:
|
|
563
|
+
raise DaprGrpcError(err2) from err2
|
|
564
|
+
else:
|
|
565
|
+
raise DaprGrpcError(err) from err
|
|
566
|
+
|
|
567
|
+
failed_entries = [
|
|
568
|
+
BulkPublishResponseFailedEntry(
|
|
569
|
+
entry_id=entry.entry_id,
|
|
570
|
+
error=entry.error,
|
|
571
|
+
)
|
|
572
|
+
for entry in response.failedEntries
|
|
573
|
+
]
|
|
574
|
+
|
|
575
|
+
return BulkPublishResponse(
|
|
576
|
+
failed_entries=failed_entries,
|
|
577
|
+
headers=await call.initial_metadata(),
|
|
578
|
+
)
|
|
579
|
+
|
|
487
580
|
async def subscribe(
|
|
488
581
|
self,
|
|
489
582
|
pubsub_name: str,
|
|
@@ -723,6 +723,64 @@ class ConfigurationWatcher:
|
|
|
723
723
|
pass
|
|
724
724
|
|
|
725
725
|
|
|
726
|
+
class BulkPublishResponseFailedEntry:
|
|
727
|
+
"""A failed entry from the bulk publish response.
|
|
728
|
+
|
|
729
|
+
Attributes:
|
|
730
|
+
entry_id (str): the entry ID that failed.
|
|
731
|
+
error (str): the error message for the failure.
|
|
732
|
+
"""
|
|
733
|
+
|
|
734
|
+
def __init__(self, entry_id: str, error: str):
|
|
735
|
+
"""Initializes BulkPublishResponseFailedEntry.
|
|
736
|
+
|
|
737
|
+
Args:
|
|
738
|
+
entry_id (str): the entry ID that failed.
|
|
739
|
+
error (str): the error message for the failure.
|
|
740
|
+
"""
|
|
741
|
+
self._entry_id = entry_id
|
|
742
|
+
self._error = error
|
|
743
|
+
|
|
744
|
+
@property
|
|
745
|
+
def entry_id(self) -> str:
|
|
746
|
+
"""Gets the entry ID."""
|
|
747
|
+
return self._entry_id
|
|
748
|
+
|
|
749
|
+
@property
|
|
750
|
+
def error(self) -> str:
|
|
751
|
+
"""Gets the error message."""
|
|
752
|
+
return self._error
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
class BulkPublishResponse(DaprResponse):
|
|
756
|
+
"""The response of publish_events (bulk publish) API.
|
|
757
|
+
|
|
758
|
+
This inherits from DaprResponse
|
|
759
|
+
|
|
760
|
+
Attributes:
|
|
761
|
+
failed_entries (List[BulkPublishResponseFailedEntry]): the entries that failed to publish.
|
|
762
|
+
"""
|
|
763
|
+
|
|
764
|
+
def __init__(
|
|
765
|
+
self,
|
|
766
|
+
failed_entries: List[BulkPublishResponseFailedEntry] = [],
|
|
767
|
+
headers: MetadataTuple = (),
|
|
768
|
+
):
|
|
769
|
+
"""Initializes BulkPublishResponse from :obj:`runtime_v1.BulkPublishResponse`.
|
|
770
|
+
|
|
771
|
+
Args:
|
|
772
|
+
failed_entries (List[BulkPublishResponseFailedEntry]): the entries that failed.
|
|
773
|
+
headers (Tuple, optional): the headers from Dapr gRPC response.
|
|
774
|
+
"""
|
|
775
|
+
super(BulkPublishResponse, self).__init__(headers)
|
|
776
|
+
self._failed_entries = failed_entries
|
|
777
|
+
|
|
778
|
+
@property
|
|
779
|
+
def failed_entries(self) -> List[BulkPublishResponseFailedEntry]:
|
|
780
|
+
"""Gets the failed entries."""
|
|
781
|
+
return self._failed_entries
|
|
782
|
+
|
|
783
|
+
|
|
726
784
|
class TopicEventResponseStatus(Enum):
|
|
727
785
|
# success is the default behavior: message is acknowledged and not retried
|
|
728
786
|
success = appcallback_v1.TopicEventResponse.TopicEventResponseStatus.SUCCESS
|
|
@@ -31,6 +31,7 @@ from google.protobuf.message import Message as GrpcMessage
|
|
|
31
31
|
from google.protobuf.struct_pb2 import Struct as GrpcStruct
|
|
32
32
|
from grpc import ( # type: ignore
|
|
33
33
|
RpcError,
|
|
34
|
+
StatusCode,
|
|
34
35
|
StreamStreamClientInterceptor,
|
|
35
36
|
StreamUnaryClientInterceptor,
|
|
36
37
|
UnaryStreamClientInterceptor,
|
|
@@ -60,6 +61,8 @@ from dapr.clients.grpc._request import (
|
|
|
60
61
|
)
|
|
61
62
|
from dapr.clients.grpc._response import (
|
|
62
63
|
BindingResponse,
|
|
64
|
+
BulkPublishResponse,
|
|
65
|
+
BulkPublishResponseFailedEntry,
|
|
63
66
|
BulkStateItem,
|
|
64
67
|
BulkStatesResponse,
|
|
65
68
|
ConfigurationResponse,
|
|
@@ -487,6 +490,96 @@ class DaprGrpcClient:
|
|
|
487
490
|
|
|
488
491
|
return DaprResponse(call.initial_metadata())
|
|
489
492
|
|
|
493
|
+
def publish_events(
|
|
494
|
+
self,
|
|
495
|
+
pubsub_name: str,
|
|
496
|
+
topic_name: str,
|
|
497
|
+
data: Sequence[Union[bytes, str]],
|
|
498
|
+
publish_metadata: Dict[str, str] = {},
|
|
499
|
+
data_content_type: Optional[str] = None,
|
|
500
|
+
) -> BulkPublishResponse:
|
|
501
|
+
"""Bulk publish multiple events to a given topic.
|
|
502
|
+
This publishes multiple events to a specified topic and pubsub component.
|
|
503
|
+
Each event can be bytes or str. The str data is encoded into bytes with
|
|
504
|
+
default charset of utf-8.
|
|
505
|
+
|
|
506
|
+
The example publishes multiple string events to a topic:
|
|
507
|
+
|
|
508
|
+
from dapr.clients import DaprClient
|
|
509
|
+
with DaprClient() as d:
|
|
510
|
+
resp = d.publish_events(
|
|
511
|
+
pubsub_name='pubsub_1',
|
|
512
|
+
topic_name='TOPIC_A',
|
|
513
|
+
data=['message1', 'message2', 'message3'],
|
|
514
|
+
data_content_type='text/plain',
|
|
515
|
+
)
|
|
516
|
+
# resp.failed_entries includes any entries that failed to publish.
|
|
517
|
+
|
|
518
|
+
Args:
|
|
519
|
+
pubsub_name (str): the name of the pubsub component
|
|
520
|
+
topic_name (str): the topic name to publish to
|
|
521
|
+
data (Sequence[Union[bytes, str]]): sequence of events to publish;
|
|
522
|
+
each event must be bytes or str
|
|
523
|
+
publish_metadata (Dict[str, str], optional): Dapr metadata for the
|
|
524
|
+
bulk publish request
|
|
525
|
+
data_content_type (str, optional): content type of the event data
|
|
526
|
+
|
|
527
|
+
Returns:
|
|
528
|
+
:class:`BulkPublishResponse` with any failed entries
|
|
529
|
+
"""
|
|
530
|
+
entries = []
|
|
531
|
+
for event in data:
|
|
532
|
+
entry_id = str(uuid.uuid4())
|
|
533
|
+
if isinstance(event, bytes):
|
|
534
|
+
event_data = event
|
|
535
|
+
content_type = data_content_type or 'application/octet-stream'
|
|
536
|
+
elif isinstance(event, str):
|
|
537
|
+
event_data = event.encode('utf-8')
|
|
538
|
+
content_type = data_content_type or 'text/plain'
|
|
539
|
+
else:
|
|
540
|
+
raise ValueError(f'invalid type for event {type(event)}')
|
|
541
|
+
|
|
542
|
+
entries.append(
|
|
543
|
+
api_v1.BulkPublishRequestEntry(
|
|
544
|
+
entry_id=entry_id,
|
|
545
|
+
event=event_data,
|
|
546
|
+
content_type=content_type,
|
|
547
|
+
)
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
req = api_v1.BulkPublishRequest(
|
|
551
|
+
pubsub_name=pubsub_name,
|
|
552
|
+
topic=topic_name,
|
|
553
|
+
entries=entries,
|
|
554
|
+
metadata=publish_metadata,
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
try:
|
|
558
|
+
response, call = self.retry_policy.run_rpc(self._stub.BulkPublishEvent.with_call, req)
|
|
559
|
+
except RpcError as err:
|
|
560
|
+
if err.code() == StatusCode.UNIMPLEMENTED:
|
|
561
|
+
try:
|
|
562
|
+
response, call = self.retry_policy.run_rpc(
|
|
563
|
+
self._stub.BulkPublishEventAlpha1.with_call, req
|
|
564
|
+
)
|
|
565
|
+
except RpcError as err2:
|
|
566
|
+
raise DaprGrpcError(err2) from err2
|
|
567
|
+
else:
|
|
568
|
+
raise DaprGrpcError(err) from err
|
|
569
|
+
|
|
570
|
+
failed_entries = [
|
|
571
|
+
BulkPublishResponseFailedEntry(
|
|
572
|
+
entry_id=entry.entry_id,
|
|
573
|
+
error=entry.error,
|
|
574
|
+
)
|
|
575
|
+
for entry in response.failedEntries
|
|
576
|
+
]
|
|
577
|
+
|
|
578
|
+
return BulkPublishResponse(
|
|
579
|
+
failed_entries=failed_entries,
|
|
580
|
+
headers=call.initial_metadata(),
|
|
581
|
+
)
|
|
582
|
+
|
|
490
583
|
def subscribe(
|
|
491
584
|
self,
|
|
492
585
|
pubsub_name: str,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/clients/http/dapr_invocation_http_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/appcallback_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dapr_dev-1.17.0.dev76 → dapr_dev-1.17.0.dev77}/dapr/proto/runtime/v1/configuration_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|