public void PublishRaw(string frame) { try { lock (response) { WriteEvent(response, frame); OnPublish?.Invoke(response, frame); } } catch (Exception ex) { Log.Error("Error publishing notification to: " + frame.SafeSubstring(0, 50), ex); OnError?.Invoke(this, ex); // Mono: If we explicitly close OutputStream after the error socket wont leak (response.Close() doesn't work) try { // This will throw an exception, but on Mono (Linux/OSX) the socket will leak if we not close the OutputStream response.OutputStream.Close(); } catch (Exception innerEx) { Log.Error("OutputStream.Close()", innerEx); } Unsubscribe(); } }
internal void Publish(MqttMessage message, bool force = false) { if (message.QualityOfService != QualityOfServiceLevelType.ExactlyOnce || message.QualityOfService == QualityOfServiceLevelType.ExactlyOnce && force) { OnPublish?.Invoke(this, new MqttMessageEventArgs(message)); } }
internal void Publish(MqttMessage message, bool force = false) { //if the message is QoS = 2, the message is held waiting for release. if (message.QualityOfService != QualityOfServiceLevelType.ExactlyOnce || (message.QualityOfService == QualityOfServiceLevelType.ExactlyOnce && force)) { OnPublish?.Invoke(this, new MqttMessageEventArgs(message)); } }
private static void mk_media_publish(IntPtr mk_media_info, IntPtr mk_publish_auth_invoker, IntPtr mk_sock_info) { var response = new dtos.PublishInvokerDto { Message = "不允许推流", EnableHls = false, EnableMp4 = false }; if (OnPublish != null) { var mediaWapper = new MediaSourceWapper(); mediaWapper.MediaInfo = new MediaInfo(mk_media_info); mediaWapper.SockInfo = new SockInfo(mk_sock_info); var result = OnPublish.Invoke(mediaWapper) ?? response; PInvoke.ZLMediaKitMethod.mk_publish_auth_invoker_do(mk_publish_auth_invoker, result.Message, result.EnableHls ? 1 : 0, result.EnableMp4 ? 1 : 0); return; } PInvoke.ZLMediaKitMethod.mk_publish_auth_invoker_do(mk_publish_auth_invoker, response.Message, response.EnableHls ? 1 : 0, response.EnableMp4 ? 1 : 0); }
/// <summary> /// 发送消息 /// </summary> /// <param name="sendBytes"></param> /// <param name="routingKey"></param> /// <param name="exchangeName"></param> /// <param name="isNoConsumerException"></param> public Task Publish(byte[] sendBytes, string routingKey = "", string exchangeName = "", bool isNoConsumerException = false) { using (IModel channel = BindExchange(exchangeName ?? _factory.Config.ExchangeName)) { IBasicProperties properties = null; if (_factory.Config.Persistence) { properties = channel.CreateBasicProperties(); properties.DeliveryMode = 2; } channel.BasicReturn += async(se, ex) => await Task.Delay(_factory.Config.NoConsumerMessageRetryInterval).ContinueWith((t) => Publish(ex.Body, ex.RoutingKey, ex.Exchange, true)); channel.BasicPublish( exchange: exchangeName ?? _factory.Config.ExchangeName, routingKey: routingKey, mandatory: true, basicProperties: properties, body: sendBytes); } OnPublish?.Invoke(this, new OpenTracingMessage(exchangeName, routingKey, Encoding.UTF8.GetString(sendBytes), isNoConsumerException)); return(Task.CompletedTask); }
public void Publish(Publishable publishable) => OnPublish?.Invoke(publishable);
public void Publish(object publisher, T eventArgs) => OnPublish?.Invoke(publisher, eventArgs);
internal static PublishResult OnPublish_Call(PublishInfo publishInfo) => OnPublish?.Invoke(publishInfo);
public void Publish() { OnPublish?.Invoke(sceneNameInput.text, sceneDescriptionInput.text); }