Skip to content

Commit 94e769f

Browse files
authored
[HZ-5403] Queue for Asyncio Client (#788)
Straightforward port of Queue and its tests to asyncio client.
1 parent aa08459 commit 94e769f

4 files changed

Lines changed: 672 additions & 0 deletions

File tree

hazelcast/internal/asyncio_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
MAP_SERVICE,
2727
MULTI_MAP_SERVICE,
2828
ProxyManager,
29+
QUEUE_SERVICE,
2930
REPLICATED_MAP_SERVICE,
3031
VECTOR_SERVICE,
3132
)
3233
from hazelcast.internal.asyncio_proxy.list import List
3334
from hazelcast.internal.asyncio_proxy.map import Map
3435
from hazelcast.internal.asyncio_proxy.multi_map import MultiMap
36+
from hazelcast.internal.asyncio_proxy.queue import Queue
3537
from hazelcast.internal.asyncio_proxy.replicated_map import ReplicatedMap
3638
from hazelcast.internal.asyncio_reactor import AsyncioReactor
3739
from hazelcast.serialization import SerializationServiceV1
@@ -285,6 +287,17 @@ async def get_multi_map(self, name: str) -> MultiMap[KeyType, ValueType]:
285287
"""
286288
return await self._proxy_manager.get_or_create(MULTI_MAP_SERVICE, name)
287289

290+
async def get_queue(self, name: str) -> Queue[KeyType]:
291+
"""Returns the distributed queue instance with the specified name.
292+
293+
Args:
294+
name: Name of the distributed queue.
295+
296+
Returns:
297+
Distributed queue instance with the specified name.
298+
"""
299+
return await self._proxy_manager.get_or_create(QUEUE_SERVICE, name)
300+
288301
async def get_replicated_map(self, name: str) -> ReplicatedMap[KeyType, ValueType]:
289302
"""Returns the distributed ReplicatedMap instance with the specified
290303
name.

hazelcast/internal/asyncio_proxy/manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from hazelcast.internal.asyncio_proxy.list import create_list_proxy
55
from hazelcast.internal.asyncio_proxy.multi_map import create_multi_map_proxy
6+
from hazelcast.internal.asyncio_proxy.queue import create_queue_proxy
67
from hazelcast.internal.asyncio_proxy.vector_collection import (
78
VectorCollection,
89
create_vector_collection_proxy,
@@ -17,6 +18,7 @@
1718
LIST_SERVICE = "hz:impl:listService"
1819
MAP_SERVICE = "hz:impl:mapService"
1920
MULTI_MAP_SERVICE = "hz:impl:multiMapService"
21+
QUEUE_SERVICE = "hz:impl:queueService"
2022
REPLICATED_MAP_SERVICE = "hz:impl:replicatedMapService"
2123
VECTOR_SERVICE = "hz:service:vector"
2224

@@ -27,6 +29,7 @@
2729
LIST_SERVICE: create_list_proxy,
2830
MAP_SERVICE: create_map_proxy,
2931
MULTI_MAP_SERVICE: create_multi_map_proxy,
32+
QUEUE_SERVICE: create_queue_proxy,
3033
REPLICATED_MAP_SERVICE: create_replicated_map_proxy,
3134
VECTOR_SERVICE: create_vector_collection_proxy,
3235
}

0 commit comments

Comments
 (0)