public void send <MSG>(MSG message, string queueName, string url, bool toLog = true) { ConnectionFactory conFactory = new ConnectionFactory(url); NmsTemplate temp = new NmsTemplate(conFactory); temp.Send(queueName, new GenericMessageCreator <MSG>(message)); if (toLog) { writeToLog("Sended message to " + queueName); } }
public void writeToLog(string message, LogMessage.LogType type = LogMessage.LogType.INFO) { LogMessage msg = new LogMessage(); msg.Message = message; msg.MessageType = type; msg.ServiceName = serviceName; ConnectionFactory conFactory = new ConnectionFactory(Config.Url); NmsTemplate temp = new NmsTemplate(conFactory); temp.Send(Config.QueueName, new GenericMessageCreator <LogMessage>(msg)); }
static void Main(string[] args) { Email testModel = new Email(); testModel.Receiver = "*****@*****.**"; testModel.Text = "TEST TEST TEST"; testModel.Header = "Nagłówek"; ConnectionFactory conFactory = new ConnectionFactory(Config.Url); NmsTemplate temp = new NmsTemplate(conFactory); temp.Send(Config.QueueName, new MessageCreator(testModel)); }