blob: acb313894bba51a0834614feea188b02723bd374 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/messagebus/routing/routingtable.h>
#include <vespa/messagebus/routing/routingnode.h>
namespace mbus {
class MessageBus;
/**
* This class owns a message that is being sent by message bus. Once a reply is received, the message is
* attached to it and returned to the application. After the reply has been propagated upwards, this object
* deletes itself. This also implements the discard policy of {@link RoutingNode}.
*/
class SendProxy : public IDiscardHandler,
public IMessageHandler,
public IReplyHandler {
private:
MessageBus &_mbus;
INetwork &_net;
Resender *_resender;
Message::UP _msg;
bool _logTrace;
RoutingNode::UP _root;
public:
/**
* Constructs a new instance of this class to maintain sending of a single message.
*
* @param mbus The message bus that owns this.
* @param net The network layer to transmit through.
* @param resender The resender to use.
*/
SendProxy(MessageBus &mbus, INetwork &net, Resender *resender);
void handleDiscard(Context ctx) override;
void handleMessage(Message::UP msg) override;
void handleReply(Reply::UP reply) override;
};
} // namespace mbus
|