public void TestAsyncSendException() { for (int i = 0; i < 500; i++) { try { //对全体人员广播 MqBuilder.CreateBuilder() .withType(MqEnum.Topic) .withMessage(new MqMessage { SenderID = "Boss", MessageID = Guid.NewGuid().ToString("N"), MessageBody = "软件部门所有成员下班厕所见", MessageTitle = "老板来信", }) .withAsyncException(MqException_Received) .SendMessageAsync(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }
public void TestAsyncListeningException() { for (int i = 0; i < 500; i++) { try { MqBuilder.CreateBuilder() .withType(MqEnum.Topic) .withListening(MqMessage_Received) .withAsyncException(MqException_Received) .SendMessageAsync(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }
public void TestDirectListening01() { try { MqBuilder.CreateBuilder() .withType(MqEnum.Direct) .withReceiver("1111111") .withListening(MqMessage_Received) .Listening(); Thread.Sleep(3 * 1000); Console.WriteLine(); list.ForEach(s => { Assert.AreNotEqual(s, null); }); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public void TestDirectSend() { for (int i = 0; i < 1000; i++) { try { //对全体人员广播 MqBuilder.CreateBuilder() .withType(MqEnum.Direct) .withReceiver("1111111") .withMessage(new MqMessage { SenderID = "XXXXXXX", MessageID = Guid.NewGuid().ToString("N"), MessageBody = "系统将夜晚0点不停服更新", MessageTitle = "系统提醒", }) .SendMessage(); MqBuilder.CreateBuilder() .withType(MqEnum.Direct) .withReceiver("2222222") .withMessage(new MqMessage { SenderID = "System", MessageID = Guid.NewGuid().ToString("N"), MessageBody = "系统将夜晚0点不停服更新", MessageTitle = "系统提醒", }) .SendMessage(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }