-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.cpp
65 lines (59 loc) · 2.55 KB
/
main.cpp
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
54
55
56
57
58
59
60
61
62
63
64
65
#include <phpcpp.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "Connection.h"
#include "Message.h"
extern "C" {
PHPCPP_EXPORT void *get_module()
{
static Php::Extension extension("uamqpphpbinding", "0.1");
Php::Class<Connection> connection("Azure\\uAMQP\\Connection");
connection.method<&Connection::__construct>("__construct", {
Php::ByVal("host", Php::Type::String),
Php::ByVal("port", Php::Type::Numeric),
Php::ByVal("useTls", Php::Type::Bool),
Php::ByVal("keyName", Php::Type::String),
Php::ByVal("key", Php::Type::String),
Php::ByVal("debug", Php::Type::Bool, false)
});
connection.method<&Connection::publish>("publish", {
Php::ByVal("resourceName", Php::Type::String),
Php::ByVal("message", "Azure\\uAMQP\\Message")
});
connection.method<&Connection::setCallback>("setCallback", {
Php::ByVal("resourceName", Php::Type::String),
Php::ByVal("callback", Php::Type::Callable),
Php::ByVal("loopFn", Php::Type::Callable)
});
connection.method<&Connection::consume>("consume");
connection.method<&Connection::close>("close");
Php::Class<Message> message("Azure\\uAMQP\\Message");
message.method<&Message::__construct>("__construct", {
Php::ByVal("body", Php::Type::String)
});
message.method<&Message::getBody>("getBody");
message.method<&Message::getApplicationProperty>("getApplicationProperty", {
Php::ByVal("key", Php::Type::String),
Php::ByVal("type", Php::Type::String)
});
message.method<&Message::getApplicationProperties>("getApplicationProperties");
message.method<&Message::getMessageAnnotation>("getMessageAnnotation", {
Php::ByVal("key", Php::Type::String),
Php::ByVal("type", Php::Type::String)
});
message.method<&Message::setApplicationProperty>("setApplicationProperty", {
Php::ByVal("key", Php::Type::String),
Php::ByVal("type", Php::Type::String),
Php::ByVal("value", Php::Type::String)
});
message.method<&Message::setMessageAnnotation>("setMessageAnnotation", {
Php::ByVal("key", Php::Type::String),
Php::ByVal("type", Php::Type::String),
Php::ByVal("value", Php::Type::String)
});
extension.add(std::move(connection));
extension.add(std::move(message));
return extension;
}
}