Ejemplo n.º 1
0
        public bool TryCreateMultiSubject(Uri address, out IMultiSubjectMessaging subscriptionGroup)
        {
            if (!address.Scheme.IsRvScheme())
            {
                subscriptionGroup = null;
                return(false);
            }

            var service = address.Host;
            var config  = GetConfig(service);

            var netTrans = new Rv.NetTransport(service, config.Network, config.Daemon);

            switch (address.Scheme)
            {
            case "rv+cm":
                if (string.IsNullOrEmpty(config.CmName))
                {
                    ThrowCmNameNotConfigured();
                }
                var cmt = new Rv.CMTransport(netTrans);     //TODO: what about ledger files?
                subscriptionGroup = new RvMultiSubjectMessaging(cmt, address);
                break;

            case "rv+dq":
                if (string.IsNullOrEmpty(config.CmName))
                {
                    ThrowCmNameNotConfigured();
                }
                var dqt = new Rv.CMQueueTransport(netTrans, config.CmName);     //TODO: other queue parameters need configuring
                subscriptionGroup = new RvMultiSubjectMessaging(dqt, address);
                break;

            default:
                subscriptionGroup = new RvMultiSubjectMessaging(netTrans, address);
                break;
            }
            return(true);
        }
Ejemplo n.º 2
0
        public void Send(string data, EESMessage msgbuilder)
        {
            Transport transport = null;

            try
            {
                TIBCO.Rendezvous.Environment.Open();
            }
            catch (RendezvousException exception)
            {
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME + ":TIBCO Initialize", exception);
            }

            try
            {
                // Real/Local 시
                transport = new TIBCO.Rendezvous.NetTransport(_sService, _sNetwork, _sDaemon);

                //transport = new NetTransport(service, network, daemon);
            }
            catch (RendezvousException exception)
            {
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME + ":NetTransport Initialize", exception);
            }



            // Create the message
            //TIBCO.Rendezvous.Message
            TIBCO.Rendezvous.Message message = new TIBCO.Rendezvous.Message();

            // Set send subject into the message
            try
            {
                //#if (DEBUG)
                //                // Test 시
                //                message.SendSubject = "OYCP.HT.EES.TEST_DB";
                //#else
                //                // Real 시
                message.SendSubject = _sSubjectName;
                //#endif
            }
            catch (RendezvousException exception)
            {
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME + ":message Initialize", exception);
            }

            try
            {
                if (_sDataTypeCD.Equals("BIN"))
                {
                    //#BINARY
                    Opaque opaque = new Opaque();
                    opaque.Value = Encoding.GetEncoding(51949).GetBytes(data);
                    message.AddField("DATA", opaque);
                }
                else
                {
                    //#TEXT
                    message.AddField("DATA", data);
                }

                transport.Send(message);
            }
            catch (RendezvousException exception)
            {
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME + ":Send ", exception);
            }
            catch (Exception err)
            {
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, err);
            }


            // Close Environment, it will cleanup all underlying memory, destroy
            // transport and guarantee delivery.
            try
            {
                transport.Destroy();

                TIBCO.Rendezvous.Environment.Close();
            }
            catch (RendezvousException exception)
            {
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, exception);
            }
        }