Documentation of the Filter6 tool used for trans2.test
.
The Filer6 tool is used to test the filter-feature of rbmqmsgque.
To run the filter test, a first client, one or more filters and a final server are created. All are connected to the rbmqmsgque protocol.
The trans2.test
carries out common filter tests and special stress tests. A stress test is performed by exiting one or more filters or servers and observing the response and behavior when reconnecting.
The GOAL for this test is:
#+ #: @file NHI1/example/rb/Filter6.rb #: @brief Filter6.rb - 23 Jul 2024 - aotto1968 #: @copyright (C) NHI - #1 - Project - Group #: This software has NO permissions to copy, #: please contact AUTHOR for additional information #: @version e6ce5cfbf6c7dfb4f0b3eb45bb50508830143224 #: @date Tue Jul 23 22:39:27 2024 +0200 #: @author aotto1968 <aotto1968@t-online.de> #: require "rbmqmsgque" include RbMsgque::MkKernel include RbMsgque::MqMsgque class Filter6 < MqContextC #attr_accessor :fh def initialize() super() ConfigSetIgnoreExit(true) ConfigSetServerSetup(method(:ServerSetup)) ConfigSetServerCleanup(method(:ServerCleanup)) ConfigSetEvent(method(:Event)) @fh = nil end def ServerCleanup @fh.Dispose if @fh != nil @fh = nil end # [filter_service_example] def ServerSetup ftr = SlaveGetFilter() ServiceCreate( "LOGF", method(:LOGF)) ServiceCreate( "EXIT", method(:EXIT)) ServiceCreate( "SOEX", method(:SOEX)) ServiceCreate( "+ALL", method(:FilterIn)) ServiceStorage( "PRNT") ServiceStorage( "PRN2") ftr.ServiceCreate( "WRIT", method(:WRIT)) ServiceCreate( "WRIT", method(:WRIT)) ftr.ServiceProxy( "WRT2", MqSlaveE::MASTER) end # [filter_service_example] def ErrorWrite err = ErrorFORMAT(); @fh.WriteC("ERROR: " + err.GetText()) err.Reset() end def LOGF ftr = SlaveGetFilter() if ftr.ConfigGetName() =~ /^(?:Filter6-1|Filter6|fs1.*)$/ then @fh = MkLogFileC.Open(self,ReadSTR()) else ProxyForward(ftr) end SendRETURN() end def WRIT(ctx) if ConfigGetName() =~ /^(?:Filter6-1|Filter6|fs1.*)$/ then @fh.WriteC(ctx.ReadSTR()) else ctx.ProxyForward(self) end ctx.SendRETURN() end def EXIT #exit() Exit() end def SOEX ErrorSetEXIT() end def FilterIn StorageExport() SendRETURN() end def Event if StorageCount() == 0 then ErrorFORMAT().SetCONTINUE() else id = 0 begin ftr = SlaveGetFilter() id = StorageImport() begin ProxyForward(ftr) rescue MkExceptionC => ex if StorageErrCnt(id) <= 3 StorageDecrRef(id) return else raise end end rescue Exception => ex ErrorCatch(ex) ErrorWrite() end StorageDelete(id) end end end # [error_example] srv = MqFactoryC.Add(Filter6).New() begin srv.LinkCreate(ARGV) srv.ProcessEvent(MqWaitOnEventE::FOREVER) rescue Exception => ex srv.ErrorCatch(ex) ensure srv.Exit() end # [error_example]