/// \api #MqFactoryCall
        public static T Call()
        {
            IntPtr mqctx = IntPtr.Zero;

            ErrorCheck(MqFactoryCall(typeof(T).Name, IntPtr.Zero, ref mqctx));
            return((T)MqS.GetSelf(mqctx));
        }
        /// \api #MqFactoryCall
        public static T Call(string ident)
        {
            IntPtr mqctx = IntPtr.Zero;

            ErrorCheck(MqFactoryCall(ident, IntPtr.Zero, ref mqctx));
            return((T)MqS.GetSelf(mqctx));
        }
Exemple #3
0
        /// \api #MqContextCreate
        public MqS(MqS tmpl)
        {
            context = MqContextCreate(0, tmpl != null ? tmpl.context : IntPtr.Zero);
            MqConfigSetSelf(context, (IntPtr)GCHandle.Alloc(this));
            MqConfigSetIgnoreFork(context, MQ_BOL.MQ_YES);
            MqConfigSetSetup(context, fDefaultLinkCreate, null, fDefaultLinkCreate, null, fProcessExit, fThreadExit);

            if (this is IServerSetup)
            {
                IntPtr data = (IntPtr)GCHandle.Alloc(new ProcData((Callback)((IServerSetup)this).ServerSetup));
//DEBUG.P("IServerSetup",data);
                MqConfigSetServerSetup(context, fProcCall, data, fProcFree, IntPtr.Zero);
            }

            if (this is IServerCleanup)
            {
                IntPtr data = (IntPtr)GCHandle.Alloc(new ProcData((Callback)((IServerCleanup)this).ServerCleanup));
//DEBUG.P("IServerCleanup",data);
                MqConfigSetServerCleanup(context, fProcCall, data, fProcFree, IntPtr.Zero);
            }

            if (this is IBgError)
            {
                MqConfigSetBgError(context, fProcCall, (IntPtr)GCHandle.Alloc(
                                       new ProcData((Callback)((IBgError)this).BgError)), fProcFree, IntPtr.Zero);
            }

            if (this is IEvent)
            {
                MqConfigSetEvent(context, fProcCall, (IntPtr)GCHandle.Alloc(
                                     new ProcData((Callback)((IEvent)this).Event)), fProcFree, IntPtr.Zero);
            }
        }
Exemple #4
0
        /// \api #MqContextCreate
        public MqS(MqS tmpl)
        {
            context = MqContextCreate(0, tmpl != null ? tmpl.context : IntPtr.Zero);
              MqConfigSetSelf(context, (IntPtr) GCHandle.Alloc(this));
              MqConfigSetIgnoreFork(context, MQ_BOL.MQ_YES);
              MqConfigSetSetup(context, fDefaultLinkCreate, null, fDefaultLinkCreate, null, fProcessExit, fThreadExit);

              if (this is IServerSetup) {
            IntPtr data = (IntPtr) GCHandle.Alloc(new ProcData((Callback)((IServerSetup) this).ServerSetup));
            //DEBUG.P("IServerSetup",data);
            MqConfigSetServerSetup (context, fProcCall, data, fProcFree, IntPtr.Zero);
              }

              if (this is IServerCleanup) {
            IntPtr data = (IntPtr) GCHandle.Alloc(new ProcData((Callback)((IServerCleanup) this).ServerCleanup));
            //DEBUG.P("IServerCleanup",data);
            MqConfigSetServerCleanup (context, fProcCall, data, fProcFree, IntPtr.Zero);
              }

              if (this is IBgError) {
            MqConfigSetBgError (context, fProcCall, (IntPtr) GCHandle.Alloc(
              new ProcData((Callback)((IBgError) this).BgError)), fProcFree, IntPtr.Zero);
              }

              if (this is IEvent) {
            MqConfigSetEvent (context, fProcCall, (IntPtr) GCHandle.Alloc(
              new ProcData((Callback)((IEvent) this).Event)), fProcFree, IntPtr.Zero);
              }
        }
        /// \api #MqFactoryDefaultIdent
        public static String DefaultIdent()
        {
            String str = Marshal.PtrToStringAnsi(MqS.MqFactoryDefaultIdent());

//DEBUG.O(str, typeof(T).Name);
            return(str);
        }
        static private void FactoryDelete(IntPtr context, MQ_BOL doFactoryCleanup, IntPtr item)
        {
            IntPtr self = MqS.MqConfigGetSelf(context);

            MqS.MqContextDelete(ref MqS.GetSelf(context).context);
            GCHandle.FromIntPtr(self).Free();
        }
