AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
SubscribeToShardHandler.h
1
6#pragma once
7#include <aws/core/utils/HashingUtils.h>
8#include <aws/core/utils/event/EventStreamHandler.h>
9#include <aws/core/client/AWSError.h>
10#include <aws/kinesis/Kinesis_EXPORTS.h>
11#include <aws/kinesis/KinesisErrors.h>
12
13#include <aws/kinesis/model/SubscribeToShardInitialResponse.h>
14#include <aws/kinesis/model/SubscribeToShardEvent.h>
15
16namespace Aws
17{
18namespace Kinesis
19{
20namespace Model
21{
23 {
27 };
28
30 {
31 typedef std::function<void(const SubscribeToShardInitialResponse&)> SubscribeToShardInitialResponseCallback;
32 typedef std::function<void(const SubscribeToShardInitialResponse&, const Utils::Event::InitialResponseType)> SubscribeToShardInitialResponseCallbackEx;
33 typedef std::function<void(const SubscribeToShardEvent&)> SubscribeToShardEventCallback;
34 typedef std::function<void(const Aws::Client::AWSError<KinesisErrors>& error)> ErrorCallback;
35
36 public:
37 AWS_KINESIS_API SubscribeToShardHandler();
38 AWS_KINESIS_API SubscribeToShardHandler& operator=(const SubscribeToShardHandler&) = default;
39
40 AWS_KINESIS_API virtual void OnEvent() override;
41
43
49 inline void SetInitialResponseCallbackEx(const SubscribeToShardInitialResponseCallbackEx& callback) { m_onInitialResponse = callback; }
53 inline void SetInitialResponseCallback(const SubscribeToShardInitialResponseCallback& noArgCallback)
54 {
55 m_onInitialResponse = [noArgCallback](const SubscribeToShardInitialResponse& rs, const Utils::Event::InitialResponseType) { return noArgCallback(rs); };
56 }
58 inline void SetSubscribeToShardEventCallback(const SubscribeToShardEventCallback& callback) { m_onSubscribeToShardEvent = callback; }
59 inline void SetOnErrorCallback(const ErrorCallback& callback) { m_onError = callback; }
60
61 inline SubscribeToShardInitialResponseCallbackEx& GetInitialResponseCallbackEx() { return m_onInitialResponse; }
62
63 private:
64 AWS_KINESIS_API void HandleEventInMessage();
65 AWS_KINESIS_API void HandleErrorInMessage();
66 AWS_KINESIS_API void MarshallError(const Aws::String& errorCode, const Aws::String& errorMessage);
67
68 SubscribeToShardInitialResponseCallbackEx m_onInitialResponse;
69 SubscribeToShardEventCallback m_onSubscribeToShardEvent;
70 ErrorCallback m_onError;
71 };
72
73namespace SubscribeToShardEventMapper
74{
76
78} // namespace SubscribeToShardEventMapper
79} // namespace Model
80} // namespace Kinesis
81} // namespace Aws
AWS_KINESIS_API SubscribeToShardHandler & operator=(const SubscribeToShardHandler &)=default
void SetInitialResponseCallbackEx(const SubscribeToShardInitialResponseCallbackEx &callback)
void SetOnErrorCallback(const ErrorCallback &callback)
void SetSubscribeToShardEventCallback(const SubscribeToShardEventCallback &callback)
SubscribeToShardInitialResponseCallbackEx & GetInitialResponseCallbackEx()
virtual AWS_KINESIS_API void OnEvent() override
void SetInitialResponseCallback(const SubscribeToShardInitialResponseCallback &noArgCallback)
AWS_KINESIS_API Aws::String GetNameForSubscribeToShardEventType(SubscribeToShardEventType value)
AWS_KINESIS_API SubscribeToShardEventType GetSubscribeToShardEventTypeForName(const Aws::String &name)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String