@@ -218,5 +218,47 @@ public async Task<IActionResult> MsgMongoQueryPrepared(CancellationToken cancell
218218 var res = await bb . MongoQueryPrepared ( cli ) ;
219219 return Ok ( new { dtm_result = res } ) ;
220220 }
221+
222+ /// <summary>
223+ /// MSG with not exist topic will get 【topic not found】
224+ /// </summary>
225+ /// <param name="cancellationToken"></param>
226+ /// <returns></returns>
227+ [ HttpGet ( "msg-topic-notfound" ) ]
228+ public async Task < IActionResult > MsgWithTopicNotFound ( CancellationToken cancellationToken )
229+ {
230+ var gid = await _dtmClient . GenGid ( cancellationToken ) ;
231+ var req = new TransRequest ( "1" , - 30 ) ;
232+ var msg = _transFactory . NewMsg ( gid )
233+ . AddTopic ( "not_exist_topic" , req ) ;
234+
235+ await msg . Prepare ( _settings . BusiUrl + "/msg-queryprepared" , cancellationToken ) ;
236+ await msg . Submit ( cancellationToken ) ;
237+
238+ return Ok ( TransResponse . BuildSucceedResponse ( ) ) ;
239+ }
240+
241+ /// <summary>
242+ /// MSG with exist topic
243+ /// </summary>
244+ /// <param name="cancellationToken"></param>
245+ /// <returns></returns>
246+ [ HttpGet ( "msg-topic" ) ]
247+ public async Task < IActionResult > MsgWithTopic ( CancellationToken cancellationToken )
248+ {
249+ var gid = await _dtmClient . GenGid ( cancellationToken ) ;
250+
251+ // should subscribe at first
252+ var topic = "mytopic" ;
253+
254+ var req = new TransRequest ( "1" , - 30 ) ;
255+ var msg = _transFactory . NewMsg ( gid )
256+ . AddTopic ( topic , req ) ;
257+
258+ await msg . Prepare ( _settings . BusiUrl + "/msg-queryprepared" , cancellationToken ) ;
259+ await msg . Submit ( cancellationToken ) ;
260+
261+ return Ok ( TransResponse . BuildSucceedResponse ( ) ) ;
262+ }
221263 }
222264}
0 commit comments