18#include "hazelcast/client/item_listener.h"
19#include "hazelcast/client/proxy/IQueueImpl.h"
20#include "hazelcast/client/impl/ItemEventHandler.h"
21#include "hazelcast/client/protocol/codec/codecs.h"
22#include "hazelcast/client/spi/ClientContext.h"
30class iqueue :
public proxy::IQueueImpl
32 friend class spi::ProxyManager;
35 static constexpr const char* SERVICE_NAME =
"hz:impl:queueService";
56 impl::item_event_handler<protocol::codec::queue_addlistener_handler>>
57 itemEventHandler(
new impl::item_event_handler<
58 protocol::codec::queue_addlistener_handler>(
60 get_context().get_logger(),
61 get_context().get_client_cluster_service(),
62 get_context().get_serialization_service(),
66 return proxy::IQueueImpl::add_item_listener(std::move(itemEventHandler),
78 boost::future<bool>
offer(
const E& element)
80 return offer(element, std::chrono::milliseconds(0));
88 boost::future<void>
put(
const E& element)
90 return proxy::IQueueImpl::put(to_data(element));
103 boost::future<bool>
offer(
const E& element,
104 std::chrono::milliseconds timeout)
106 return proxy::IQueueImpl::offer(to_data(element), timeout);
115 boost::future<boost::optional<E>>
take()
117 return to_object<E>(proxy::IQueueImpl::take_data());
127 boost::future<boost::optional<E>>
poll(std::chrono::milliseconds timeout)
129 return to_object<E>(proxy::IQueueImpl::poll_data(timeout));
138 boost::future<bool>
remove(
const E& element)
140 return proxy::IQueueImpl::remove(to_data(element));
151 return proxy::IQueueImpl::contains(to_data(element));
161 boost::future<size_t>
drain_to(std::vector<E>& elements)
163 return to_object_drain(proxy::IQueueImpl::drain_to_data(), elements);
174 boost::future<size_t>
drain_to(std::vector<E>& elements,
177 return to_object_drain(proxy::IQueueImpl::drain_to_data(max_elements),
188 boost::future<boost::optional<E>>
poll()
190 return poll<E>(std::chrono::milliseconds(0));
200 boost::future<boost::optional<E>>
peek()
202 return to_object<E>(proxy::IQueueImpl::peek_data());
212 return to_object_vector<E>(proxy::IQueueImpl::to_array_data());
223 return proxy::IQueueImpl::contains_all_data(
224 to_data_collection(elements));
233 boost::future<bool>
add_all(
const std::vector<E>& elements)
235 return proxy::IQueueImpl::add_all_data(to_data_collection(elements));
244 boost::future<bool>
remove_all(
const std::vector<E>& elements)
246 return proxy::IQueueImpl::remove_all_data(to_data_collection(elements));
257 boost::future<bool>
retain_all(
const std::vector<E>& elements)
259 return proxy::IQueueImpl::retain_all_data(to_data_collection(elements));
263 iqueue(
const std::string& instance_name, spi::ClientContext* context)
264 : proxy::IQueueImpl(instance_name, context)
Concurrent, blocking, distributed, observable, client queue.
boost::future< boost::uuids::uuid > add_item_listener(item_listener &&listener, bool include_value)
Adds an item listener for this collection.
boost::future< bool > retain_all(const std::vector< E > &elements)
Removes the elements from this queue that are not available in given "elements" vector.
boost::future< boost::optional< E > > poll()
Returns immediately without waiting.
boost::future< bool > add_all(const std::vector< E > &elements)
boost::future< size_t > drain_to(std::vector< E > &elements, size_t max_elements)
Note that elements will be pushed_back to vector.
boost::future< size_t > drain_to(std::vector< E > &elements)
Note that elements will be pushed_back to vector.
boost::future< bool > remove(const E &element)
boost::future< bool > contains_all(const std::vector< E > &elements)
boost::future< bool > contains(const E &element)
boost::future< boost::optional< E > > poll(std::chrono::milliseconds timeout)
boost::future< bool > remove_all(const std::vector< E > &elements)
boost::future< bool > offer(const E &element)
Inserts the specified element into this queue.
boost::future< boost::optional< E > > take()
boost::future< std::vector< E > > to_array()
boost::future< void > put(const E &element)
Puts the element into queue.
boost::future< boost::optional< E > > peek()
Returns immediately without waiting.
boost::future< bool > offer(const E &element, std::chrono::milliseconds timeout)
Inserts the specified element into this queue.
Item listener for IQueue, ISet and IList.