{"id":472526,"date":"2025-08-28T21:00:53","date_gmt":"2025-08-28T21:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=472526"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=472526","title":{"rendered":"<span>\u0418\u0433\u0440\u043e\u0432\u043e\u0439 \u0431\u043e\u0442 \u0432 Telegram \u0441 \u043d\u0443\u043b\u044f: \u041a\u0430\u043a \u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Apache NiFi \u0438 LLM<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h3>\n<p>\u041a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u0443\u044e \u0438\u0434\u0435\u044e \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438? \u042f \u0441\u043e\u0437\u0434\u0430\u043b \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443 \u0432 Telegram \u0437\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043d\u0430 Apache NiFi \u0438 Groovy, \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u2014 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439, \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0431\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u0431\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f MVP.<\/p>\n<p>\u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u044d\u0442\u0430\u043f\u044b \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u0438 \u043a\u0430\u043a AI \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u0432\u0438\u0436\u043a\u043e\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430.<\/p>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043c\u043e\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 \u0432 Telegram. \u0417\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u0430 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u0438\u043a\u0442\u043e\u0440\u0438\u043d\u044b \u0438\u043b\u0438 \u043a\u0432\u0435\u0441\u0442\u0430. \u041d\u043e \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0431\u044d\u043a\u0435\u043d\u0434&#8230; \u041d\u0435 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0426\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u044f\u0441\u043d\u0430: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u043e\u0433\u043e \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u0431\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c. \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u0441\u0432\u044f\u0437\u043a\u0443\u00a0<strong>Apache NiFi<\/strong>\u00a0\u0434\u043b\u044f \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u00a0<strong>Groovy<\/strong>\u00a0\u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<p><em>P.S. \u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443, \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f NiFi \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 GitHub. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0437\u0432\u0451\u0437\u0434\u043e\u0447\u043a\u0430\u043c \u0438 \u043f\u0443\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u0430\u043c!<\/em><\/p>\n<p><a href=\"https:\/\/github.com\/SMAnatoly\/quest-telegram-bot\" rel=\"noopener noreferrer nofollow\">FutureGuest Bot repository<\/a><\/p>\n<hr\/>\n<h2>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 (As-Is):<\/h2>\n<ul>\n<li>\n<p><strong>\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0441 Markdown:<\/strong>\u00a0\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f:<\/strong>\u00a0\u041f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0437\u0430\u043d\u043e\u0432\u043e. \u042d\u0442\u043e \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0442\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e JSON:<\/strong>\u00a0\u0412\u0441\u044f \u0438\u0433\u0440\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u0417\u0430\u043c\u0435\u043d\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u043e\u0432\u043e\u0433\u043e JSON.<\/p>\n<\/li>\n<\/ul>\n<div class=\"floating-image\">\n<figure class=\"float bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b7e\/ee0\/203\/b7eee0203674eccb578f8608b527fa6d.jpg\" width=\"647\" height=\"1280\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b7e\/ee0\/203\/b7eee0203674eccb578f8608b527fa6d.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b7e\/ee0\/203\/b7eee0203674eccb578f8608b527fa6d.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<\/div>\n<h2>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435: Pull vs Push<\/h2>\n<p>\u042f \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0440\u043e\u0441\u0430 (Polling). NiFi \u0440\u0430\u0437 \u0432 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441\u0430\u043c \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 Telegram Bot API (<code>getUpdates<\/code>), \u0435\u0441\u0442\u044c \u043b\u0438 \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443?<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u043e\u0449\u0435:<\/strong>\u00a0\u041d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u0435\u043b\u044b\u0439 IP, SSL-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u0440\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0434\u0435\u0436\u043d\u0435\u0435:<\/strong>\u00a0\u0415\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0430\u0434\u0430\u0435\u0442, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0436\u0435. \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430.<\/strong><\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73b\/ae1\/f41\/73bae1f41e64275abbe8671201b87994.png\" alt=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 as is\" title=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 as is\" width=\"1456\" height=\"684\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/73b\/ae1\/f41\/73bae1f41e64275abbe8671201b87994.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73b\/ae1\/f41\/73bae1f41e64275abbe8671201b87994.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 as is<\/figcaption><\/div>\n<\/figure>\n<h2>\u041c\u0430\u0433\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/h2>\n<p>\u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0442\u043d\u0438 \u043e\u0442\u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439 \u0441\u044e\u0436\u0435\u0442\u0430 \u2014 \u0441\u043a\u0443\u0447\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0435\u0441\u044c JSON \u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u00a0<strong>\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438<\/strong>\u00a0(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, DeepSeek). \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0442:\u00a0<em>&#171;\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439 JSON \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 &lt;\u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0448\u0430\u0431\u043b\u043e\u043d task.json&gt; \u0434\u043b\u044f \u043a\u0432\u0435\u0441\u0442\u0430 \u043d\u0430 \u0442\u0435\u043c\u0443 &#8216;\u041a\u043e\u0441\u043c\u043e\u0441&#8217;&#8230;&#187;<\/em>\u00a0\u2014 \u0438 \u0447\u0435\u0440\u0435\u0437 \u043c\u0438\u043d\u0443\u0442\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439, \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u042d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441!<\/p>\n<h2>\u042d\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b: \u043e\u0442 \u0441\u043f\u0430\u0433\u0435\u0442\u0442\u0438-\u043a\u043e\u0434\u0430 \u0432 PureData \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u043c\u0443 \u0445\u0430\u043e\u0441\u0443 \u0432 NiFi<\/h2>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443\u00a0<strong>\u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 NiFi<\/strong>, \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u0434\u0435\u0435\u0439?<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u043e\u043b\u043d\u043e\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/strong>\u00a0\u0412\u0435\u0441\u044c workflow \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d \u0432 \u0433\u0440\u0430\u0444\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432.\u00a0<code>RouteOnAttribute<\/code>,\u00a0<code>UpdateAttribute<\/code>,\u00a0<code>ReplaceText<\/code>\u00a0\u2014 \u0432\u0441\u0435 \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u044b\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u043b\u043b\u044e\u0437\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b:<\/strong>\u00a0\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f &#171;\u0432\u043e\u043f\u0440\u043e\u0441-\u043e\u0442\u0432\u0435\u0442&#187; \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 Low-Code\/No-Code:<\/strong>\u00a0\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 NiFi.<\/p>\n<\/li>\n<\/ul>\n<p>\u0423\u0432\u044b, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u043e\u0439 \u0433\u0440\u0430\u0444 \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441\u0430 live-coding \u043d\u0430 \u00a0<strong>PureData<\/strong>.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5b8\/da2\/97d\/5b8da297d5baaeb98d554cf0d58c19e5.png\" alt=\"\u041c\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043d\u044c \u0440\u0430\u0431\u043e\u0442\u044b\" title=\"\u041c\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043d\u044c \u0440\u0430\u0431\u043e\u0442\u044b\" width=\"1742\" height=\"780\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5b8\/da2\/97d\/5b8da297d5baaeb98d554cf0d58c19e5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5b8\/da2\/97d\/5b8da297d5baaeb98d554cf0d58c19e5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041c\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043d\u044c \u0440\u0430\u0431\u043e\u0442\u044b<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0432 \u0442\u0435\u043c\u0435, PureData \u2014 \u044d\u0442\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0443\u0437\u044b\u043a\u0438 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0430-\u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0439, \u0433\u0434\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0438\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0431\u043b\u043e\u043a\u043e\u0432. \u0418 \u0442\u0430\u043c \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0432\u0443\u0447\u0430\u043d\u0438\u0435, \u043d\u043e \u0438 \u0441\u0430\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u00ab\u043f\u0430\u0442\u0447\u0430\u00bb \u2014 \u0441\u043b\u043e\u0436\u043d\u043e\u0435, \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043b\u0435\u0442\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0435\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0448\u043e\u0443.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e \u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0440\u043e\u0432\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435! \u041c\u043e\u0439 NiFi-\u0433\u0440\u0430\u0444 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0440\u044f\u043b \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e \u0441 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u0438 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u00a0<strong>\u0430\u0432\u0430\u043d\u0433\u0430\u0440\u0434\u043d\u043e\u0435 digital-\u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e<\/strong>. \u0411\u044b\u043b\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438, \u043f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u0434\u0430\u0436\u0435 \u0432\u0435\u0441\u0435\u043b\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u044d\u0442\u0438\u043c \u0445\u0430\u043e\u0441\u043e\u043c. \u041d\u043e \u0440\u043e\u0432\u043d\u043e \u0434\u043e \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043f\u043e\u043a\u0430 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u043d\u0435\u0441\u0442\u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435.<br \/>\u042f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u044e \u043d\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0430 \u0430\u0440\u0442-\u043e\u0431\u044a\u0435\u043a\u0442. \u0426\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u044e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u043a\u043e\u043d\u0443 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u044f \u043f\u0440\u0438\u0448\u0435\u043b:<\/strong><br \/><strong>Pure No-Code \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 NiFi \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 ETL-\u0437\u0430\u0434\u0430\u0447, \u043d\u043e \u043a\u0430\u0442\u0430\u0441\u0442\u0440\u043e\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0434\u0432\u0438\u0436\u043e\u043a.<\/strong><\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<strong>Groovy \u0432\u00a0<\/strong><code><strong>ExecuteScript<\/strong><\/code>\u00a0\u0441\u0442\u0430\u043b\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u043c\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c. \u041e\u043d\u043e \u0434\u0430\u043b\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c:<\/strong>\u00a0\u0421\u043b\u043e\u0436\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435, \u0430 \u043d\u0435 \u0432 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0427\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c:<\/strong>\u00a0\u041a\u043e\u0434 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u0438 \u0446\u0438\u043a\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0449\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0447\u0435\u043c \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444.<\/p>\n<\/li>\n<li>\n<p><strong>\u041b\u0451\u0433\u043a\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438:<\/strong>\u00a0\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0444\u0438\u0447\u0443, \u044f \u043f\u0440\u0430\u0432\u043b\u044e \u043a\u043e\u0434 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043f\u043e\u0442\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u043e\u0449\u044c:<\/strong>\u00a0\u041f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a Java-\u0441\u0442\u0435\u043a\u0443 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441:\u00a0<strong>\u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043a\u0443\u0434\u0430 \u0438\u0434\u0443\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f) \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0437\u0430 NiFi, \u0430 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u2014 \u0437\u0430 \u043a\u043e\u0434\u043e\u043c.<\/strong>\u00a0\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e.<\/p>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442?<\/h2>\n<p><strong>\u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0439 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 UI NiFi. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u043b\u0438 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u2014 \u0434\u0435\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043b\u0438\u043a\u043e\u0432.<\/strong><\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/16d\/686\/4be\/16d6864be57996301e4ef70645c8d22c.png\" alt=\"\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430\" title=\"\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430\" width=\"933\" height=\"901\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/16d\/686\/4be\/16d6864be57996301e4ef70645c8d22c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/16d\/686\/4be\/16d6864be57996301e4ef70645c8d22c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u0421\u0435\u0440\u0434\u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b: \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043d\u0430 Groovy<\/strong><\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445 \u043d\u0430 Groovy, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432\u00a0<code>ExecuteScript<\/code>. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 JVM \u0441 \u043f\u0440\u044f\u043c\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a\u043e \u0432\u0441\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c NiFi.<\/p>\n<p><strong>1. \u0420\u043e\u0443\u0442\u0438\u043d\u0433 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/strong><br \/>\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f: \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 inline-\u043a\u043d\u043e\u043f\u043a\u0443 (<code>callback<\/code>), \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 (<code>command<\/code>) \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u043e\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import groovy.json.JsonSlurper  def flowFile = session.get() if (!flowFile) return  try { \u00a0 \u00a0 def content = session.read(flowFile).getText('UTF-8') \u00a0 \u00a0 def update = new JsonSlurper().parseText(content)  \u00a0 \u00a0 def eventType = update.callback_query ? \"callback\" : \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 update.message?.text?.startsWith('\/') ? \"command\" : \"unknown\" \u00a0 \u00a0 def messageData = update.callback_query?.data ?: update.message?.text ?: \"\" \u00a0 \u00a0 def chatId = update.message?.chat?.id ?: update.callback_query?.message?.chat?.id ?: \"\"  \u00a0 \u00a0 \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u00a0 \u00a0 flowFile = session.putAllAttributes(flowFile, [ \u00a0 \u00a0 \u00a0 \u00a0 'telegram.event_type': eventType, \u00a0 \u00a0 \u00a0 \u00a0 'telegram.message_data': messageData, \u00a0 \u00a0 \u00a0 \u00a0 'telegram.chat_id': chatId.toString() \u00a0 \u00a0 ])  \u00a0 \u00a0 \/\/ \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435, \u0430 \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u0441\u0434\u0435\u043b\u0430\u0435\u043c RouteOnAttribute \u00a0 \u00a0 session.transfer(flowFile, REL_SUCCESS)  } catch (e) { \u00a0 \u00a0 log.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" + e, e) \u00a0 \u00a0 flowFile = session.putAttribute(flowFile, 'error.message', e.message) \u00a0 \u00a0 session.transfer(flowFile, REL_FAILURE) }<\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u00a0<\/em><code><em>RouteOnAttribute<\/em><\/code><em>\u00a0\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 FlowFile \u043f\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043f\u0443\u0442\u044f\u043c (<\/em><code><em>telegram.event_type<\/em><\/code><em>), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438\u043b\u0438 callback&#8217;\u043e\u0432.<\/em><\/p>\n<p><strong>2. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0446\u0435\u043d \u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438<\/strong><br \/>\u0421\u0430\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0446\u0435\u043d\u0430\u043c\u0438 \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u044b. \u0412\u043e\u0442 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import groovy.json.JsonSlurper import groovy.json.JsonOutput  def flowFile = session.get() if (!flowFile) return  try { \u00a0 \u00a0 \/\/ 1. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u00a0 \u00a0 def callbackData = flowFile.getAttribute('telegram.message_data') \u00a0 \u00a0 def currentScene = flowFile.getAttribute('current_scene') ?: \"start\" \u00a0 \u00a0 def configFile = flowFile.getAttribute('configFile')    \u00a0 \u00a0 \/\/ 2. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u00a0 \u00a0 def config = new JsonSlurper().parse(new File(configFile)) \u00a0 \u00a0 \/\/ 3. \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c callback \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u00a0 \u00a0 def result = processCallback(callbackData, currentScene, config) \u00a0 \u00a0 def response = result.response \u00a0 \u00a0 def newScene = result.scene   \u00a0 \u00a0 \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c endpoint based on media type \u00a0 \u00a0 def endpoint = 'sendMessage' \u00a0 \u00a0 \u00a0 \u00a0 if (response.photo) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 endpoint = 'sendPhoto' \u00a0 \u00a0 \u00a0 \u00a0 } else if (response.video) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 endpoint = 'sendVideo' \u00a0 \u00a0 \u00a0 \u00a0 } else if (response.audio) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 endpoint = 'sendAudio' \u00a0 \u00a0 \u00a0 \u00a0 }  \u00a0 \u00a0 \/\/ 4. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u043c\u0435\u043d\u044e \u00a0 \u00a0 addMenuButtons(response)  \u00a0 \u00a0 \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u00a0 \u00a0 flowFile = session.putAllAttributes(flowFile, [ \u00a0 \u00a0 \u00a0 \u00a0 'current_scene': newScene, \u00a0 \u00a0 \u00a0 \u00a0 'telegram.endpoint': endpoint, \u00a0 \u00a0 \u00a0 \u00a0 'response.json': JsonOutput.toJson(response), \u00a0 \u00a0 \u00a0 \u00a0 'response.parse_mode': 'MarkdownV2' \u00a0 \u00a0 ])  \u00a0 \u00a0 session.transfer(flowFile, REL_SUCCESS) } catch (e) { \u00a0 \u00a0 log.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" + e, e) \u00a0 \u00a0 flowFile = session.putAttribute(flowFile, 'error.message', e.message) \u00a0 \u00a0 session.transfer(flowFile, REL_FAILURE) }  \/\/ \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 callback def processCallback(callbackData, currentScene, config) { \u00a0 \u00a0 def result = [response: [:], scene: currentScene] \u00a0 \u00a0 switch (callbackData) { \u00a0 \u00a0 \u00a0 \u00a0 case { it?.startsWith(\"scene:\") }: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result = handleSceneTransition(callbackData, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 \u00a0 \u00a0 case { it?.startsWith(\"quest:\") &amp;&amp; !it?.contains(\":answer:\") }: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result = handleQuestStart(callbackData, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 \u00a0 \u00a0 case { it?.startsWith(\"quest:\") &amp;&amp; it?.contains(\":answer:\") }: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result = handleQuestAnswer(callbackData, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 \u00a0 \u00a0 default: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.response = [text: \"\u26a0\ufe0f \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430\"] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 } \u00a0 \u00a0 return result }   \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u0446\u0435\u043d\u0430\u043c\u0438 def handleSceneTransition(callbackData, config, currentScene) { \u00a0 \u00a0 def sceneName = callbackData.replace(\"scene:\", \"\") \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 response: config.scenes[sceneName], \u00a0 \u00a0 \u00a0 \u00a0 scene: sceneName \u00a0 \u00a0 ] }    \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0432\u0435\u0441\u0442\u0430 def handleQuestStart(callbackData, config, currentScene) { \u00a0 \u00a0 def questId = callbackData.replace(\"quest:\", \"\") \u00a0 \u00a0 def quest = config.quests[questId] \u00a0 \u00a0 if (quest) { \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: buildQuestResponse(quest), \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: \"quest:\" + questId \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u274c \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e\"], \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: currentScene \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 } }  \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043a\u0432\u0435\u0441\u0442\u043e\u0432 def handleQuestAnswer(callbackData, config, currentScene) { \u00a0 \u00a0 def parts = callbackData.split(\":\") \u00a0 \u00a0 if (parts.size() &gt;= 4) { \u00a0 \u00a0 \u00a0 \u00a0 def questId = parts[1] \u00a0 \u00a0 \u00a0 \u00a0 def quest = config.quests[questId] \u00a0 \u00a0 \u00a0 \u00a0 if (quest) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def answer = quest.answers[callbackData] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (answer) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return handleAnswerTransition(answer, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u274c \u041e\u0442\u0432\u0435\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\"], \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: currentScene \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u274c \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e\"], \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: currentScene \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u26a0\ufe0f \u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0442\u0432\u0435\u0442\u0430\"], \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: currentScene \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 } }  \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043a\u0432\u0435\u0441\u0442\u0443 (\u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c) def handleQuestTransition(nextQuestId, config, currentScene) { \u00a0 \u00a0 def questId = nextQuestId.replace(\"quest:\", \"\") \u00a0 \u00a0 def nextQuest = config.quests[questId] \u00a0 \u00a0 if (nextQuest) { \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: buildQuestResponse(nextQuest), \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: \"quest:\" + questId \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u274c \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e\"], \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: currentScene \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 } }      \/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u043a\u0432\u0435\u0441\u0442\u0430 def buildQuestResponse(quest) { \u00a0 \u00a0 if (!quest) return [text: \"\u274c \u041e\u0448\u0438\u0431\u043a\u0430: \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e\"] \u00a0 \u00a0 def response = [:] \u00a0 \u00a0 \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0434\u0438\u0430\u0444\u0430\u0439\u043b\u044b \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u00a0 \u00a0 if (quest.image) { \u00a0 \u00a0 \u00a0 \u00a0 response.photo = \"\/opt\/nifi\/quest\/images\/\" + quest.image \u00a0 \u00a0 \u00a0 \u00a0 response.caption = quest.text \u00a0 \u00a0 \u00a0 \u00a0 response.parse_mode = 'MarkdownV2' \u00a0 \u00a0 } else if (quest.video) { \u00a0 \u00a0 \u00a0 \u00a0 response.video = \"\/opt\/nifi\/quest\/video\/\" + quest.video \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response.caption = quest.text \u00a0 \u00a0 \u00a0 \u00a0 response.parse_mode = 'MarkdownV2' \u00a0 \u00a0 } else if (quest.audio) { \u00a0 \u00a0 \u00a0 \u00a0 response.audio = \"\/opt\/nifi\/quest\/audio\/\" + quest.audio \u00a0 \u00a0 \u00a0 \u00a0 response.caption = quest.text \u00a0 \u00a0 \u00a0 \u00a0 response.parse_mode = 'MarkdownV2' \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u043c\u0435\u0434\u0438\u0430 - \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0435\u043a\u0441\u0442 \u00a0 \u00a0 \u00a0 \u00a0 response.text = quest.text \u00a0 \u00a0 \u00a0 \u00a0 response.parse_mode = 'MarkdownV2' \u00a0 \u00a0 }  \u00a0 \u00a0 \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u00a0 \u00a0 if (quest.answers) { \u00a0 \u00a0 \u00a0 \u00a0 def keyboard = [] \u00a0 \u00a0 \u00a0 \u00a0 quest.answers.each { key, answer -&gt; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 keyboard &lt;&lt; [text: answer.text, callback_data: key] \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 \u00a0 \u00a0 response.reply_markup = [inline_keyboard: [keyboard]] \u00a0 \u00a0 } \u00a0 \u00a0 return response }  \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043d\u043e\u043f\u043e\u043a \u043c\u0435\u043d\u044e \u043a \u043e\u0442\u0432\u0435\u0442\u0443 def addMenuButtons(response) { \u00a0 \u00a0 if (response &amp;&amp; response instanceof Map) { \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \u0415\u0441\u043b\u0438 response - \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442 (\u0431\u0435\u0437 reply_markup) \u00a0 \u00a0 \u00a0 \u00a0 if (!response.reply_markup &amp;&amp; response.text) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response.reply_markup = [inline_keyboard: []] \u00a0 \u00a0 \u00a0 \u00a0 }  \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u043c\u0435\u043d\u044e \u00a0 \u00a0 \u00a0 \u00a0 if (response.reply_markup) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def menuButton = [text: \"\ud83c\udfe0 \u041c\u0435\u043d\u044e\", callback_data: \"scene:start\"] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def helpButton = [text: \"\u2753 \u041f\u043e\u043c\u043e\u0449\u044c\", callback_data: \"scene:help\"] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def menuRow = [menuButton, helpButton] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (response.reply_markup.inline_keyboard instanceof List) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response.reply_markup.inline_keyboard.add(menuRow) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response.reply_markup.inline_keyboard = [menuRow] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 } }  \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u043e\u0442\u0432\u0435\u0442\u0430\u043c def handleAnswerTransition(answer, config, currentScene) { \u00a0 \u00a0 if (!answer) { \u00a0 \u00a0 \u00a0 \u00a0 return [response: [text: \"\u274c \u041e\u0442\u0432\u0435\u0442 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\"], scene: currentScene] \u00a0 \u00a0 }  \u00a0 \u00a0 def result = [scene: currentScene] \u00a0 \u00a0 \/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u00a0 \u00a0 if (answer.next) { \u00a0 \u00a0 \u00a0 \u00a0 if (answer.next.startsWith(\"quest:\")) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def nextQuestId = answer.next.replace(\"quest:\", \"\") \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def nextQuest = config.quests[nextQuestId] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (nextQuest) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.response = buildQuestResponse(nextQuest) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.scene = \"quest:\" + nextQuestId \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 \u00a0 \u00a0 } else if (answer.next.startsWith(\"scene:\")) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def sceneName = answer.next.replace(\"scene:\", \"\") \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def nextScene = config.scenes[sceneName] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (nextScene) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.response = nextScene \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.scene = sceneName \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 }  \u00a0 \u00a0 \/\/ \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c response - \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\/\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0435\u043a\u0441\u0442  \u00a0 \u00a0 if (answer.response) { \u00a0 \u00a0 \u00a0 \u00a0 if (result.response &amp;&amp; result.response.text) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c response \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0442\u0435\u043a\u0441\u0442\u0443 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.response.text = answer.response + \"\\n\\n\" + result.response.text \u00a0 \u00a0 \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.response = [text: answer.response, parse_mode: 'MarkdownV2'] \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 } \u00a0 \u00a0 return result }<\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u042d\u0442\u043e \u044f\u0434\u0440\u043e \u0438\u0433\u0440\u044b. \u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 JSON-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0443\u044e \u0441\u0446\u0435\u043d\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e next, \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438.<\/em><\/p>\n<p><strong>3. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a Telegram<\/strong><br \/>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 Telegram API \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import org.apache.nifi.processor.io.StreamCallback import groovy.json.JsonSlurper import groovy.json.JsonOutput  def flowFile = session.get() if (!flowFile) return  try {     \/\/ \u0411\u0435\u0440\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 JSON \u0438\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430     def responseJson = flowFile.getAttribute('response.json')     def telegramRequest = new JsonSlurper().parseText(responseJson)          \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f     telegramRequest.chat_id = flowFile.getAttribute('telegram.chat_id')     telegramRequest.parse_mode = flowFile.getAttribute('response.parse_mode') ?: 'MarkdownV2'          \/\/ \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 JSON     def jsonOutput = JsonOutput.toJson(telegramRequest)          \/\/ \u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 FlowFile     flowFile = session.write(flowFile, { inputStream, outputStream -&gt;         outputStream.write(jsonOutput.getBytes('UTF-8'))     } as StreamCallback)          session.transfer(flowFile, REL_SUCCESS) } catch (e) {     log.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" + e, e)     flowFile = session.putAttribute(flowFile, 'error.message', e.message)     session.transfer(flowFile, REL_FAILURE) }<\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a API Telegram \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439\u00a0<\/em><code><em>chat_id<\/em><\/code><em>\u00a0\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u0438\u0433\u0440\u043e\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430.<\/em><\/p>\n<h2>\u042d\u0432\u043e\u043b\u044e\u0446\u0438\u044f: \u0434\u043e\u0440\u043e\u0436\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0430 (To-Be)<\/h2>\n<p>\u041f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0433\u043e\u0442\u043e\u0432. \u041d\u043e \u043a\u0430\u043a \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0430\u043c\u0430?<br \/> \u041e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043e\u043f\u044b\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 RAG-\u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u044f \u0432\u0438\u0436\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6e3\/01f\/f6f\/6e301ff6f930652cea00a6ea1518a30c.png\" alt=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 to be \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f \u0432 \u0441\u0435\u0431\u044f \u043c\u043e\u0434\u0443\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430.\" title=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 to be \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f \u0432 \u0441\u0435\u0431\u044f \u043c\u043e\u0434\u0443\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430.\" width=\"1537\" height=\"764\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/6e3\/01f\/f6f\/6e301ff6f930652cea00a6ea1518a30c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6e3\/01f\/f6f\/6e301ff6f930652cea00a6ea1518a30c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 to be \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f \u0432 \u0441\u0435\u0431\u044f \u043c\u043e\u0434\u0443\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430.<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 AI-\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440:<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/strong>\u00a0\u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0431\u043e\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u0438\u0442 CSV-\u0444\u0430\u0439\u043b \u0441 \u043f\u0440\u043e\u043c\u0442\u0430\u043c\u0438 \u0438 \u0442\u0435\u043c\u0430\u043c\u0438 \u043d\u0430 \u0433\u043e\u0434 \u0432\u043f\u0435\u0440\u0435\u0434.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f:<\/strong>\u00a0NiFi \u043f\u0430\u0440\u0441\u0438\u0442 CSV, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u043c\u0442 \u0432\u00a0<strong>\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e LLM (Ollama)<\/strong>\u00a0\u0447\u0435\u0440\u0435\u0437 API, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0438\u0445 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u044c\u044e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 JSON \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438\u0433\u0440\u044b \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0440\u043e\u043c\u043f\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f:<\/strong>\u00a0\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 JSON \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0430\u043c\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0435\u043f\u043b\u043e\u0439:<\/strong>\u00a0\u0412\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JSON \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u043e\u0442\u0430 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0437 \u0432 2 \u043d\u0435\u0434\u0435\u043b\u0438, \u0438\u043b\u0438 \u0440\u0430\u0437 \u0432 \u043c\u0435\u0441\u044f\u0446).<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/strong>\u00a0\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u043e\u043d\u0441\u044b \u043d\u043e\u0432\u044b\u0445 \u0438\u0433\u0440 \u0432 \u043a\u0430\u043d\u0430\u043b\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u043e\u0442\u0430 \u0438\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u00a0<strong>\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u044b\u0439, \u0441\u0430\u043c\u043e\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441<\/strong>.<\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434\u044b<\/strong><br \/> \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.\u00a0<strong>Apache NiFi<\/strong>\u00a0\u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u0433\u0438\u0431\u043a\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u044d\u043a\u0435\u043d\u0434\u0430, \u0430\u00a0<strong>LLM<\/strong>\u00a0\u2014 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0430\u0442, \u0430 <strong>\u0434\u0432\u0438\u0436\u043e\u043a<\/strong> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u0432, \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0433\u0434\u0435 \u0432\u0430\u0436\u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u0442\u0430\u043b \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437. \u041e\u043d \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 LLM \u0438 low-code \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0440\u043e\u0434\u0435 NiFi \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043d\u0435 \u0431\u043e\u044f\u0442\u044c\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c.<\/p>\n<p><strong>\u041a\u0430\u043a \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ETL-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432\u0440\u043e\u0434\u0435 NiFi \u0434\u043b\u044f \u0431\u044d\u043a\u0435\u043d\u0434\u0430?<\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/941810\/\"> https:\/\/habr.com\/ru\/articles\/941810\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h3>\n<p>\u041a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u0443\u044e \u0438\u0434\u0435\u044e \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438? \u042f \u0441\u043e\u0437\u0434\u0430\u043b \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443 \u0432 Telegram \u0437\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043d\u0430 Apache NiFi \u0438 Groovy, \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u2014 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439, \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0431\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u0431\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f MVP.<\/p>\n<p>\u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u044d\u0442\u0430\u043f\u044b \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u0438 \u043a\u0430\u043a AI \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u0432\u0438\u0436\u043a\u043e\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430.<\/p>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043c\u043e\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 \u0432 Telegram. \u0417\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u0430 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u0438\u043a\u0442\u043e\u0440\u0438\u043d\u044b \u0438\u043b\u0438 \u043a\u0432\u0435\u0441\u0442\u0430. \u041d\u043e \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0431\u044d\u043a\u0435\u043d\u0434&#8230; \u041d\u0435 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0426\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u044f\u0441\u043d\u0430: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u043e\u0433\u043e \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u0431\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c. \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u0441\u0432\u044f\u0437\u043a\u0443\u00a0<strong>Apache NiFi<\/strong>\u00a0\u0434\u043b\u044f \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u00a0<strong>Groovy<\/strong>\u00a0\u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<p><em>P.S. \u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443, \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f NiFi \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 GitHub. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0437\u0432\u0451\u0437\u0434\u043e\u0447\u043a\u0430\u043c \u0438 \u043f\u0443\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u0430\u043c!<\/em><\/p>\n<p><a href=\"https:\/\/github.com\/SMAnatoly\/quest-telegram-bot\" rel=\"noopener noreferrer nofollow\">FutureGuest Bot repository<\/a><\/p>\n<hr\/>\n<h2>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 (As-Is):<\/h2>\n<ul>\n<li>\n<p><strong>\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0441 Markdown:<\/strong>\u00a0\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f:<\/strong>\u00a0\u041f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0437\u0430\u043d\u043e\u0432\u043e. \u042d\u0442\u043e \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0442\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e JSON:<\/strong>\u00a0\u0412\u0441\u044f \u0438\u0433\u0440\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u0417\u0430\u043c\u0435\u043d\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u043e\u0432\u043e\u0433\u043e JSON.<\/p>\n<\/li>\n<\/ul>\n<div class=\"floating-image\">\n<figure class=\"float bordered full-width\"><\/figure>\n<\/div>\n<h2>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435: Pull vs Push<\/h2>\n<p>\u042f \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0440\u043e\u0441\u0430 (Polling). NiFi \u0440\u0430\u0437 \u0432 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441\u0430\u043c \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 Telegram Bot API (<code>getUpdates<\/code>), \u0435\u0441\u0442\u044c \u043b\u0438 \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443?<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u043e\u0449\u0435:<\/strong>\u00a0\u041d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u0435\u043b\u044b\u0439 IP, SSL-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u0440\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0434\u0435\u0436\u043d\u0435\u0435:<\/strong>\u00a0\u0415\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0430\u0434\u0430\u0435\u0442, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0436\u0435. \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430.<\/strong><\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\">\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 as is<\/figcaption><\/div>\n<\/figure>\n<h2>\u041c\u0430\u0433\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/h2>\n<p>\u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0442\u043d\u0438 \u043e\u0442\u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439 \u0441\u044e\u0436\u0435\u0442\u0430 \u2014 \u0441\u043a\u0443\u0447\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0435\u0441\u044c JSON \u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u00a0<strong>\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438<\/strong>\u00a0(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, DeepSeek). \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0442:\u00a0<em>&#171;\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439 JSON \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 &lt;\u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0448\u0430\u0431\u043b\u043e\u043d task.json&gt; \u0434\u043b\u044f \u043a\u0432\u0435\u0441\u0442\u0430 \u043d\u0430 \u0442\u0435\u043c\u0443 &#8216;\u041a\u043e\u0441\u043c\u043e\u0441&#8217;&#8230;&#187;<\/em>\u00a0\u2014 \u0438 \u0447\u0435\u0440\u0435\u0437 \u043c\u0438\u043d\u0443\u0442\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439, \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u042d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441!<\/p>\n<h2>\u042d\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b: \u043e\u0442 \u0441\u043f\u0430\u0433\u0435\u0442\u0442\u0438-\u043a\u043e\u0434\u0430 \u0432 PureData \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u043c\u0443 \u0445\u0430\u043e\u0441\u0443 \u0432 NiFi<\/h2>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443\u00a0<strong>\u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 NiFi<\/strong>, \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u0434\u0435\u0435\u0439?<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u043e\u043b\u043d\u043e\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/strong>\u00a0\u0412\u0435\u0441\u044c workflow \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d \u0432 \u0433\u0440\u0430\u0444\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432.\u00a0<code>RouteOnAttribute<\/code>,\u00a0<code>UpdateAttribute<\/code>,\u00a0<code>ReplaceText<\/code>\u00a0\u2014 \u0432\u0441\u0435 \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u044b\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u043b\u043b\u044e\u0437\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b:<\/strong>\u00a0\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f &#171;\u0432\u043e\u043f\u0440\u043e\u0441-\u043e\u0442\u0432\u0435\u0442&#187; \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 Low-Code\/No-Code:<\/strong>\u00a0\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 NiFi.<\/p>\n<\/li>\n<\/ul>\n<p>\u0423\u0432\u044b, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u043e\u0439 \u0433\u0440\u0430\u0444 \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441\u0430 live-coding \u043d\u0430 \u00a0<strong>PureData<\/strong>.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041c\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043d\u044c \u0440\u0430\u0431\u043e\u0442\u044b<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0432 \u0442\u0435\u043c\u0435, PureData \u2014 \u044d\u0442\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0443\u0437\u044b\u043a\u0438 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0430-\u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0439, \u0433\u0434\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0438\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0431\u043b\u043e\u043a\u043e\u0432. \u0418 \u0442\u0430\u043c \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0432\u0443\u0447\u0430\u043d\u0438\u0435, \u043d\u043e \u0438 \u0441\u0430\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u00ab\u043f\u0430\u0442\u0447\u0430\u00bb \u2014 \u0441\u043b\u043e\u0436\u043d\u043e\u0435, \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043b\u0435\u0442\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0435\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0448\u043e\u0443.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e \u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0440\u043e\u0432\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435! \u041c\u043e\u0439 NiFi-\u0433\u0440\u0430\u0444 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0440\u044f\u043b \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e \u0441 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u0438 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u00a0<strong>\u0430\u0432\u0430\u043d\u0433\u0430\u0440\u0434\u043d\u043e\u0435 digital-\u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e<\/strong>. \u0411\u044b\u043b\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438, \u043f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u0434\u0430\u0436\u0435 \u0432\u0435\u0441\u0435\u043b\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u044d\u0442\u0438\u043c \u0445\u0430\u043e\u0441\u043e\u043c. \u041d\u043e \u0440\u043e\u0432\u043d\u043e \u0434\u043e \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043f\u043e\u043a\u0430 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u043d\u0435\u0441\u0442\u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435.<br \/>\u042f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u044e \u043d\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0430 \u0430\u0440\u0442-\u043e\u0431\u044a\u0435\u043a\u0442. \u0426\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u044e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u043a\u043e\u043d\u0443 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u044f \u043f\u0440\u0438\u0448\u0435\u043b:<\/strong><br \/><strong>Pure No-Code \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 NiFi \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 ETL-\u0437\u0430\u0434\u0430\u0447, \u043d\u043e \u043a\u0430\u0442\u0430\u0441\u0442\u0440\u043e\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0434\u0432\u0438\u0436\u043e\u043a.<\/strong><\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<strong>Groovy \u0432\u00a0<\/strong><code><strong>ExecuteScript<\/strong><\/code>\u00a0\u0441\u0442\u0430\u043b\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u043c\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c. \u041e\u043d\u043e \u0434\u0430\u043b\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c:<\/strong>\u00a0\u0421\u043b\u043e\u0436\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435, \u0430 \u043d\u0435 \u0432 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0427\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c:<\/strong>\u00a0\u041a\u043e\u0434 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u0438 \u0446\u0438\u043a\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0449\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0447\u0435\u043c \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444.<\/p>\n<\/li>\n<li>\n<p><strong>\u041b\u0451\u0433\u043a\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438:<\/strong>\u00a0\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0444\u0438\u0447\u0443, \u044f \u043f\u0440\u0430\u0432\u043b\u044e \u043a\u043e\u0434 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043f\u043e\u0442\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u043e\u0449\u044c:<\/strong>\u00a0\u041f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a Java-\u0441\u0442\u0435\u043a\u0443 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441:\u00a0<strong>\u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043a\u0443\u0434\u0430 \u0438\u0434\u0443\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f) \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0437\u0430 NiFi, \u0430 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u2014 \u0437\u0430 \u043a\u043e\u0434\u043e\u043c.<\/strong>\u00a0\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e.<\/p>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442?<\/h2>\n<p><strong>\u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0439 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 UI NiFi. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u043b\u0438 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u2014 \u0434\u0435\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043b\u0438\u043a\u043e\u0432.<\/strong><\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u0421\u0435\u0440\u0434\u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b: \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043d\u0430 Groovy<\/strong><\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445 \u043d\u0430 Groovy, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432\u00a0<code>ExecuteScript<\/code>. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 JVM \u0441 \u043f\u0440\u044f\u043c\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a\u043e \u0432\u0441\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c NiFi.<\/p>\n<p><strong>1. \u0420\u043e\u0443\u0442\u0438\u043d\u0433 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/strong><br \/>\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f: \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 inline-\u043a\u043d\u043e\u043f\u043a\u0443 (<code>callback<\/code>), \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 (<code>command<\/code>) \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u043e\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import groovy.json.JsonSlurper  def flowFile = session.get() if (!flowFile) return  try { \u00a0 \u00a0 def content = session.read(flowFile).getText('UTF-8') \u00a0 \u00a0 def update = new JsonSlurper().parseText(content)  \u00a0 \u00a0 def eventType = update.callback_query ? \"callback\" : \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 update.message?.text?.startsWith('\/') ? \"command\" : \"unknown\" \u00a0 \u00a0 def messageData = update.callback_query?.data ?: update.message?.text ?: \"\" \u00a0 \u00a0 def chatId = update.message?.chat?.id ?: update.callback_query?.message?.chat?.id ?: \"\"  \u00a0 \u00a0 \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u00a0 \u00a0 flowFile = session.putAllAttributes(flowFile, [ \u00a0 \u00a0 \u00a0 \u00a0 'telegram.event_type': eventType, \u00a0 \u00a0 \u00a0 \u00a0 'telegram.message_data': messageData, \u00a0 \u00a0 \u00a0 \u00a0 'telegram.chat_id': chatId.toString() \u00a0 \u00a0 ])  \u00a0 \u00a0 \/\/ \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435, \u0430 \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u0441\u0434\u0435\u043b\u0430\u0435\u043c RouteOnAttribute \u00a0 \u00a0 session.transfer(flowFile, REL_SUCCESS)  } catch (e) { \u00a0 \u00a0 log.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" + e, e) \u00a0 \u00a0 flowFile = session.putAttribute(flowFile, 'error.message', e.message) \u00a0 \u00a0 session.transfer(flowFile, REL_FAILURE) }<\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u00a0<\/em><code><em>RouteOnAttribute<\/em><\/code><em>\u00a0\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 FlowFile \u043f\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043f\u0443\u0442\u044f\u043c (<\/em><code><em>telegram.event_type<\/em><\/code><em>), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438\u043b\u0438 callback&#8217;\u043e\u0432.<\/em><\/p>\n<p><strong>2. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0446\u0435\u043d \u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438<\/strong><br \/>\u0421\u0430\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0446\u0435\u043d\u0430\u043c\u0438 \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u044b. \u0412\u043e\u0442 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import groovy.json.JsonSlurper import groovy.json.JsonOutput  def flowFile = session.get() if (!flowFile) return  try { \u00a0 \u00a0 \/\/ 1. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u00a0 \u00a0 def callbackData = flowFile.getAttribute('telegram.message_data') \u00a0 \u00a0 def currentScene = flowFile.getAttribute('current_scene') ?: \"start\" \u00a0 \u00a0 def configFile = flowFile.getAttribute('configFile')    \u00a0 \u00a0 \/\/ 2. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u00a0 \u00a0 def config = new JsonSlurper().parse(new File(configFile)) \u00a0 \u00a0 \/\/ 3. \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c callback \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u00a0 \u00a0 def result = processCallback(callbackData, currentScene, config) \u00a0 \u00a0 def response = result.response \u00a0 \u00a0 def newScene = result.scene   \u00a0 \u00a0 \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c endpoint based on media type \u00a0 \u00a0 def endpoint = 'sendMessage' \u00a0 \u00a0 \u00a0 \u00a0 if (response.photo) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 endpoint = 'sendPhoto' \u00a0 \u00a0 \u00a0 \u00a0 } else if (response.video) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 endpoint = 'sendVideo' \u00a0 \u00a0 \u00a0 \u00a0 } else if (response.audio) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 endpoint = 'sendAudio' \u00a0 \u00a0 \u00a0 \u00a0 }  \u00a0 \u00a0 \/\/ 4. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u043c\u0435\u043d\u044e \u00a0 \u00a0 addMenuButtons(response)  \u00a0 \u00a0 \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u00a0 \u00a0 flowFile = session.putAllAttributes(flowFile, [ \u00a0 \u00a0 \u00a0 \u00a0 'current_scene': newScene, \u00a0 \u00a0 \u00a0 \u00a0 'telegram.endpoint': endpoint, \u00a0 \u00a0 \u00a0 \u00a0 'response.json': JsonOutput.toJson(response), \u00a0 \u00a0 \u00a0 \u00a0 'response.parse_mode': 'MarkdownV2' \u00a0 \u00a0 ])  \u00a0 \u00a0 session.transfer(flowFile, REL_SUCCESS) } catch (e) { \u00a0 \u00a0 log.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" + e, e) \u00a0 \u00a0 flowFile = session.putAttribute(flowFile, 'error.message', e.message) \u00a0 \u00a0 session.transfer(flowFile, REL_FAILURE) }  \/\/ \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 callback def processCallback(callbackData, currentScene, config) { \u00a0 \u00a0 def result = [response: [:], scene: currentScene] \u00a0 \u00a0 switch (callbackData) { \u00a0 \u00a0 \u00a0 \u00a0 case { it?.startsWith(\"scene:\") }: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result = handleSceneTransition(callbackData, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 \u00a0 \u00a0 case { it?.startsWith(\"quest:\") &amp;&amp; !it?.contains(\":answer:\") }: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result = handleQuestStart(callbackData, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 \u00a0 \u00a0 case { it?.startsWith(\"quest:\") &amp;&amp; it?.contains(\":answer:\") }: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result = handleQuestAnswer(callbackData, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 \u00a0 \u00a0 default: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.response = [text: \"\u26a0\ufe0f \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430\"] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break \u00a0 \u00a0 } \u00a0 \u00a0 return result }   \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u0446\u0435\u043d\u0430\u043c\u0438 def handleSceneTransition(callbackData, config, currentScene) { \u00a0 \u00a0 def sceneName = callbackData.replace(\"scene:\", \"\") \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 response: config.scenes[sceneName], \u00a0 \u00a0 \u00a0 \u00a0 scene: sceneName \u00a0 \u00a0 ] }    \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0432\u0435\u0441\u0442\u0430 def handleQuestStart(callbackData, config, currentScene) { \u00a0 \u00a0 def questId = callbackData.replace(\"quest:\", \"\") \u00a0 \u00a0 def quest = config.quests[questId] \u00a0 \u00a0 if (quest) { \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: buildQuestResponse(quest), \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: \"quest:\" + questId \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u274c \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e\"], \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: currentScene \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 } }  \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043a\u0432\u0435\u0441\u0442\u043e\u0432 def handleQuestAnswer(callbackData, config, currentScene) { \u00a0 \u00a0 def parts = callbackData.split(\":\") \u00a0 \u00a0 if (parts.size() &gt;= 4) { \u00a0 \u00a0 \u00a0 \u00a0 def questId = parts[1] \u00a0 \u00a0 \u00a0 \u00a0 def quest = config.quests[questId] \u00a0 \u00a0 \u00a0 \u00a0 if (quest) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 def answer = quest.answers[callbackData] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (answer) { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return handleAnswerTransition(answer, config, currentScene) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u274c \u041e\u0442\u0432\u0435\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\"], \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 scene: currentScene \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ] \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } \u00a0 \u00a0 \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return [ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 response: [text: \"\u274c \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e\"], \u00a0 \u00a0 \u00a0 <\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-472526","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/472526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=472526"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/472526\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=472526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=472526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=472526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}