Exemple #7
0
 void IService.Service(MqS ctx)
 {
     FilterItmS it;
       it.token = ServiceGetToken();
       it.isTransaction = ServiceIsTransaction();
       it.bdy = ReadBDY();
       itms.Enqueue(it);
       SendRETURN();
 }
        /// \api #MqFactoryNew
        public static T New()
        {
            IntPtr mqctx = IntPtr.Zero;
            IntPtr data  = getConstructor();

            // !attention, no "MqS.fProcFree" because the code will core at the end
//DEBUG.P(ident,data);
            ErrorCheck(MqFactoryNew(typeof(T).Name, fFactoryCreate, data, null, fFactoryDelete, IntPtr.Zero, null, IntPtr.Zero, ref mqctx));
            return((T)MqS.GetSelf(mqctx));
        }
        /// \api #MqFactoryDefault
        public static MqFactoryS <T> Default()
        {
            IntPtr data = getConstructor();

            // !attention, no "MqS.fProcFree" because the code will core at the end
//DEBUG.P(ident,data);
            return(new MqFactoryS <T>(
                       MqS.MqFactoryDefault(new IntPtr(0x2), typeof(T).Name,
                                            fFactoryCreate, data, null, fFactoryDataCopy, fFactoryDelete, IntPtr.Zero, null, null)
                       ));
        }
Exemple #10
0
        /// \api #MqResolve
        protected static MqS[] Resolve(string ident)
        {
            Int32  size        = 0;
            int    elementSize = Marshal.SizeOf(typeof(IntPtr));
            IntPtr ctxL        = MqResolve(ident, ref size);

            MqS[] ret = new MqS[size];
            for (int i = 0; i < size; i++)
            {
                ret[i] = GetSelf(Marshal.ReadIntPtr(ctxL, i * elementSize));
            }
            return(ret);
        }
Exemple #11
0
        /// \api #MqFactoryNew
        public T New()
        {
            IntPtr mqctx = MqFactoryNew(new IntPtr(0x2), IntPtr.Zero, factory);

            if (mqctx == IntPtr.Zero)
            {
                throw new MqFactorySException();
            }
            else
            {
                return((T)MqS.GetSelf(mqctx));
            }
        }
Exemple #12
0
        /// \api #LinkCreateChild
        public void LinkCreateChild(MqS parent, params string[] argv)
        {
            // fill the argv/alfa
              IntPtr largv = IntPtr.Zero;
              if (argv.Length != 0) {
            largv = MqBufferLCreate(argv.Length+1);
            MqBufferLAppendC(largv, APP);
            foreach (string a in argv) {
              MqBufferLAppendC(largv, a);
            }
              }

              // create Context
              ErrorMqToCsWithCheck (MqLinkCreateChild(context, parent.context, ref largv));
        }
Exemple #13
0
        /// \brief constructor used to create a \e child object
        public void LinkCreateChild(MqS parent, params string[] argv)
        {
            // fill the argv/alfa
            IntPtr largv = IntPtr.Zero;

            if (argv.Length != 0)
            {
                largv = MqBufferLCreate(argv.Length + 1);
                MqBufferLAppendC(largv, APP);
                foreach (string a in argv)
                {
                    MqBufferLAppendC(largv, a);
                }
            }

            // 7. create Context
            ErrorMqToCsWithCheck(MqLinkCreateChild(context, parent.context, ref largv));
        }
        /*****************************************************************************/
        /*                                                                           */
        /*                               private                                     */
        /*                                                                           */
        /*****************************************************************************/

        //struct MqFactoryItemS* const item,
        static private MqErrorE FactoryCreate(IntPtr tmpl, MqFactoryE create, IntPtr item, ref IntPtr contextP)
        {
            try {
                Object[] args = new Object[1];
                args[0] = tmpl != IntPtr.Zero ? MqS.GetSelf(tmpl) : null;
                IntPtr data = MqFactoryItemGetCreateData(item);
                contextP = ((MqS)((ConstructorInfo)GCHandle.FromIntPtr(data).Target).Invoke(args)).context;
            } catch (Exception ex) {
                if (create == MqFactoryE.MQ_FACTORY_NEW_INIT)
                {
                    return(MqErrorE.MQ_ERROR);
                }
                else
                {
                    return(MqS.MqErrorSet2(tmpl, ex));
                }
            }
            if (create != MqFactoryE.MQ_FACTORY_NEW_INIT)
            {
                MqSetupDup(contextP, tmpl);
            }
            return(MqErrorE.MQ_OK);
        }
