public async Task ProcessTopicMessagesAsync(Message message, CancellationToken token) { // Process the message. string val = $"{Encoding.UTF8.GetString(message.Body)}"; // check if the message is json encoded if (val.StartsWith("{") && val.EndsWith("}") && _TopicHandler != null) { // close recieved message await _TopicHandler.CompleteMessageAsync(message.SystemProperties.LockToken); // send message to the MessageReceived event MessageReceived(val); } }
public async Task ProcessTopicMessagesAsync(Message message, CancellationToken token) { // Process the message. string val = $"{Encoding.UTF8.GetString(message.Body)}"; // check if the message is json encoded if (val.StartsWith("{") && val.EndsWith("}") && _TopicHandler != null) { // close recieved message await _TopicHandler.CompleteMessageAsync(message.SystemProperties.LockToken); // send message to the setResponse method _currentSynchronizationContext.Send(x => setResponse(val), null); } }