Esempio n. 1
0
        /**
         * Send an Email
         *
         * @param data     Payload of the email
         * @param callback Result callback of the operation
         * @since v2.0
         */
        public void SendEmail(Email data, IMessagingCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "MailBridge executing sendEmail...");
            }

            if (this._delegate != null)
            {
                this._delegate.SendEmail(data, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "MailBridge executed 'sendEmail' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "MailBridge no delegate for 'sendEmail'.");
                }
            }
        }
Esempio n. 2
0
        public void ReceiveMessage(IMessagingCallback callback)
        {
            waitset.Wait();
            using var samples = reader.Take();

            foreach (var sample in samples)
            {
                if (sample.Info.ValidData)
                {
                    callback.ProcessMessage(dataTypeHelper.SampleToMessage(sample.Data));
                }
            }
        }
Esempio n. 3
0
        public IMessagingReader CreateReader(string topicName, IMessagingCallback callback)
        {
            DataReader <T> reader = null;

            if (parameters.CftSet && topicName == THROUGHPUT_TOPIC_NAME.Value)
            {
                reader = subscriber.CreateDataReader <T>(
                    CreateCft(
                        topicName,
                        participant.CreateTopic <T>(topicName)),
                    GetReaderQos(topicName));
            }
            else
            {
                // Rti.Config.Logger.Instance.SetVerbosity(Rti.Config.Verbosity.Warning);
                reader = subscriber.CreateDataReader <T>(
                    participant.CreateTopic <T>(topicName),
                    GetReaderQos(topicName));
            }

            if (callback != null)
            {
                reader.DataAvailable += _ =>
                {
                    // This is the equivalent of the On_data_available function.
                    using var samples = reader.Take();
                    foreach (var sample in samples)
                    {
                        if (sample.Info.ValidData)
                        {
                            callback.ProcessMessage(dataTypeHelper.SampleToMessage(sample.Data));
                        }
                    }
                };
                reader.StatusCondition.EnabledStatuses = StatusMask.DataAvailable;
            }
            else
            {
                reader.StatusCondition.EnabledStatuses = StatusMask.None;
            }
            return(new RTIReader <T>(
                       reader,
                       dataTypeHelper.Clone(),
                       parameters));
        }