aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/sourcesessionparams.cpp
blob: 8fdce7a97860c3232299d743fe0a7a649fc66acc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "sourcesessionparams.h"
#include "dynamicthrottlepolicy.h"

namespace mbus {

SourceSessionParams::SourceSessionParams() :
    _replyHandler(nullptr),
    _throttlePolicy(std::make_shared<DynamicThrottlePolicy>()),
    _timeout(180s)
{ }

IThrottlePolicy::SP
SourceSessionParams::getThrottlePolicy() const
{
    return _throttlePolicy;
}

SourceSessionParams &
SourceSessionParams::setThrottlePolicy(IThrottlePolicy::SP throttlePolicy)
{
    _throttlePolicy = std::move(throttlePolicy);
    return *this;
}

SourceSessionParams &
SourceSessionParams::setTimeout(duration timeout)
{
    _timeout = timeout;
    return *this;
}

bool
SourceSessionParams::hasReplyHandler() const
{
    return _replyHandler != nullptr;
}

IReplyHandler &
SourceSessionParams::getReplyHandler() const
{
    return *_replyHandler;
}

SourceSessionParams &
SourceSessionParams::setReplyHandler(IReplyHandler &handler)
{
    _replyHandler = &handler;
    return *this;
}

} // namespace mbus