Exemple #15
0
 /// \api #MqReadForward
 public void ReadForward(MqS ctx, MqDumpS dump)
 {
     ErrorMqToCsWithCheck(MqReadForward(context, ctx.context, dump.hdl));
 }
Exemple #16
0
 /// \api #MqReadForward
 public void ReadForward(MqS ctx)
 {
     ErrorMqToCsWithCheck(MqReadForward(context, ctx.context, IntPtr.Zero));
 }
Exemple #17
0
 /// \api #MqReadProxy
 public void ReadProxy(MqS ctx)
 {
     ErrorMqToCsWithCheck(MqReadProxy(context, ctx.context));
 }
Exemple #18
0
 public F2(MqS tmpl)
     : base(tmpl)
 {
 }
Exemple #19
0
 // constructor
 public Filter2(MqS tmpl)
     : base(tmpl)
 {
     ConfigSetIsServer(true);
 }
Exemple #20
0
 void IService.Service(MqS ctx)
 {
     ctx.SendSTART();
       ctx.SendW(ctx.ReadW());
       ctx.SendRETURN();
 }
 public manfilter(MqS tmpl)
     : base(tmpl)
 {
 }
 /// \api #MqFactoryCopy
 public MqFactoryS <T> Copy(string ident)
 {
     return(new MqFactoryS <T> (MqS.MqFactoryCopy(factory, ident)));
 }
Exemple #23
0
 /// \api #MqReadForward
 public void ReadForward(MqS ctx)
 {
     ErrorMqToCsWithCheck(MqReadForward(context, ctx.context, IntPtr.Zero));
 }
Exemple #24
0
 // constructor
 public MyServer(MqS tmpl)
     : base(tmpl)
 {
 }
Exemple #25
0
 /// \api #MqReadProxy
 public void ReadProxy(MqS ctx)
 {
     ErrorMqToCsWithCheck(MqReadProxy(context, ctx.context));
 }
 public testserver(MqS tmpl)
     : base(tmpl)
 {
 }
Exemple #27
0
 /// \api #MqSlaveCreate
 public void SlaveCreate(int id, MqS slave)
 {
     ErrorMqToCsWithCheck(MqSlaveCreate(context, id, slave.context));
 }
Exemple #28
0
 void IService.Service(MqS ctx)
 {
     itms.Enqueue(ReadDUMP());
       SendRETURN();
 }
 public mulserver(MqS tmpl)
     : base(tmpl)
 {
     ConfigSetIsServer(true);
 }
 /// \api #MqFactoryGetCalled
 public static MqFactoryS <T> GetCalled(string ident)
 {
     return(new MqFactoryS <T>(MqS.MqFactoryGetCalled(ident)));
 }
Exemple #31
0
 /// \api #MqReadForward
 public void ReadForward(MqS ctx, MqDumpS dump)
 {
     ErrorMqToCsWithCheck(MqReadForward(context, ctx.context, dump.hdl));
 }
Exemple #32
0
 public F1(MqS tmpl)
     : base(tmpl)
 {
 }
Exemple #33
0
 public Filter4(MqS tmpl)
     : base(tmpl)
 {
 }
Exemple #34
0
 /// \api #MqResolve
 protected static MqS[] Resolve(string ident)
 {
     Int32 size = 0;
       int elementSize = Marshal.SizeOf(typeof(IntPtr));
       IntPtr ctxL = MqResolve(ident,ref size);
       MqS[] ret = new MqS[size];
       for(int i=0; i<size; i++) {
     ret[i] = GetSelf(Marshal.ReadIntPtr(ctxL,i*elementSize));
       }
       return ret;
 }
Exemple #35
0
 public F3(MqS tmpl)
     : base(tmpl)
 {
 }
 /// \api #MqFactoryGet
 public static MqFactoryS <T> Get()
 {
     return(new MqFactoryS <T>(MqS.MqFactoryGet("")));
 }
Exemple #37
0
 /// \api #MqSlaveCreate
 public void SlaveCreate(int id, MqS slave)
 {
     ErrorMqToCsWithCheck(MqSlaveCreate(context, id, slave.context));
 }
Exemple #38
0
 void IService.Service(MqS ctx)
 {
     StorageInsert();
       SendRETURN();
 }