3
using System.Collections.Generic;
4
using ServiceStack.Messaging;
5
using System.Net.Sockets;
8
namespace ServiceStack.Messaging.Rcon
11
/// Processing client used to interface with ServiceStack and allow a message to be processed.
12
/// Not an actual client.
14
internal class ProcessingClient : IMessageQueueClient
19
bool givenPacket = false;
21
public ProcessingClient(Packet packet, Socket client, Server server)
28
public void Publish<T>(T messageBody)
30
if (typeof(IMessage).IsAssignableFrom(typeof(T)))
31
Publish((IMessage)messageBody);
33
Publish<T>(new Message<T>(messageBody));
36
public void Publish(IMessage message)
38
var messageBytes = message.ToBytes();
39
Publish(new QueueNames(message.Body.GetType()).In, messageBytes);
42
public void Publish<T>(IMessage<T> message)
44
var messageBytes = message.ToBytes();
45
Publish(message.ToInQueueName(), messageBytes);
49
/// Publish the specified message into the durable queue @queueName
51
/// <param name="queueName"></param>
52
/// <param name="messageBytes"></param>
53
public void Publish(string queueName, byte[] messageBytes)
55
theServer.Publish(queueName, messageBytes, theClient, thePacket.Sequence);
59
/// Publish the specified message into the transient queue @queueName
61
/// <param name="queueName"></param>
62
/// <param name="messageBytes"></param>
63
public void Notify(string queueName, byte[] messageBytes)
65
theServer.Notify(queueName, messageBytes, theClient, thePacket.Sequence);
69
/// Synchronous blocking get.
71
/// <param name="queueName"></param>
72
/// <param name="timeOut"></param>
73
/// <returns></returns>
74
public byte[] Get(string queueName, TimeSpan? timeOut)
78
var ret = thePacket.Words[1];
84
/// Non blocking get message
86
/// <param name="queueName"></param>
87
/// <returns></returns>
88
public byte[] GetAsync(string queueName)
90
return Get(queueName, TimeSpan.MinValue);
94
/// Blocking wait for notifications on any of the supplied channels
96
/// <param name="channelNames"></param>
97
/// <returns></returns>
98
public string WaitForNotifyOnAny(params string[] channelNames)
103
public void Dispose()
b'\\ No newline at end of file'