Compare commits
6 Commits
zig-0.11.x
...
f742ee1a85
Author | SHA1 | Date | |
---|---|---|---|
f742ee1a85
|
|||
7db55e9ac9
|
|||
73fccb4662
|
|||
42d0b24710
|
|||
b17a3fba6c
|
|||
4124b912eb
|
@@ -22,7 +22,7 @@ Only tagged release versions of `nats.c` will be used. The current version of `n
|
||||
|
||||
# Zig Version Support
|
||||
|
||||
Since the language is still under active development, any written Zig code is a moving target. The plan is to support Zig `0.11.*` exclusively until the NATS library API has good coverage and is stabilized. At that point, if there are major breaking changes, a maintenance branch will be created, and master will probably move to track Zig master.
|
||||
Since the language is still under active development, any written Zig code is a moving target. The master branch targets zig 0.12 development versions (though it is not guaranteed to work with all versions. Check the commit history for specific version updates). The `zig-0.11.x` branch targets the current stable zig release, 0.11.
|
||||
|
||||
# Using
|
||||
|
||||
|
11
build.zig
11
build.zig
@@ -9,8 +9,9 @@ pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const nats = b.addModule("nats", .{
|
||||
.source_file = .{ .path = "src/nats.zig" },
|
||||
.root_source_file = .{ .path = "src/nats.zig" },
|
||||
});
|
||||
nats.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
|
||||
|
||||
const nats_c = nats_build.nats_c_lib(b, .{
|
||||
.name = "nats-c",
|
||||
@@ -25,7 +26,7 @@ pub fn build(b: *std.Build) void {
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
tests.addModule("nats", nats);
|
||||
tests.root_module.addImport("nats", nats);
|
||||
tests.linkLibrary(nats_c);
|
||||
|
||||
const run_main_tests = b.addRunArtifact(tests);
|
||||
@@ -42,7 +43,7 @@ pub fn build(b: *std.Build) void {
|
||||
}
|
||||
|
||||
const ExampleOptions = struct {
|
||||
target: std.zig.CrossTarget,
|
||||
target: std.Build.ResolvedTarget,
|
||||
optimize: std.builtin.OptimizeMode,
|
||||
nats_module: *std.Build.Module,
|
||||
nats_c: *std.Build.Step.Compile,
|
||||
@@ -59,7 +60,7 @@ const examples = [_]Example{
|
||||
.{ .name = "pub_bytes", .file = "examples/pub_bytes.zig" },
|
||||
};
|
||||
|
||||
pub fn add_examples(b: *std.build, options: ExampleOptions) void {
|
||||
pub fn add_examples(b: *std.Build, options: ExampleOptions) void {
|
||||
const example_step = b.step("examples", "build examples");
|
||||
|
||||
inline for (examples) |example| {
|
||||
@@ -70,7 +71,7 @@ pub fn add_examples(b: *std.build, options: ExampleOptions) void {
|
||||
.optimize = .Debug,
|
||||
});
|
||||
|
||||
ex_exe.addModule("nats", options.nats_module);
|
||||
ex_exe.root_module.addImport("nats", options.nats_module);
|
||||
ex_exe.linkLibrary(options.nats_c);
|
||||
|
||||
const install = b.addInstallArtifact(ex_exe, .{});
|
||||
|
@@ -1,10 +1,20 @@
|
||||
.{
|
||||
.name = "nats-client",
|
||||
.name = "nats.zig",
|
||||
.version = "0.0.1",
|
||||
.paths = .{
|
||||
"src",
|
||||
"deps/nats.c/src",
|
||||
"deps/nats.c/LICENSE",
|
||||
"deps/protobuf-c",
|
||||
"build.zig",
|
||||
"nats-c.build.zig",
|
||||
"build.zig.zon",
|
||||
"LICENSE",
|
||||
},
|
||||
.dependencies = .{
|
||||
.libressl = .{
|
||||
.url = "https://github.com/epicyclic-dev/LibreSSL-portable/archive/2b68369a2b883714cea05357aa378b3a3e8ef2f6.tar.gz",
|
||||
.hash = "12206b907fcb1dea424d122d29a0549bdc6c83648e0433973388b2efb6813b36a8fa",
|
||||
.url = "https://github.com/epicyclic-dev/LibreSSL-portable/archive/9f74aeb1d2f5db5c375a1040cbd2b9abfa2749d1.tar.gz",
|
||||
.hash = "122092a200f7e27e90974013d7e5cd5ef27438f67016852b5244ea287018263e78dc",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ const std = @import("std");
|
||||
|
||||
const NatsCOptions = struct {
|
||||
name: []const u8,
|
||||
target: std.zig.CrossTarget,
|
||||
target: std.Build.ResolvedTarget,
|
||||
optimize: std.builtin.OptimizeMode,
|
||||
};
|
||||
|
||||
@@ -24,36 +24,36 @@ pub fn nats_c_lib(
|
||||
};
|
||||
|
||||
lib.linkLibC();
|
||||
lib.addCSourceFiles(&common_sources, &cflags);
|
||||
lib.addCSourceFiles(.{ .files = &common_sources, .flags = &cflags });
|
||||
lib.addIncludePath(.{ .path = nats_src_prefix ++ "include" });
|
||||
// if building with streaming support (protocol.pb-c.c includes
|
||||
// <protobuf-c/protobuf-c.h>, unfortunately)
|
||||
lib.addIncludePath(.{ .path = "deps" });
|
||||
lib.addIncludePath(.{ .path = nats_src_prefix ++ "stan" });
|
||||
lib.addCSourceFiles(&streaming_sources, &cflags);
|
||||
lib.addCSourceFiles(&protobuf_c_sources, &cflags);
|
||||
lib.addCSourceFiles(.{ .files = &streaming_sources, .flags = &cflags });
|
||||
lib.addCSourceFiles(.{ .files = &protobuf_c_sources, .flags = &cflags });
|
||||
|
||||
const ssl_dep = b.dependency("libressl", .{
|
||||
.target = options.target,
|
||||
.optimize = options.optimize,
|
||||
});
|
||||
|
||||
const tinfo = lib.target_info.target;
|
||||
const tinfo = options.target.result;
|
||||
switch (tinfo.os.tag) {
|
||||
.windows => {
|
||||
lib.addCSourceFiles(&win_sources, &cflags);
|
||||
lib.addCSourceFiles(.{ .files = &win_sources, .flags = &cflags });
|
||||
if (tinfo.abi != .msvc) {
|
||||
lib.addCSourceFiles(&.{"src/win-crosshack.c"}, &cflags);
|
||||
lib.addCSourceFiles(.{ .files = &.{"src/win-crosshack.c"}, .flags = &cflags });
|
||||
}
|
||||
lib.defineCMacro("_WIN32", null);
|
||||
lib.linkSystemLibrary("ws2_32");
|
||||
},
|
||||
.macos => {
|
||||
lib.addCSourceFiles(&unix_sources, &cflags);
|
||||
lib.addCSourceFiles(.{ .files = &unix_sources, .flags = &cflags });
|
||||
lib.defineCMacro("DARWIN", null);
|
||||
},
|
||||
else => {
|
||||
lib.addCSourceFiles(&unix_sources, &cflags);
|
||||
lib.addCSourceFiles(.{ .files = &unix_sources, .flags = &cflags });
|
||||
lib.defineCMacro("_GNU_SOURCE", null);
|
||||
lib.defineCMacro("LINUX", null);
|
||||
// may need to link pthread and rt. Not sure if those are included with linkLibC
|
||||
|
@@ -348,7 +348,7 @@ pub const Connection = opaque {
|
||||
@ptrCast(self),
|
||||
subject.ptr,
|
||||
makeSubscriptionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
));
|
||||
return status.toError() orelse sub;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ pub const Connection = opaque {
|
||||
subject.ptr,
|
||||
timeout,
|
||||
makeSubscriptionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
));
|
||||
|
||||
return status.toError() orelse sub;
|
||||
@@ -403,7 +403,7 @@ pub const Connection = opaque {
|
||||
subject.ptr,
|
||||
queue_group.ptr,
|
||||
makeSubscriptionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
));
|
||||
|
||||
return status.toError() orelse sub;
|
||||
@@ -427,7 +427,7 @@ pub const Connection = opaque {
|
||||
queue_group.ptr,
|
||||
timeout,
|
||||
makeSubscriptionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
));
|
||||
|
||||
return status.toError() orelse sub;
|
||||
@@ -504,7 +504,7 @@ pub const ConnectionOptions = opaque {
|
||||
return Status.fromInt(nats_c.natsOptions_SetTokenHandler(
|
||||
@ptrCast(self),
|
||||
makeTokenCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ pub const ConnectionOptions = opaque {
|
||||
nats_c.natsOptions_SetCustomReconnectDelay(
|
||||
@ptrCast(self),
|
||||
makeReconnectDelayCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
),
|
||||
).raise();
|
||||
}
|
||||
@@ -671,7 +671,7 @@ pub const ConnectionOptions = opaque {
|
||||
nats_c.natsOptions_SetErrorHandler(
|
||||
@ptrCast(self),
|
||||
makeErrorHandlerCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
),
|
||||
).raise();
|
||||
}
|
||||
@@ -685,7 +685,7 @@ pub const ConnectionOptions = opaque {
|
||||
return Status.fromInt(nats_c.natsOptions_SetClosedCB(
|
||||
@ptrCast(self),
|
||||
makeConnectionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ pub const ConnectionOptions = opaque {
|
||||
return Status.fromInt(nats_c.natsOptions_SetClosedCB(
|
||||
@ptrCast(self),
|
||||
makeConnectionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
@@ -711,7 +711,7 @@ pub const ConnectionOptions = opaque {
|
||||
return Status.fromInt(nats_c.natsOptions_SetClosedCB(
|
||||
@ptrCast(self),
|
||||
makeConnectionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ pub const ConnectionOptions = opaque {
|
||||
return Status.fromInt(nats_c.natsOptions_SetClosedCB(
|
||||
@ptrCast(self),
|
||||
makeConnectionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ pub const ConnectionOptions = opaque {
|
||||
return Status.fromInt(nats_c.natsOptions_SetClosedCB(
|
||||
@ptrCast(self),
|
||||
makeConnectionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ pub const ConnectionOptions = opaque {
|
||||
) Error!void {
|
||||
return Status.fromInt(nats_c.natsOptions_SetEventLoop(
|
||||
@ptrCast(self),
|
||||
@ptrCast(loop),
|
||||
@constCast(@ptrCast(loop)),
|
||||
makeAttachEventLoopCallbackThunk(T, L, attach_callback),
|
||||
makeEventLoopAddRemoveCallbackThunk(T, read_callback),
|
||||
makeEventLoopAddRemoveCallbackThunk(T, write_callback),
|
||||
@@ -822,7 +822,7 @@ pub const ConnectionOptions = opaque {
|
||||
@ptrCast(self),
|
||||
retry,
|
||||
makeConnectionCallbackThunk(T, callback),
|
||||
userdata,
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
@@ -838,13 +838,17 @@ pub const ConnectionOptions = opaque {
|
||||
return Status.fromInt(nats_c.natsOptions_SetUserCredentialsCallbacks(
|
||||
@ptrCast(self),
|
||||
makeJwtHandlerCallbackThunk(T, jwt_callback),
|
||||
jwt_userdata,
|
||||
@constCast(@ptrCast(jwt_userdata)),
|
||||
makeSignatureHandlerCallbackThunk(U, sig_callback),
|
||||
sig_userdata,
|
||||
@constCast(@ptrCast(sig_userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
pub fn setUserCredentialsFromFiles(self: *ConnectionOptions, user_or_chained_file: [:0]const u8, seed_file: [:0]const u8) Error!void {
|
||||
pub fn setUserCredentialsFromFiles(
|
||||
self: *ConnectionOptions,
|
||||
user_or_chained_file: [:0]const u8,
|
||||
seed_file: [:0]const u8,
|
||||
) Error!void {
|
||||
return Status.fromInt(
|
||||
nats_c.natsOptions_SetUserCredentialsFromFiles(
|
||||
@ptrCast(self),
|
||||
@@ -874,7 +878,7 @@ pub const ConnectionOptions = opaque {
|
||||
@ptrCast(self),
|
||||
pub_key.ptr,
|
||||
makeSignatureHandlerCallbackThunk(T, sig_callback),
|
||||
sig_userdata,
|
||||
@constCast(@ptrCast(sig_userdata)),
|
||||
)).raise();
|
||||
}
|
||||
|
||||
|
@@ -174,12 +174,12 @@ pub const Subscription = opaque {
|
||||
self: *Subscription,
|
||||
comptime T: type,
|
||||
comptime callback: *const thunk.SimpleCallbackThunkSignature(T),
|
||||
userdata: *T,
|
||||
userdata: T,
|
||||
) Error!void {
|
||||
return Status.fromInt(nats_c.natsSubscription_SetOnCompleteCB(
|
||||
@ptrCast(self),
|
||||
thunk.makeSimpleCallbackThunk(callback),
|
||||
userdata,
|
||||
thunk.makeSimpleCallbackThunk(T, callback),
|
||||
@constCast(@ptrCast(userdata)),
|
||||
)).raise();
|
||||
}
|
||||
};
|
||||
|
@@ -23,7 +23,7 @@ pub fn checkUserDataType(comptime T: type) void {
|
||||
.Optional => |info| switch (@typeInfo(info.child)) {
|
||||
.Optional => @compileError(
|
||||
"nats callbacks can only accept an (optional) single, many," ++
|
||||
" or c pointer as userdata, not slices. \"" ++
|
||||
" or c pointer as userdata. \"" ++
|
||||
@typeName(T) ++ "\" has more than one optional specifier.",
|
||||
),
|
||||
else => checkUserDataType(info.child),
|
||||
@@ -38,7 +38,7 @@ pub fn checkUserDataType(comptime T: type) void {
|
||||
},
|
||||
else => @compileError(
|
||||
"nats callbacks can only accept an (optional) single, many," ++
|
||||
" or c pointer as userdata, not slices. \"" ++
|
||||
" or c pointer as userdata. \"" ++
|
||||
@typeName(T) ++ "\" is not a pointer type.",
|
||||
),
|
||||
}
|
||||
@@ -57,7 +57,7 @@ pub fn makeSimpleCallbackThunk(
|
||||
comptime checkUserDataType(T);
|
||||
return struct {
|
||||
fn thunk(userdata: ?*anyopaque) callconv(.C) void {
|
||||
const data: *T = if (userdata) |u| @alignCast(@ptrCast(u)) else unreachable;
|
||||
const data: T = if (userdata) |u| @alignCast(@ptrCast(u)) else unreachable;
|
||||
callback(data);
|
||||
}
|
||||
}.thunk;
|
||||
|
@@ -99,7 +99,7 @@ test "nats.Connection" {
|
||||
connection.drainTimeout(1000) catch {};
|
||||
}
|
||||
|
||||
fn reconnectDelayHandler(userdata: *u32, connection: *nats.Connection, attempts: c_int) i64 {
|
||||
fn reconnectDelayHandler(userdata: *const u32, connection: *nats.Connection, attempts: c_int) i64 {
|
||||
_ = userdata;
|
||||
_ = connection;
|
||||
_ = attempts;
|
||||
@@ -108,7 +108,7 @@ fn reconnectDelayHandler(userdata: *u32, connection: *nats.Connection, attempts:
|
||||
}
|
||||
|
||||
fn errorHandler(
|
||||
userdata: *u32,
|
||||
userdata: *const u32,
|
||||
connection: *nats.Connection,
|
||||
subscription: *nats.Subscription,
|
||||
status: nats.Status,
|
||||
@@ -119,18 +119,18 @@ fn errorHandler(
|
||||
_ = status;
|
||||
}
|
||||
|
||||
fn connectionHandler(userdata: *u32, connection: *nats.Connection) void {
|
||||
fn connectionHandler(userdata: *const u32, connection: *nats.Connection) void {
|
||||
_ = userdata;
|
||||
_ = connection;
|
||||
}
|
||||
|
||||
fn jwtHandler(userdata: *u32) nats.JwtResponseOrError {
|
||||
fn jwtHandler(userdata: *const u32) nats.JwtResponseOrError {
|
||||
_ = userdata;
|
||||
// return .{ .jwt = std.heap.raw_c_allocator.dupeZ(u8, "abcdef") catch @panic("no!") };
|
||||
return .{ .error_message = std.heap.raw_c_allocator.dupeZ(u8, "dang") catch @panic("no!") };
|
||||
}
|
||||
|
||||
fn signatureHandler(userdata: *u32, nonce: [:0]const u8) nats.SignatureResponseOrError {
|
||||
fn signatureHandler(userdata: *const u32, nonce: [:0]const u8) nats.SignatureResponseOrError {
|
||||
_ = userdata;
|
||||
_ = nonce;
|
||||
// return .{ .signature = std.heap.raw_c_allocator.dupe(u8, "01230123") catch @panic("no!") };
|
||||
@@ -144,7 +144,7 @@ test "nats.ConnectionOptions" {
|
||||
const options = try nats.ConnectionOptions.create();
|
||||
defer options.destroy();
|
||||
|
||||
var userdata: u32 = 0;
|
||||
const userdata: u32 = 0;
|
||||
|
||||
try options.setUrl(nats.default_server_url);
|
||||
const servers = [_][*:0]const u8{ "nats://127.0.0.1:4442", "nats://127.0.0.1:4443" };
|
||||
@@ -164,14 +164,14 @@ test "nats.ConnectionOptions" {
|
||||
try options.setMaxReconnect(10);
|
||||
try options.setReconnectWait(500);
|
||||
try options.setReconnectJitter(100, 200);
|
||||
try options.setCustomReconnectDelay(*u32, reconnectDelayHandler, &userdata);
|
||||
try options.setCustomReconnectDelay(*const u32, reconnectDelayHandler, &userdata);
|
||||
try options.setReconnectBufSize(1024);
|
||||
try options.setMaxPendingMessages(50);
|
||||
try options.setErrorHandler(*u32, errorHandler, &userdata);
|
||||
try options.setClosedCallback(*u32, connectionHandler, &userdata);
|
||||
try options.setDisconnectedCallback(*u32, connectionHandler, &userdata);
|
||||
try options.setDiscoveredServersCallback(*u32, connectionHandler, &userdata);
|
||||
try options.setLameDuckModeCallback(*u32, connectionHandler, &userdata);
|
||||
try options.setErrorHandler(*const u32, errorHandler, &userdata);
|
||||
try options.setClosedCallback(*const u32, connectionHandler, &userdata);
|
||||
try options.setDisconnectedCallback(*const u32, connectionHandler, &userdata);
|
||||
try options.setDiscoveredServersCallback(*const u32, connectionHandler, &userdata);
|
||||
try options.setLameDuckModeCallback(*const u32, connectionHandler, &userdata);
|
||||
try options.ignoreDiscoveredServers(true);
|
||||
try options.useGlobalMessageDelivery(false);
|
||||
try options.ipResolutionOrder(.ipv4_first);
|
||||
@@ -179,8 +179,8 @@ test "nats.ConnectionOptions" {
|
||||
try options.useOldRequestStyle(false);
|
||||
try options.setFailRequestsOnDisconnect(true);
|
||||
try options.setNoEcho(true);
|
||||
try options.setRetryOnFailedConnect(*u32, connectionHandler, true, &userdata);
|
||||
try options.setUserCredentialsCallbacks(*u32, *u32, jwtHandler, signatureHandler, &userdata, &userdata);
|
||||
try options.setRetryOnFailedConnect(*const u32, connectionHandler, true, &userdata);
|
||||
try options.setUserCredentialsCallbacks(*const u32, *const u32, jwtHandler, signatureHandler, &userdata, &userdata);
|
||||
try options.setWriteDeadline(5);
|
||||
try options.disableNoResponders(true);
|
||||
try options.setCustomInboxPrefix("_FOOBOX");
|
||||
|
@@ -80,18 +80,21 @@ test "nats.Subscription" {
|
||||
}
|
||||
|
||||
fn onMessage(
|
||||
userdata: *u32,
|
||||
userdata: *const u32,
|
||||
connection: *nats.Connection,
|
||||
subscription: *nats.Subscription,
|
||||
message: *nats.Message,
|
||||
) void {
|
||||
_ = subscription;
|
||||
_ = userdata;
|
||||
|
||||
if (message.getReply()) |reply| {
|
||||
connection.publish(reply, "greetings") catch @panic("OH NO");
|
||||
} else @panic("HOW");
|
||||
}
|
||||
|
||||
userdata.* += 1;
|
||||
fn onClose(userdata: *[]const u8) void {
|
||||
userdata.* = "closed";
|
||||
}
|
||||
|
||||
test "nats.Subscription (async)" {
|
||||
@@ -112,21 +115,30 @@ test "nats.Subscription (async)" {
|
||||
defer message.destroy();
|
||||
|
||||
{
|
||||
var count: u32 = 0;
|
||||
const subscription = try connection.subscribe(*u32, message_subject, onMessage, &count);
|
||||
defer subscription.destroy();
|
||||
var closed: []const u8 = "test";
|
||||
{
|
||||
const count: u32 = 0;
|
||||
const subscription = try connection.subscribe(*const u32, message_subject, onMessage, &count);
|
||||
defer subscription.destroy();
|
||||
|
||||
const response = try connection.requestMessage(message, 1000);
|
||||
try std.testing.expectEqualStrings(
|
||||
"greetings",
|
||||
response.getData() orelse return error.TestUnexpectedResult,
|
||||
);
|
||||
try subscription.setCompletionCallback(*[]const u8, onClose, &closed);
|
||||
|
||||
const response = try connection.requestMessage(message, 1000);
|
||||
try std.testing.expectEqualStrings(
|
||||
"greetings",
|
||||
response.getData() orelse return error.TestUnexpectedResult,
|
||||
);
|
||||
}
|
||||
// we have to sleep to allow the close callback to run. I am worried this may
|
||||
// still end up being flaky, however.
|
||||
nats.sleep(1);
|
||||
try std.testing.expectEqualStrings("closed", closed);
|
||||
}
|
||||
|
||||
{
|
||||
var count: u32 = 0;
|
||||
const count: u32 = 0;
|
||||
const subscription = try connection.subscribeTimeout(
|
||||
*u32,
|
||||
*const u32,
|
||||
message_subject,
|
||||
1000,
|
||||
onMessage,
|
||||
@@ -142,9 +154,9 @@ test "nats.Subscription (async)" {
|
||||
}
|
||||
|
||||
{
|
||||
var count: u32 = 0;
|
||||
const count: u32 = 0;
|
||||
const subscription = try connection.queueSubscribe(
|
||||
*u32,
|
||||
*const u32,
|
||||
message_subject,
|
||||
"queuegroup",
|
||||
onMessage,
|
||||
@@ -162,7 +174,7 @@ test "nats.Subscription (async)" {
|
||||
{
|
||||
var count: u32 = 0;
|
||||
const subscription = try connection.queueSubscribeTimeout(
|
||||
*u32,
|
||||
*const u32,
|
||||
message_subject,
|
||||
"queuegroup",
|
||||
1000,
|
||||
|
Reference in New Issue
Block a user