go to post Aleksandr Kalinin · Jul 23, 2020 Because it is a part of admin-panel of our web-application, that could generate any task.
go to post Aleksandr Kalinin · Jul 22, 2020 Yes, it's possible. For this you need to create class of the task. I used it to create server-monitoring sheduled task, that send me eamil. For example, i have class, that contains parameters of futured monitoring tasks (like task-name, period, timestart, timefinish, activity, description and so on), and contain method to create task: Method generateTask(ByRef out){#define crlf $c(13,10)#define quote $C(34)s err = ""try {s className = ..#taskPath_"."_##this.Namei ##class(%ClassDefinition).%ExistsId(className){s ObjClass = ##class(%Dictionary.ClassDefinition).%OpenId(className) ; Если такая задача есть - открываем и чистимd ObjClass.Parameters.Clear(),ObjClass.Properties.Clear(),ObjClass.Methods.Clear()}else {s ObjClass = ##class(%Dictionary.ClassDefinition).%New(className) ; иначе создаем новую}s ObjClass.Super = "%SYS.Task.Definition" s Param = ##class(%Dictionary.ParameterDefinition).%New(ObjClass.Name_":TaskName") ; Параметр: имя задачиs Param.Default = ##this.Names Param.Description = "Имя задачи"d ObjClass.Parameters.Insert(Param) s Prop = ##class(%Dictionary.PropertyDefinition).%New(ObjClass.Name_":Active") ; Свойство: активностьs Prop.Type ="%Boolean"s Prop.Description = "Флаг активности задачи"s Prop.Required = 1d ObjClass.Properties.Insert(Prop) s Prop = ##class(%Dictionary.PropertyDefinition).%New(ObjClass.Name_":Email") ; Свойство: Почтовые адреса для рассылкиs Prop.Type = "%String"s Prop.Description = "Почтовые адреса для рассылки"d Prop.Parameters.SetAt(200,"MAXLEN")d ObjClass.Properties.Insert(Prop) s Prop = ##class(%Dictionary.PropertyDefinition).%New(ObjClass.Name_":MethodName") ; Свойство: Метод для запускаs Prop.Type = "%String"s Prop.Description = "Метод Cache из класса для запуска"d ObjClass.Properties.Insert(Prop) s Prop = ##class(%Dictionary.PropertyDefinition).%New(ObjClass.Name_":ClassName") ; Свойство: Класс Cache с методом для запускаs Prop.Type = "%String"s Prop.Description = "Класс Cache с методом для запуска"d ObjClass.Properties.Insert(Prop) s Prop = ##class(%Dictionary.PropertyDefinition).%New(ObjClass.Name_":Params") ; Свойство: Параметры запускаемого методаs Prop.Type = "%String"s Prop.Description = "Параметры запускаемого метода"d ObjClass.Properties.Insert(Prop) s method = ##class(%Dictionary.MethodDefinition).%New(className_":OnTask") ; Метод. Основной метод задачиs method.Name = "OnTask"s method.ReturnType = "%Status"s code = ##class(%Stream.TmpCharacter).%New()d code.Rewind()d code.Write(" #define quote $C(34)"_$$$crlf)d code.Write(" q:'..Active $$$OK"_$$$crlf)d code.Write(" s st=$$$OK"_$$$crlf)d code.Write(" try {"_$$$crlf)d code.Write(" s err="""""_$$$crlf)d code.Write(" s msg="""""_$$$crlf)d code.Write(" ;формирование параметров выполнения метода:_____"_$$$crlf)d code.Write(" s jstring=""{"""_$$$crlf)d code.Write(" for i=1:1:$l(..Params,""~"") {"_$$$crlf)d code.Write(" s buf=$p(..Params,""~"",i)"_$$$crlf)d code.Write(" i i<$l(..Params,""~""){"_$$$crlf)d code.Write(" s:buf'="""" jstring=jstring_$$$quote_($p(buf,""="",1))_$$$quote_"":""_$p(buf,""="",2)_"","" "_$$$crlf)d code.Write(" }else{"_$$$crlf)d code.Write(" s:buf'="""" jstring=jstring_$$$quote_($p(buf,""="",1))_$$$quote_"":""_$p(buf,""="",2)"_$$$crlf)d code.Write(" }"_$$$crlf)d code.Write(" }"_$$$crlf)d code.Write(" s jstring=jstring_""}"""_$$$crlf)d code.Write(" s in={}.%FromJSON(jstring)"_$$$crlf)d code.Write(" s out={""error"":"""",""message"":"""",""subject"":""""}"_$$$crlf)d code.Write(" d $CLASSMETHOD(..ClassName,..MethodName,.in,.out)"_$$$crlf)d code.Write(" ;отправка письма:________________________________"_$$$crlf)d code.Write(" i ..Email'="""" {"_$$$crlf)d code.Write(" s mailIn={}"_$$$crlf)d code.Write(" s mailIn.subject= """""_$$$crlf)d code.Write(" s mailIn.to = ..Email"_$$$crlf)d code.Write(" s mailIn.message= ""<h3>Статус выполнения задачи по расписанию ""_..#TaskName_"" : ""_$Case(out.error,"""":""Выполнено"",$$$OK:""Выполнено"",:""Выполнено с ошибками"")_"" </h3>"""_$$$crlf)d code.Write(" s:(out.message'="""") mailIn.message=mailIn.message_""Результат: </br>""_out.message"_$$$crlf)d code.Write(" s mailIn.message= mailIn.message_""Класс: ""_..ClassName_"", метод: ""_..MethodName_""</br>"""_$$$crlf)d code.Write(" s:((out.error'="""")&(out.error'=$$$OK)) mailIn.message=mailIn.message_""Ошибка: ""_out.error_""</br>"""_$$$crlf)d code.Write(" s:(out.subject'="""") mailIn.subject=out.subject"_$$$crlf)d code.Write(" s:(out.from'="""") mailIn.from=out.from"_$$$crlf)d code.Write(" s mailIn.isHTML = 1"_$$$crlf)d code.Write(" s mailIn.attach = """""_$$$crlf)d code.Write(" d ##class(Lib.Util.Email).Send(.mailIn,.out)"_$$$crlf)d code.Write(" }"_$$$crlf)d code.Write(" } // try"_$$$crlf)d code.Write(" catch {s err=$ze}"_$$$crlf)d code.Write(" if err'="""" {s st=$$$ERROR($$$GeneralError,err)}"_$$$crlf)d code.Write(" q st"_$$$crlf)s method.Implementation=coded ObjClass.Methods.Insert(method) d ObjClass.%Save() s status = $system.OBJ.Compile(className,"UBR-D",.errlog,1)s:$System.Status.IsError(status) err=$SYSTEM.Status.GetErrorText(status)}catch exp {s err = ..ErrorDetect(.exp)}s out.error = errq}
go to post Aleksandr Kalinin · Jul 9, 2020 I forget about him all the time, it's very nice that you remember our stack ;) Thanks a lot Alexander! Problem Solved
go to post Aleksandr Kalinin · Jul 8, 2020 I have the same problem with cache-2017.2.0.744.0-win_x64 on Win 10 Pro 64, no kaspersky, windows defender was off. No solution yet?
go to post Aleksandr Kalinin · Dec 3, 2019 Yes, I tried thats tutorial, and yes, I use Cache, not Ensemble
go to post Aleksandr Kalinin · Sep 19, 2019 I think this guide needs to be updated, because of new versions of client and RabbitMQ Performance Testing Tool are avaliable. I used rabbitmq-perf-test 2.8.1 and amqp-client-5.7.3 I had problems with Runing HelloServer example, error was Could not find or load main class com.rabbitmq.examples.HelloServer, may be because there is no such classes in new versions of testing tool. And it seems like author forgot to specify that we need to copy runjava to bin client directory, not only *.jar file.. So I can't start hello-server example, please, help me. What I need do to use it on Cache 2018 except Ensemble?
go to post Aleksandr Kalinin · Jul 20, 2017 Hi Yuriy, Not so far ago I was need such utilit, and i didn't find it, so I've written simple method, that converts xml-node from DOM-represented xml, may be it'll be usefull for you: /// Метод генерации динамичекского объекта из ноды /// Подчеркивания и дефисы в названиях тегов удаляются ClassMethod NodeToDynObj(Node As %XML.Node) As %DynamicObject { d Node.MoveToFirstChild(1) i (Node.NodeType = $$$xmlTEXTNODE) { s res = Node.NodeData d Node.MoveToParent(1) q res } s res = {} do { s propertyName = $TR(Node.LocalName,"-_","") continue:propertyName="" i ((Node.HasChildNodes(1)) && (Node.NodeType '=$$$xmlWHITESPACENODE) && (Node.NodeType '=$$$xmlTEXTNODE)){ s value = ..NodeToDynObj(Node) d res.%Set(propertyName,value) } else{ s value = "" d Node.GetText(.value) d res.%Set(propertyName,value) } } while Node.MoveToNextSibling(1) d Node.MoveToParent(1) q res }