From b7d0283f7f96b5d2aee49c8a9eb440fa123703ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:28:11 +0000 Subject: [PATCH] deploy: e0e499dd6dd34818ad461861c7f5527305b60a2a --- 404.html | 4 ++-- assets/js/1eb5bd94.0ba63b47.js | 1 + assets/js/1eb5bd94.a9a96c62.js | 1 - assets/js/{3109491d.ffe53e7c.js => 3109491d.38eeb299.js} | 2 +- assets/js/{48ee0d35.af420f44.js => 48ee0d35.5cfedb60.js} | 2 +- assets/js/{935f2afb.0b1e4211.js => 935f2afb.d85e2672.js} | 2 +- assets/js/{c3f819a8.f711ebd0.js => c3f819a8.e1eeb5b2.js} | 2 +- assets/js/runtime~main.30567f55.js | 1 + assets/js/runtime~main.506d88a0.js | 1 - docs/core-concepts/Broker/index.html | 8 ++++---- docs/core-concepts/Consumer/index.html | 4 ++-- docs/core-concepts/Sender/index.html | 4 ++-- docs/getting-started/index.html | 6 +++--- docs/localstack/index.html | 4 ++-- docs/migration-guide/index.html | 4 ++-- docs/modules/json/index.html | 6 +++--- docs/modules/message-processor/index.html | 4 ++-- docs/modules/s3proxy/index.html | 4 ++-- docs/modules/xml/index.html | 6 +++--- index.html | 4 ++-- 20 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 assets/js/1eb5bd94.0ba63b47.js delete mode 100644 assets/js/1eb5bd94.a9a96c62.js rename assets/js/{3109491d.ffe53e7c.js => 3109491d.38eeb299.js} (66%) rename assets/js/{48ee0d35.af420f44.js => 48ee0d35.5cfedb60.js} (54%) rename assets/js/{935f2afb.0b1e4211.js => 935f2afb.d85e2672.js} (53%) rename assets/js/{c3f819a8.f711ebd0.js => c3f819a8.e1eeb5b2.js} (75%) create mode 100644 assets/js/runtime~main.30567f55.js delete mode 100644 assets/js/runtime~main.506d88a0.js diff --git a/404.html b/404.html index 9d1528b5..2d1672b7 100644 --- a/404.html +++ b/404.html @@ -5,13 +5,13 @@ Page Not Found | Pass4s - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/1eb5bd94.0ba63b47.js b/assets/js/1eb5bd94.0ba63b47.js new file mode 100644 index 00000000..b2e8eeda --- /dev/null +++ b/assets/js/1eb5bd94.0ba63b47.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[155],{3905:(e,r,n)=>{n.d(r,{Zo:()=>p,kt:()=>f});var t=n(7294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=t.createContext({}),l=function(e){var r=t.useContext(i),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=l(e.components);return t.createElement(i.Provider,{value:r},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(i,".").concat(d)]||m[d]||u[d]||a;return n?t.createElement(f,s(s({ref:r},p),{},{components:n})):t.createElement(f,s({ref:r},p))}));function f(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var c={};for(var i in r)hasOwnProperty.call(r,i)&&(c[i]=r[i]);c.originalType=e,c[m]="string"==typeof e?e:o,s[1]=c;for(var l=2;l{n.r(r),n.d(r,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var t=n(7462),o=(n(7294),n(3905));const a={sidebar_position:3},s="Broker",c={unversionedId:"core-concepts/Broker",id:"core-concepts/Broker",title:"Broker",description:'Broker is a higher level abstraction than Consumer and Sender, it resides in "com.ocadotechnology" %% "pass4s-high" % "0.4.8" module.',source:"@site/../mdoc/target/mdoc/core-concepts/Broker.md",sourceDirName:"core-concepts",slug:"/core-concepts/Broker",permalink:"/pass4s/docs/core-concepts/Broker",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/core-concepts/Broker.md",tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"sidebar",previous:{title:"Consumer",permalink:"/pass4s/docs/core-concepts/Consumer"},next:{title:"Message processor",permalink:"/pass4s/docs/modules/message-processor"}},i={},l=[],p={toc:l},m="wrapper";function u(e){let{components:r,...n}=e;return(0,o.kt)(m,(0,t.Z)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"broker"},"Broker"),(0,o.kt)("p",null,"Broker is a higher level abstraction than ",(0,o.kt)("inlineCode",{parentName:"p"},"Consumer")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Sender"),", it resides in ",(0,o.kt)("inlineCode",{parentName:"p"},'"com.ocadotechnology" %% "pass4s-high" % "0.4.8"')," module."),(0,o.kt)("p",null,"It aims to:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Provide an easy way to build sender and consumer out of a connector"),(0,o.kt)("li",{parentName:"ul"},"Allow the user to route the requests - select the right sender/consumer logic based on the source of the message")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},"trait Broker[F[_], +P] {\n def consumer[R >: P](source: Source[R]): Consumer[F, Payload]\n\n def sender[R >: P]: Sender[F, Message[R]]\n}\n\nobject Broker {\n def fromConnector[F[_]: Async, P](connector: Connector[F, P]): Broker[F, P]\n def routed[F[_], P](chooseBroker: End[P] => Broker[F, P]): Broker[F, P]\n}\n")),(0,o.kt)("p",null,"Sample broker initialization might look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'val brokerResource = Akka\n .system[IO]\n .flatMap { implicit sys =>\n implicit val connectorLogger: Logger[IO] = Slf4jLogger.getLoggerFromClass[IO](classOf[Connector[IO, Jms]])\n\n JmsConnector\n .singleBroker[IO](\n "admin",\n "admin",\n "failover:(tcp://localhost:61616)"\n )\n .map(_.logged)\n }\n .map(Broker.fromConnector[IO, Jms])\n')),(0,o.kt)("p",null,"Plese see the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/ocadotechnology/pass4s/blob/main/demo/src/main/scala/com/ocadotechnology/pass4s/demo/DemoMain.scala"},(0,o.kt)("inlineCode",{parentName:"a"},"DemoMain.scala")," for full usage example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1eb5bd94.a9a96c62.js b/assets/js/1eb5bd94.a9a96c62.js deleted file mode 100644 index f91bd088..00000000 --- a/assets/js/1eb5bd94.a9a96c62.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[155],{3905:(e,r,n)=>{n.d(r,{Zo:()=>p,kt:()=>f});var t=n(7294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=t.createContext({}),l=function(e){var r=t.useContext(i),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=l(e.components);return t.createElement(i.Provider,{value:r},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(i,".").concat(d)]||m[d]||u[d]||a;return n?t.createElement(f,s(s({ref:r},p),{},{components:n})):t.createElement(f,s({ref:r},p))}));function f(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var c={};for(var i in r)hasOwnProperty.call(r,i)&&(c[i]=r[i]);c.originalType=e,c[m]="string"==typeof e?e:o,s[1]=c;for(var l=2;l{n.r(r),n.d(r,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var t=n(7462),o=(n(7294),n(3905));const a={sidebar_position:3},s="Broker",c={unversionedId:"core-concepts/Broker",id:"core-concepts/Broker",title:"Broker",description:'Broker is a higher level abstraction than Consumer and Sender, it resides in "com.ocadotechnology" %% "pass4s-high" % "v0.4.7" module.',source:"@site/../mdoc/target/mdoc/core-concepts/Broker.md",sourceDirName:"core-concepts",slug:"/core-concepts/Broker",permalink:"/pass4s/docs/core-concepts/Broker",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/core-concepts/Broker.md",tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"sidebar",previous:{title:"Consumer",permalink:"/pass4s/docs/core-concepts/Consumer"},next:{title:"Message processor",permalink:"/pass4s/docs/modules/message-processor"}},i={},l=[],p={toc:l},m="wrapper";function u(e){let{components:r,...n}=e;return(0,o.kt)(m,(0,t.Z)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"broker"},"Broker"),(0,o.kt)("p",null,"Broker is a higher level abstraction than ",(0,o.kt)("inlineCode",{parentName:"p"},"Consumer")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Sender"),", it resides in ",(0,o.kt)("inlineCode",{parentName:"p"},'"com.ocadotechnology" %% "pass4s-high" % "v0.4.7"')," module."),(0,o.kt)("p",null,"It aims to:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Provide an easy way to build sender and consumer out of a connector"),(0,o.kt)("li",{parentName:"ul"},"Allow the user to route the requests - select the right sender/consumer logic based on the source of the message")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},"trait Broker[F[_], +P] {\n def consumer[R >: P](source: Source[R]): Consumer[F, Payload]\n\n def sender[R >: P]: Sender[F, Message[R]]\n}\n\nobject Broker {\n def fromConnector[F[_]: Async, P](connector: Connector[F, P]): Broker[F, P]\n def routed[F[_], P](chooseBroker: End[P] => Broker[F, P]): Broker[F, P]\n}\n")),(0,o.kt)("p",null,"Sample broker initialization might look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'val brokerResource = Akka\n .system[IO]\n .flatMap { implicit sys =>\n implicit val connectorLogger: Logger[IO] = Slf4jLogger.getLoggerFromClass[IO](classOf[Connector[IO, Jms]])\n\n JmsConnector\n .singleBroker[IO](\n "admin",\n "admin",\n "failover:(tcp://localhost:61616)"\n )\n .map(_.logged)\n }\n .map(Broker.fromConnector[IO, Jms])\n')),(0,o.kt)("p",null,"Plese see the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/ocadotechnology/pass4s/blob/main/demo/src/main/scala/com/ocadotechnology/pass4s/demo/DemoMain.scala"},(0,o.kt)("inlineCode",{parentName:"a"},"DemoMain.scala")," for full usage example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3109491d.ffe53e7c.js b/assets/js/3109491d.38eeb299.js similarity index 66% rename from assets/js/3109491d.ffe53e7c.js rename to assets/js/3109491d.38eeb299.js index 02dea6ed..6eb86c06 100644 --- a/assets/js/3109491d.ffe53e7c.js +++ b/assets/js/3109491d.38eeb299.js @@ -1 +1 @@ -"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[586],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>f});var n=o(7294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function a(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):a(a({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=p(o),u=r,f=m["".concat(l,".").concat(u)]||m[u]||d[u]||s;return o?n.createElement(f,a(a({ref:t},c),{},{components:o})):n.createElement(f,a({ref:t},c))}));function f(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=o.length,a=new Array(s);a[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[m]="string"==typeof e?e:r,a[1]=i;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>p});var n=o(7462),r=(o(7294),o(3905));const s={sidebar_position:4,description:"XML message serialization with Phobos"},a="XML",i={unversionedId:"modules/xml",id:"modules/xml",title:"XML",description:"XML message serialization with Phobos",source:"@site/../mdoc/target/mdoc/modules/xml.md",sourceDirName:"modules",slug:"/modules/xml",permalink:"/pass4s/docs/modules/xml",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/modules/xml.md",tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"XML message serialization with Phobos"},sidebar:"sidebar",previous:{title:"JSON",permalink:"/pass4s/docs/modules/json"},next:{title:"Migration guide",permalink:"/pass4s/docs/migration-guide"}},l={},p=[],c={toc:p},m="wrapper";function d(e){let{components:t,...o}=e;return(0,r.kt)(m,(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"xml"},"XML"),(0,r.kt)("p",null,"This section explains how to work with messages represented in XML. Pass4s comes with the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/Tinkoff/phobos/"},"Phobos")," support for XML message transformation."),(0,r.kt)("p",null,"To use the module make sure to add following import to your ",(0,r.kt)("inlineCode",{parentName:"p"},"build.sbt")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-scala"},'// phobos XML senders/consumers\n"com.ocadotechnology" %% "pass4s-phobos" % "v0.4.7"\n')),(0,r.kt)("p",null,"With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-scala"},"import com.ocadotechnology.pass4s.phobos.syntax._\n")),(0,r.kt)("p",null,"The syntax allows you to use ",(0,r.kt)("inlineCode",{parentName:"p"},".asXmlSender[T]")," on the senders and ",(0,r.kt)("inlineCode",{parentName:"p"},".asXmlConsumer[T]")," on consumers. Please note that for this to work, you need to provide ",(0,r.kt)("inlineCode",{parentName:"p"},"XmlEncoder[T]")," in case of ",(0,r.kt)("inlineCode",{parentName:"p"},"Sender")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"XmlDecoder[T]")," for ",(0,r.kt)("inlineCode",{parentName:"p"},"Consumer"),". "),(0,r.kt)("p",null,"Here's how to create most basic encoder and decoder using Phobos:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-scala"},'import ru.tinkoff.phobos.decoding._\nimport ru.tinkoff.phobos.encoding._\nimport ru.tinkoff.phobos.syntax._\nimport ru.tinkoff.phobos.derivation.semiauto._\n\nfinal case class XmlMessage(description: String, value: Long, rows: List[String])\n\nobject XmlMessage {\n implicit val xmlEncoder: XmlEncoder[XmlMessage] = deriveXmlEncoder("xmlMessage")\n implicit val xmlDecoder: XmlDecoder[XmlMessage] = deriveXmlDecoder("xmlMessage")\n}\n')),(0,r.kt)("p",null,"Please refer to the project repository ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/Tinkoff/phobos"},"https://github.com/Tinkoff/phobos")," for more detailed guide on using Phobos."),(0,r.kt)("p",null,"When applying the syntax to consumer, consider using ",(0,r.kt)("a",{parentName:"p",href:"message-processor"},"MessageProcessor"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[586],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>f});var n=o(7294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function a(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):a(a({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=p(o),u=r,f=m["".concat(l,".").concat(u)]||m[u]||d[u]||s;return o?n.createElement(f,a(a({ref:t},c),{},{components:o})):n.createElement(f,a({ref:t},c))}));function f(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=o.length,a=new Array(s);a[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[m]="string"==typeof e?e:r,a[1]=i;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>p});var n=o(7462),r=(o(7294),o(3905));const s={sidebar_position:4,description:"XML message serialization with Phobos"},a="XML",i={unversionedId:"modules/xml",id:"modules/xml",title:"XML",description:"XML message serialization with Phobos",source:"@site/../mdoc/target/mdoc/modules/xml.md",sourceDirName:"modules",slug:"/modules/xml",permalink:"/pass4s/docs/modules/xml",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/modules/xml.md",tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"XML message serialization with Phobos"},sidebar:"sidebar",previous:{title:"JSON",permalink:"/pass4s/docs/modules/json"},next:{title:"Migration guide",permalink:"/pass4s/docs/migration-guide"}},l={},p=[],c={toc:p},m="wrapper";function d(e){let{components:t,...o}=e;return(0,r.kt)(m,(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"xml"},"XML"),(0,r.kt)("p",null,"This section explains how to work with messages represented in XML. Pass4s comes with the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/Tinkoff/phobos/"},"Phobos")," support for XML message transformation."),(0,r.kt)("p",null,"To use the module make sure to add following import to your ",(0,r.kt)("inlineCode",{parentName:"p"},"build.sbt")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-scala"},'// phobos XML senders/consumers\n"com.ocadotechnology" %% "pass4s-phobos" % "0.4.8"\n')),(0,r.kt)("p",null,"With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-scala"},"import com.ocadotechnology.pass4s.phobos.syntax._\n")),(0,r.kt)("p",null,"The syntax allows you to use ",(0,r.kt)("inlineCode",{parentName:"p"},".asXmlSender[T]")," on the senders and ",(0,r.kt)("inlineCode",{parentName:"p"},".asXmlConsumer[T]")," on consumers. Please note that for this to work, you need to provide ",(0,r.kt)("inlineCode",{parentName:"p"},"XmlEncoder[T]")," in case of ",(0,r.kt)("inlineCode",{parentName:"p"},"Sender")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"XmlDecoder[T]")," for ",(0,r.kt)("inlineCode",{parentName:"p"},"Consumer"),". "),(0,r.kt)("p",null,"Here's how to create most basic encoder and decoder using Phobos:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-scala"},'import ru.tinkoff.phobos.decoding._\nimport ru.tinkoff.phobos.encoding._\nimport ru.tinkoff.phobos.syntax._\nimport ru.tinkoff.phobos.derivation.semiauto._\n\nfinal case class XmlMessage(description: String, value: Long, rows: List[String])\n\nobject XmlMessage {\n implicit val xmlEncoder: XmlEncoder[XmlMessage] = deriveXmlEncoder("xmlMessage")\n implicit val xmlDecoder: XmlDecoder[XmlMessage] = deriveXmlDecoder("xmlMessage")\n}\n')),(0,r.kt)("p",null,"Please refer to the project repository ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/Tinkoff/phobos"},"https://github.com/Tinkoff/phobos")," for more detailed guide on using Phobos."),(0,r.kt)("p",null,"When applying the syntax to consumer, consider using ",(0,r.kt)("a",{parentName:"p",href:"message-processor"},"MessageProcessor"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/48ee0d35.af420f44.js b/assets/js/48ee0d35.5cfedb60.js similarity index 54% rename from assets/js/48ee0d35.af420f44.js rename to assets/js/48ee0d35.5cfedb60.js index c46c15e1..c5e891c9 100644 --- a/assets/js/48ee0d35.af420f44.js +++ b/assets/js/48ee0d35.5cfedb60.js @@ -1 +1 @@ -"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[922],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=a.createContext({}),i=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=i(e.components);return a.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=i(n),m=o,g=d["".concat(l,".").concat(m)]||d[m]||u[m]||s;return n?a.createElement(g,r(r({ref:t},p),{},{components:n})):a.createElement(g,r({ref:t},p))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,r=new Array(s);r[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[d]="string"==typeof e?e:o,r[1]=c;for(var i=2;i{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>i});var a=n(7462),o=(n(7294),n(3905));const s={sidebar_position:1,description:"Pass4s documentation page"},r="Getting started",c={unversionedId:"getting-started",id:"getting-started",title:"Getting started",description:"Pass4s documentation page",source:"@site/../mdoc/target/mdoc/getting-started.md",sourceDirName:".",slug:"/getting-started",permalink:"/pass4s/docs/getting-started",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/getting-started.md",tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Pass4s documentation page"},sidebar:"sidebar",next:{title:"Sender",permalink:"/pass4s/docs/core-concepts/Sender"}},l={},i=[{value:"About",id:"about",level:2},{value:"Basis installation",id:"basis-installation",level:2},{value:"Modules",id:"modules",level:2},{value:"Connectors",id:"connectors",level:3},{value:"Useful utils",id:"useful-utils",level:3}],p={toc:i},d="wrapper";function u(e){let{components:t,...n}=e;return(0,o.kt)(d,(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"getting-started"},"Getting started"),(0,o.kt)("h2",{id:"about"},"About"),(0,o.kt)("p",null,"Pass4s is a Scala library providing an abstract layer for app messaging. It provides implementations for platforms like AWS SQS/SNS and ActiveMQ."),(0,o.kt)("h2",{id:"basis-installation"},"Basis installation"),(0,o.kt)("p",null,"The library is divided into multiple modules. If you're only interested in the basic abstractions, add following to your ",(0,o.kt)("inlineCode",{parentName:"p"},"build.sbt")," file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// Algebraic abstractions (Sender/Consumer)\n"com.ocadotechnology" %% "pass4s-kernel" % "v0.4.7"\n\n// Message, Destination, CommittableMessage, Connector\n"com.ocadotechnology" %% "pass4s-core" % "v0.4.7"\n\n// Broker\n"com.ocadotechnology" %% "pass4s-high" % "v0.4.7"\n')),(0,o.kt)("h2",{id:"modules"},"Modules"),(0,o.kt)("h3",{id:"connectors"},"Connectors"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://activemq.apache.org/"},"ActiveMq")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// ActiveMQ connector - based on Akka Alpakka\n"com.ocadotechnology" %% "pass4s-connector-activemq" % "v0.4.7"\n// ActiveMQ pekko connector - based on Pekko Connectors\n"com.ocadotechnology" %% "pass4s-connector-pekko-activemq" % "v0.4.7"\n')),(0,o.kt)("p",null,"\u26a0\ufe0f ",(0,o.kt)("strong",{parentName:"p"},"Warning")," Pekko connector is an experimental addition at the moment, as it is based on nightly build"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/aws/queues-and-notifications-now-best-friends/"},"SNS/SQS")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// SNS connector\n"com.ocadotechnology" %% "pass4s-connector-sns" % "v0.4.7"\n// SQS connector\n"com.ocadotechnology" %% "pass4s-connector-sqs" % "v0.4.7"\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://aws.amazon.com/kinesis/"},"Kinesis")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// Kinesis connector\n"com.ocadotechnology" %% "pass4s-connector-kinesis" % "v0.4.7"\n')),(0,o.kt)("h3",{id:"useful-utils"},"Useful utils"),(0,o.kt)("p",null,"Extras - provides ",(0,o.kt)("a",{parentName:"p",href:"modules/message-processor"},(0,o.kt)("inlineCode",{parentName:"a"},"MessageProcessor"))," for convenient way of building rich message consumers and an easy way to bind them to processor logic."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// high-level MessageProcessor\n"com.ocadotechnology" %% "pass4s-extra" % "v0.4.7"\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"modules/s3proxy"},"S3proxy")," - seamless support for proxying large messages through s3. Useful for sorting the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/sns/latest/dg/large-message-payloads.html"},"large messages on sns")," kind of problems."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// s3proxy\n"com.ocadotechnology" %% "pass4s-s3proxy" % "v0.4.7"\n\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://circe.github.io/circe/"},"Circe")," - JSON serialization/parsing support"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// circe JSON senders/consumers\n"com.ocadotechnology" %% "pass4s-circe" % "v0.4.7"\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/Tinkoff/phobos"},"Phobos")," - XML serialization/parsing support"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// phobos XML senders/consumers\n"com.ocadotechnology" %% "pass4s-phobos" % "v0.4.7"\n')),(0,o.kt)("p",null,"Logging middleware that uses ",(0,o.kt)("a",{parentName:"p",href:"https://typelevel.org/log4cats/"},"log4cats")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// logging middleware\n"com.ocadotechnology" %% "pass4s-logging" % "v0.4.7"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[922],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=a.createContext({}),i=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=i(e.components);return a.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=i(n),m=o,g=d["".concat(l,".").concat(m)]||d[m]||u[m]||s;return n?a.createElement(g,r(r({ref:t},p),{},{components:n})):a.createElement(g,r({ref:t},p))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,r=new Array(s);r[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[d]="string"==typeof e?e:o,r[1]=c;for(var i=2;i{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>i});var a=n(7462),o=(n(7294),n(3905));const s={sidebar_position:1,description:"Pass4s documentation page"},r="Getting started",c={unversionedId:"getting-started",id:"getting-started",title:"Getting started",description:"Pass4s documentation page",source:"@site/../mdoc/target/mdoc/getting-started.md",sourceDirName:".",slug:"/getting-started",permalink:"/pass4s/docs/getting-started",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/getting-started.md",tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Pass4s documentation page"},sidebar:"sidebar",next:{title:"Sender",permalink:"/pass4s/docs/core-concepts/Sender"}},l={},i=[{value:"About",id:"about",level:2},{value:"Basis installation",id:"basis-installation",level:2},{value:"Modules",id:"modules",level:2},{value:"Connectors",id:"connectors",level:3},{value:"Useful utils",id:"useful-utils",level:3}],p={toc:i},d="wrapper";function u(e){let{components:t,...n}=e;return(0,o.kt)(d,(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"getting-started"},"Getting started"),(0,o.kt)("h2",{id:"about"},"About"),(0,o.kt)("p",null,"Pass4s is a Scala library providing an abstract layer for app messaging. It provides implementations for platforms like AWS SQS/SNS and ActiveMQ."),(0,o.kt)("h2",{id:"basis-installation"},"Basis installation"),(0,o.kt)("p",null,"The library is divided into multiple modules. If you're only interested in the basic abstractions, add following to your ",(0,o.kt)("inlineCode",{parentName:"p"},"build.sbt")," file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// Algebraic abstractions (Sender/Consumer)\n"com.ocadotechnology" %% "pass4s-kernel" % "0.4.8"\n\n// Message, Destination, CommittableMessage, Connector\n"com.ocadotechnology" %% "pass4s-core" % "0.4.8"\n\n// Broker\n"com.ocadotechnology" %% "pass4s-high" % "0.4.8"\n')),(0,o.kt)("h2",{id:"modules"},"Modules"),(0,o.kt)("h3",{id:"connectors"},"Connectors"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://activemq.apache.org/"},"ActiveMq")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// ActiveMQ connector - based on Akka Alpakka\n"com.ocadotechnology" %% "pass4s-connector-activemq" % "0.4.8"\n// ActiveMQ pekko connector - based on Pekko Connectors\n"com.ocadotechnology" %% "pass4s-connector-pekko-activemq" % "0.4.8"\n')),(0,o.kt)("p",null,"\u26a0\ufe0f ",(0,o.kt)("strong",{parentName:"p"},"Warning")," Pekko connector is an experimental addition at the moment, as it is based on nightly build"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/aws/queues-and-notifications-now-best-friends/"},"SNS/SQS")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// SNS connector\n"com.ocadotechnology" %% "pass4s-connector-sns" % "0.4.8"\n// SQS connector\n"com.ocadotechnology" %% "pass4s-connector-sqs" % "0.4.8"\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://aws.amazon.com/kinesis/"},"Kinesis")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// Kinesis connector\n"com.ocadotechnology" %% "pass4s-connector-kinesis" % "0.4.8"\n')),(0,o.kt)("h3",{id:"useful-utils"},"Useful utils"),(0,o.kt)("p",null,"Extras - provides ",(0,o.kt)("a",{parentName:"p",href:"modules/message-processor"},(0,o.kt)("inlineCode",{parentName:"a"},"MessageProcessor"))," for convenient way of building rich message consumers and an easy way to bind them to processor logic."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// high-level MessageProcessor\n"com.ocadotechnology" %% "pass4s-extra" % "0.4.8"\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"modules/s3proxy"},"S3proxy")," - seamless support for proxying large messages through s3. Useful for sorting the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/sns/latest/dg/large-message-payloads.html"},"large messages on sns")," kind of problems."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// s3proxy\n"com.ocadotechnology" %% "pass4s-s3proxy" % "0.4.8"\n\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://circe.github.io/circe/"},"Circe")," - JSON serialization/parsing support"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// circe JSON senders/consumers\n"com.ocadotechnology" %% "pass4s-circe" % "0.4.8"\n')),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/Tinkoff/phobos"},"Phobos")," - XML serialization/parsing support"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// phobos XML senders/consumers\n"com.ocadotechnology" %% "pass4s-phobos" % "0.4.8"\n')),(0,o.kt)("p",null,"Logging middleware that uses ",(0,o.kt)("a",{parentName:"p",href:"https://typelevel.org/log4cats/"},"log4cats")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// logging middleware\n"com.ocadotechnology" %% "pass4s-logging" % "0.4.8"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/935f2afb.0b1e4211.js b/assets/js/935f2afb.d85e2672.js similarity index 53% rename from assets/js/935f2afb.0b1e4211.js rename to assets/js/935f2afb.d85e2672.js index 6f7b1c81..c9925aa0 100644 --- a/assets/js/935f2afb.0b1e4211.js +++ b/assets/js/935f2afb.d85e2672.js @@ -1 +1 @@ -"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[53],{1109:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"sidebar":[{"type":"link","label":"Getting started","href":"/pass4s/docs/getting-started","docId":"getting-started"},{"type":"category","label":"Core concepts","collapsible":true,"collapsed":false,"items":[{"type":"link","label":"Sender","href":"/pass4s/docs/core-concepts/Sender","docId":"core-concepts/Sender"},{"type":"link","label":"Consumer","href":"/pass4s/docs/core-concepts/Consumer","docId":"core-concepts/Consumer"},{"type":"link","label":"Broker","href":"/pass4s/docs/core-concepts/Broker","docId":"core-concepts/Broker"}]},{"type":"category","label":"Modules","collapsible":true,"collapsed":false,"items":[{"type":"link","label":"Message processor","href":"/pass4s/docs/modules/message-processor","docId":"modules/message-processor"},{"type":"link","label":"S3 Proxy","href":"/pass4s/docs/modules/s3proxy","docId":"modules/s3proxy"},{"type":"link","label":"JSON","href":"/pass4s/docs/modules/json","docId":"modules/json"},{"type":"link","label":"XML","href":"/pass4s/docs/modules/xml","docId":"modules/xml"}]},{"type":"link","label":"Migration guide","href":"/pass4s/docs/migration-guide","docId":"migration-guide"},{"type":"link","label":"Localstack","href":"/pass4s/docs/localstack","docId":"localstack"}]},"docs":{"core-concepts/Broker":{"id":"core-concepts/Broker","title":"Broker","description":"Broker is a higher level abstraction than Consumer and Sender, it resides in \\"com.ocadotechnology\\" %% \\"pass4s-high\\" % \\"v0.4.7\\" module.","sidebar":"sidebar"},"core-concepts/Consumer":{"id":"core-concepts/Consumer","title":"Consumer","description":"Consumer is an abstraction for continuous process of executing logic upon receiving a message.","sidebar":"sidebar"},"core-concepts/Sender":{"id":"core-concepts/Sender","title":"Sender","description":"Sender is a basic abstraction over the possibility to send single message. Its simplified definition looks like this:","sidebar":"sidebar"},"getting-started":{"id":"getting-started","title":"Getting started","description":"Pass4s documentation page","sidebar":"sidebar"},"localstack":{"id":"localstack","title":"Localstack","description":"Local SNS/SQS development with Localstack","sidebar":"sidebar"},"migration-guide":{"id":"migration-guide","title":"Migration guide","description":"How to upgrade","sidebar":"sidebar"},"modules/json":{"id":"modules/json","title":"JSON","description":"JSON message serialization with Circe","sidebar":"sidebar"},"modules/message-processor":{"id":"modules/message-processor","title":"Message processor","description":"Message processor","sidebar":"sidebar"},"modules/s3proxy":{"id":"modules/s3proxy","title":"S3 Proxy","description":"Using S3 proxy for large messages","sidebar":"sidebar"},"modules/xml":{"id":"modules/xml","title":"XML","description":"XML message serialization with Phobos","sidebar":"sidebar"}}}')}}]); \ No newline at end of file +"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[53],{1109:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"sidebar":[{"type":"link","label":"Getting started","href":"/pass4s/docs/getting-started","docId":"getting-started"},{"type":"category","label":"Core concepts","collapsible":true,"collapsed":false,"items":[{"type":"link","label":"Sender","href":"/pass4s/docs/core-concepts/Sender","docId":"core-concepts/Sender"},{"type":"link","label":"Consumer","href":"/pass4s/docs/core-concepts/Consumer","docId":"core-concepts/Consumer"},{"type":"link","label":"Broker","href":"/pass4s/docs/core-concepts/Broker","docId":"core-concepts/Broker"}]},{"type":"category","label":"Modules","collapsible":true,"collapsed":false,"items":[{"type":"link","label":"Message processor","href":"/pass4s/docs/modules/message-processor","docId":"modules/message-processor"},{"type":"link","label":"S3 Proxy","href":"/pass4s/docs/modules/s3proxy","docId":"modules/s3proxy"},{"type":"link","label":"JSON","href":"/pass4s/docs/modules/json","docId":"modules/json"},{"type":"link","label":"XML","href":"/pass4s/docs/modules/xml","docId":"modules/xml"}]},{"type":"link","label":"Migration guide","href":"/pass4s/docs/migration-guide","docId":"migration-guide"},{"type":"link","label":"Localstack","href":"/pass4s/docs/localstack","docId":"localstack"}]},"docs":{"core-concepts/Broker":{"id":"core-concepts/Broker","title":"Broker","description":"Broker is a higher level abstraction than Consumer and Sender, it resides in \\"com.ocadotechnology\\" %% \\"pass4s-high\\" % \\"0.4.8\\" module.","sidebar":"sidebar"},"core-concepts/Consumer":{"id":"core-concepts/Consumer","title":"Consumer","description":"Consumer is an abstraction for continuous process of executing logic upon receiving a message.","sidebar":"sidebar"},"core-concepts/Sender":{"id":"core-concepts/Sender","title":"Sender","description":"Sender is a basic abstraction over the possibility to send single message. Its simplified definition looks like this:","sidebar":"sidebar"},"getting-started":{"id":"getting-started","title":"Getting started","description":"Pass4s documentation page","sidebar":"sidebar"},"localstack":{"id":"localstack","title":"Localstack","description":"Local SNS/SQS development with Localstack","sidebar":"sidebar"},"migration-guide":{"id":"migration-guide","title":"Migration guide","description":"How to upgrade","sidebar":"sidebar"},"modules/json":{"id":"modules/json","title":"JSON","description":"JSON message serialization with Circe","sidebar":"sidebar"},"modules/message-processor":{"id":"modules/message-processor","title":"Message processor","description":"Message processor","sidebar":"sidebar"},"modules/s3proxy":{"id":"modules/s3proxy","title":"S3 Proxy","description":"Using S3 proxy for large messages","sidebar":"sidebar"},"modules/xml":{"id":"modules/xml","title":"XML","description":"XML message serialization with Phobos","sidebar":"sidebar"}}}')}}]); \ No newline at end of file diff --git a/assets/js/c3f819a8.f711ebd0.js b/assets/js/c3f819a8.e1eeb5b2.js similarity index 75% rename from assets/js/c3f819a8.f711ebd0.js rename to assets/js/c3f819a8.e1eeb5b2.js index 1c2a6b55..10b0d88e 100644 --- a/assets/js/c3f819a8.f711ebd0.js +++ b/assets/js/c3f819a8.e1eeb5b2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[852],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return r?n.createElement(f,a(a({ref:t},p),{},{components:r})):n.createElement(f,a({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[d]="string"==typeof e?e:o,a[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var n=r(7462),o=(r(7294),r(3905));const s={sidebar_position:3,description:"JSON message serialization with Circe"},a="JSON",i={unversionedId:"modules/json",id:"modules/json",title:"JSON",description:"JSON message serialization with Circe",source:"@site/../mdoc/target/mdoc/modules/json.md",sourceDirName:"modules",slug:"/modules/json",permalink:"/pass4s/docs/modules/json",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/modules/json.md",tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"JSON message serialization with Circe"},sidebar:"sidebar",previous:{title:"S3 Proxy",permalink:"/pass4s/docs/modules/s3proxy"},next:{title:"XML",permalink:"/pass4s/docs/modules/xml"}},c={},l=[],p={toc:l},d="wrapper";function u(e){let{components:t,...r}=e;return(0,o.kt)(d,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"json"},"JSON"),(0,o.kt)("p",null,"In it's core form, both the ",(0,o.kt)("inlineCode",{parentName:"p"},"Consumer")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Producer")," work with plain text messages. This is usually not the case for real life applications. "),(0,o.kt)("p",null,"This section explains how to work with messages represented in JSON. Pass4s comes with the ",(0,o.kt)("a",{parentName:"p",href:"https://circe.github.io/circe/"},"Circe")," support for JSON message transformation."),(0,o.kt)("p",null,"To use the module make sure to add following import to your ",(0,o.kt)("inlineCode",{parentName:"p"},"build.sbt")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// circe JSON senders/consumers\n"com.ocadotechnology" %% "pass4s-circe" % "v0.4.7"\n')),(0,o.kt)("p",null,"With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},"import com.ocadotechnology.pass4s.circe.syntax._\n")),(0,o.kt)("p",null,"The syntax allows you to use ",(0,o.kt)("inlineCode",{parentName:"p"},".asJsonSender[T]")," on the senders and ",(0,o.kt)("inlineCode",{parentName:"p"},".asJsonConsumer[T]")," on consumers. Please note that for this to work, you need to provide ",(0,o.kt)("inlineCode",{parentName:"p"},"io.circe.Encoder[T]")," in case of ",(0,o.kt)("inlineCode",{parentName:"p"},"Sender")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"io.circe.Decoder[T]")," for ",(0,o.kt)("inlineCode",{parentName:"p"},"Consumer"),". Please refer to this section ",(0,o.kt)("a",{parentName:"p",href:"https://circe.github.io/circe/codec.html"},"https://circe.github.io/circe/codec.html")," in Circe documentation for more detailed info on how encoders and decoders work."),(0,o.kt)("p",null,"When applying the syntax to consumer, consider using ",(0,o.kt)("a",{parentName:"p",href:"message-processor"},"MessageProcessor"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkpass4s=self.webpackChunkpass4s||[]).push([[852],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return r?n.createElement(f,a(a({ref:t},p),{},{components:r})):n.createElement(f,a({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[d]="string"==typeof e?e:o,a[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var n=r(7462),o=(r(7294),r(3905));const s={sidebar_position:3,description:"JSON message serialization with Circe"},a="JSON",i={unversionedId:"modules/json",id:"modules/json",title:"JSON",description:"JSON message serialization with Circe",source:"@site/../mdoc/target/mdoc/modules/json.md",sourceDirName:"modules",slug:"/modules/json",permalink:"/pass4s/docs/modules/json",draft:!1,editUrl:"https://github.com/ocadotechnology/pass4s/edit/main/docs/modules/json.md",tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"JSON message serialization with Circe"},sidebar:"sidebar",previous:{title:"S3 Proxy",permalink:"/pass4s/docs/modules/s3proxy"},next:{title:"XML",permalink:"/pass4s/docs/modules/xml"}},c={},l=[],p={toc:l},d="wrapper";function u(e){let{components:t,...r}=e;return(0,o.kt)(d,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"json"},"JSON"),(0,o.kt)("p",null,"In it's core form, both the ",(0,o.kt)("inlineCode",{parentName:"p"},"Consumer")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Producer")," work with plain text messages. This is usually not the case for real life applications. "),(0,o.kt)("p",null,"This section explains how to work with messages represented in JSON. Pass4s comes with the ",(0,o.kt)("a",{parentName:"p",href:"https://circe.github.io/circe/"},"Circe")," support for JSON message transformation."),(0,o.kt)("p",null,"To use the module make sure to add following import to your ",(0,o.kt)("inlineCode",{parentName:"p"},"build.sbt")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},'// circe JSON senders/consumers\n"com.ocadotechnology" %% "pass4s-circe" % "0.4.8"\n')),(0,o.kt)("p",null,"With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-scala"},"import com.ocadotechnology.pass4s.circe.syntax._\n")),(0,o.kt)("p",null,"The syntax allows you to use ",(0,o.kt)("inlineCode",{parentName:"p"},".asJsonSender[T]")," on the senders and ",(0,o.kt)("inlineCode",{parentName:"p"},".asJsonConsumer[T]")," on consumers. Please note that for this to work, you need to provide ",(0,o.kt)("inlineCode",{parentName:"p"},"io.circe.Encoder[T]")," in case of ",(0,o.kt)("inlineCode",{parentName:"p"},"Sender")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"io.circe.Decoder[T]")," for ",(0,o.kt)("inlineCode",{parentName:"p"},"Consumer"),". Please refer to this section ",(0,o.kt)("a",{parentName:"p",href:"https://circe.github.io/circe/codec.html"},"https://circe.github.io/circe/codec.html")," in Circe documentation for more detailed info on how encoders and decoders work."),(0,o.kt)("p",null,"When applying the syntax to consumer, consider using ",(0,o.kt)("a",{parentName:"p",href:"message-processor"},"MessageProcessor"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.30567f55.js b/assets/js/runtime~main.30567f55.js new file mode 100644 index 00000000..25484f4b --- /dev/null +++ b/assets/js/runtime~main.30567f55.js @@ -0,0 +1 @@ +(()=>{"use strict";var e,t,r,a,o,n={},f={};function i(e){var t=f[e];if(void 0!==t)return t.exports;var r=f[e]={exports:{}};return n[e].call(r.exports,r,r.exports,i),r.exports}i.m=n,e=[],i.O=(t,r,a,o)=>{if(!r){var n=1/0;for(s=0;s=o)&&Object.keys(i.O).every((e=>i.O[e](r[c])))?r.splice(c--,1):(f=!1,o0&&e[s-1][2]>o;s--)e[s]=e[s-1];e[s]=[r,a,o]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,a){if(1&a&&(e=this(e)),8&a)return e;if("object"==typeof e&&e){if(4&a&&e.__esModule)return e;if(16&a&&"function"==typeof e.then)return e}var o=Object.create(null);i.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var f=2&a&&e;"object"==typeof f&&!~t.indexOf(f);f=r(f))Object.getOwnPropertyNames(f).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,i.d(o,n),o},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>"assets/js/"+({53:"935f2afb",74:"10b69c63",155:"1eb5bd94",195:"c4f5d8e4",300:"51545c38",391:"19bf2b45",504:"fe4863e2",514:"1be78505",586:"3109491d",589:"3169204a",607:"a9497a52",723:"aedc008b",779:"c3a2bac9",852:"c3f819a8",918:"17896441",922:"48ee0d35"}[e]||e)+"."+{53:"d85e2672",74:"48a11d2d",155:"0ba63b47",195:"d323dcd6",300:"cf0c10ad",391:"f3e57872",504:"c4d2d8f5",514:"b89ba4a4",586:"38eeb299",589:"76843d67",607:"3e04c0d6",723:"2f9a2bde",779:"b2fea44b",852:"e1eeb5b2",918:"cf79d53f",922:"5cfedb60",972:"40c5be87"}[e]+".js",i.miniCssF=e=>{},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a={},o="pass4s:",i.l=(e,t,r,n)=>{if(a[e])a[e].push(t);else{var f,c;if(void 0!==r)for(var d=document.getElementsByTagName("script"),s=0;s{f.onerror=f.onload=null,clearTimeout(b);var o=a[e];if(delete a[e],f.parentNode&&f.parentNode.removeChild(f),o&&o.forEach((e=>e(r))),t)return t(r)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:f}),12e4);f.onerror=l.bind(null,f.onerror),f.onload=l.bind(null,f.onload),c&&document.head.appendChild(f)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.p="/pass4s/",i.gca=function(e){return e={17896441:"918","935f2afb":"53","10b69c63":"74","1eb5bd94":"155",c4f5d8e4:"195","51545c38":"300","19bf2b45":"391",fe4863e2:"504","1be78505":"514","3109491d":"586","3169204a":"589",a9497a52:"607",aedc008b:"723",c3a2bac9:"779",c3f819a8:"852","48ee0d35":"922"}[e]||e,i.p+i.u(e)},(()=>{var e={303:0,532:0};i.f.j=(t,r)=>{var a=i.o(e,t)?e[t]:void 0;if(0!==a)if(a)r.push(a[2]);else if(/^(303|532)$/.test(t))e[t]=0;else{var o=new Promise(((r,o)=>a=e[t]=[r,o]));r.push(a[2]=o);var n=i.p+i.u(t),f=new Error;i.l(n,(r=>{if(i.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var o=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;f.message="Loading chunk "+t+" failed.\n("+o+": "+n+")",f.name="ChunkLoadError",f.type=o,f.request=n,a[1](f)}}),"chunk-"+t,t)}},i.O.j=t=>0===e[t];var t=(t,r)=>{var a,o,n=r[0],f=r[1],c=r[2],d=0;if(n.some((t=>0!==e[t]))){for(a in f)i.o(f,a)&&(i.m[a]=f[a]);if(c)var s=c(i)}for(t&&t(r);d{"use strict";var e,t,r,a,o,n={},c={};function f(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return n[e].call(r.exports,r,r.exports,f),r.exports}f.m=n,e=[],f.O=(t,r,a,o)=>{if(!r){var n=1/0;for(s=0;s=o)&&Object.keys(f.O).every((e=>f.O[e](r[i])))?r.splice(i--,1):(c=!1,o0&&e[s-1][2]>o;s--)e[s]=e[s-1];e[s]=[r,a,o]},f.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return f.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,f.t=function(e,a){if(1&a&&(e=this(e)),8&a)return e;if("object"==typeof e&&e){if(4&a&&e.__esModule)return e;if(16&a&&"function"==typeof e.then)return e}var o=Object.create(null);f.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var c=2&a&&e;"object"==typeof c&&!~t.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,f.d(o,n),o},f.d=(e,t)=>{for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce(((t,r)=>(f.f[r](e,t),t)),[])),f.u=e=>"assets/js/"+({53:"935f2afb",74:"10b69c63",155:"1eb5bd94",195:"c4f5d8e4",300:"51545c38",391:"19bf2b45",504:"fe4863e2",514:"1be78505",586:"3109491d",589:"3169204a",607:"a9497a52",723:"aedc008b",779:"c3a2bac9",852:"c3f819a8",918:"17896441",922:"48ee0d35"}[e]||e)+"."+{53:"0b1e4211",74:"48a11d2d",155:"a9a96c62",195:"d323dcd6",300:"cf0c10ad",391:"f3e57872",504:"c4d2d8f5",514:"b89ba4a4",586:"ffe53e7c",589:"76843d67",607:"3e04c0d6",723:"2f9a2bde",779:"b2fea44b",852:"f711ebd0",918:"cf79d53f",922:"af420f44",972:"40c5be87"}[e]+".js",f.miniCssF=e=>{},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a={},o="pass4s:",f.l=(e,t,r,n)=>{if(a[e])a[e].push(t);else{var c,i;if(void 0!==r)for(var d=document.getElementsByTagName("script"),s=0;s{c.onerror=c.onload=null,clearTimeout(b);var o=a[e];if(delete a[e],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach((e=>e(r))),t)return t(r)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=l.bind(null,c.onerror),c.onload=l.bind(null,c.onload),i&&document.head.appendChild(c)}},f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.p="/pass4s/",f.gca=function(e){return e={17896441:"918","935f2afb":"53","10b69c63":"74","1eb5bd94":"155",c4f5d8e4:"195","51545c38":"300","19bf2b45":"391",fe4863e2:"504","1be78505":"514","3109491d":"586","3169204a":"589",a9497a52:"607",aedc008b:"723",c3a2bac9:"779",c3f819a8:"852","48ee0d35":"922"}[e]||e,f.p+f.u(e)},(()=>{var e={303:0,532:0};f.f.j=(t,r)=>{var a=f.o(e,t)?e[t]:void 0;if(0!==a)if(a)r.push(a[2]);else if(/^(303|532)$/.test(t))e[t]=0;else{var o=new Promise(((r,o)=>a=e[t]=[r,o]));r.push(a[2]=o);var n=f.p+f.u(t),c=new Error;f.l(n,(r=>{if(f.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var o=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+o+": "+n+")",c.name="ChunkLoadError",c.type=o,c.request=n,a[1](c)}}),"chunk-"+t,t)}},f.O.j=t=>0===e[t];var t=(t,r)=>{var a,o,n=r[0],c=r[1],i=r[2],d=0;if(n.some((t=>0!==e[t]))){for(a in c)f.o(c,a)&&(f.m[a]=c[a]);if(i)var s=i(f)}for(t&&t(r);d -Broker | Pass4s - +Broker | Pass4s +
-

Broker

Broker is a higher level abstraction than Consumer and Sender, it resides in "com.ocadotechnology" %% "pass4s-high" % "v0.4.7" module.

It aims to:

  • Provide an easy way to build sender and consumer out of a connector
  • Allow the user to route the requests - select the right sender/consumer logic based on the source of the message
trait Broker[F[_], +P] {
def consumer[R >: P](source: Source[R]): Consumer[F, Payload]

def sender[R >: P]: Sender[F, Message[R]]
}

object Broker {
def fromConnector[F[_]: Async, P](connector: Connector[F, P]): Broker[F, P]
def routed[F[_], P](chooseBroker: End[P] => Broker[F, P]): Broker[F, P]
}

Sample broker initialization might look like this:

val brokerResource = Akka
.system[IO]
.flatMap { implicit sys =>
implicit val connectorLogger: Logger[IO] = Slf4jLogger.getLoggerFromClass[IO](classOf[Connector[IO, Jms]])

JmsConnector
.singleBroker[IO](
"admin",
"admin",
"failover:(tcp://localhost:61616)"
)
.map(_.logged)
}
.map(Broker.fromConnector[IO, Jms])

Plese see the DemoMain.scala for full usage example.

- +

Broker

Broker is a higher level abstraction than Consumer and Sender, it resides in "com.ocadotechnology" %% "pass4s-high" % "0.4.8" module.

It aims to:

  • Provide an easy way to build sender and consumer out of a connector
  • Allow the user to route the requests - select the right sender/consumer logic based on the source of the message
trait Broker[F[_], +P] {
def consumer[R >: P](source: Source[R]): Consumer[F, Payload]

def sender[R >: P]: Sender[F, Message[R]]
}

object Broker {
def fromConnector[F[_]: Async, P](connector: Connector[F, P]): Broker[F, P]
def routed[F[_], P](chooseBroker: End[P] => Broker[F, P]): Broker[F, P]
}

Sample broker initialization might look like this:

val brokerResource = Akka
.system[IO]
.flatMap { implicit sys =>
implicit val connectorLogger: Logger[IO] = Slf4jLogger.getLoggerFromClass[IO](classOf[Connector[IO, Jms]])

JmsConnector
.singleBroker[IO](
"admin",
"admin",
"failover:(tcp://localhost:61616)"
)
.map(_.logged)
}
.map(Broker.fromConnector[IO, Jms])

Plese see the DemoMain.scala for full usage example.

+ \ No newline at end of file diff --git a/docs/core-concepts/Consumer/index.html b/docs/core-concepts/Consumer/index.html index cb7827d5..9759ad53 100644 --- a/docs/core-concepts/Consumer/index.html +++ b/docs/core-concepts/Consumer/index.html @@ -5,13 +5,13 @@ Consumer | Pass4s - +

Consumer

Consumer is an abstraction for continuous process of executing logic upon receiving a message.

It's defined as a function in following shape: (A => F[Unit]) => F[Unit]. This means a function that:

  • takes an argument of type A => F[Unit] - think of it as the processing logic type
  • returns F[Unit] means that consuming itself is only a side effect and yields no real value
trait Consumer[F[_], +A] extends ((A => F[Unit]) => F[Unit]) with Serializable { self =>
/** Starts the consumer, passing every message through the processing function `f`. Think of it like of an `evalMap` on [[Stream]] or
* `use` on [[cats.effect.Resource]].
*/
def consume(f: A => F[Unit]): F[Unit]

/** Starts the consumer, but allows the processing function `f` to be in a different effect than that of the consumer's. A `commit`
* function also needs to be passed - it will be used after every message.
*/
def consumeCommit[T[_]](commit: T[Unit] => F[Unit])(f: A => T[Unit]): F[Unit] = self.consume(f andThen commit)
}

To start a consumer, you need a function that will handle messages of type A and return effects in F[_]. As you can see in the example above, the consumer can also be transactional, meaning it can perform an action in one effect and then translate the result to the other. It's especially useful when you want to perform database operations in ConnectionIO[_] while your application effect is IO[_].

The end user usually doesn't instantiate the Consumer directly. Instead they would usually get one from Broker or MessageProcessor.

This abstraction comes with a lot of useful manipulators as well as Semigroup, Monoid, Functor and Monad instances. Please refer to Consumer.scala sources and the scaladocs.

Basic usage

Here's a simple consumer implementation configured to use with our localstack setup. If you want to run it locally, simply save the file somewhere and run it using scala-cli using scala-cli run filename.scala

//> using scala "2.13"
//> using lib "com.ocadotechnology::pass4s-kernel:0.3.1"
//> using lib "com.ocadotechnology::pass4s-core:0.3.1"
//> using lib "com.ocadotechnology::pass4s-high:0.3.1"
//> using lib "com.ocadotechnology::pass4s-connector-sqs:0.3.1"
//> using lib "org.typelevel::log4cats-noop:2.5.0"

import cats.effect.ExitCode
import cats.effect.IO
import cats.effect.IOApp
import cats.implicits._
import com.ocadotechnology.pass4s.connectors.sqs.SqsConnector
import com.ocadotechnology.pass4s.connectors.sqs.SqsEndpoint
import com.ocadotechnology.pass4s.connectors.sqs.SqsSource
import com.ocadotechnology.pass4s.connectors.sqs.SqsUrl
import com.ocadotechnology.pass4s.core.Source
import com.ocadotechnology.pass4s.high.Broker
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.noop.NoOpLogger
import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider
import software.amazon.awssdk.regions.Region

import java.net.URI

object BaseConsumer extends IOApp {

override def run(args: List[String]): IO[ExitCode] = {
implicit val ioLogger: Logger[IO] = NoOpLogger[IO]

// Initialize credentials
val awsCredentials = AwsBasicCredentials.create("test", "AWSSECRET")
val localstackURI = new URI("http://localhost:4566")
val sqsSource = SqsEndpoint(SqsUrl("http://localhost:4566/000000000000/local_queue"))

val credentialsProvider = StaticCredentialsProvider.create(awsCredentials)
// Create connector resource using provided credentials
val sqsConnector =
SqsConnector.usingLocalAwsWithDefaultAttributesProvider[IO](localstackURI, Region.EU_WEST_2, credentialsProvider)

sqsConnector.use { connector => // obtain the connector resource
val broker = Broker.fromConnector(connector) // create broker from connector

IO.println(s"Processor listening for messages on $sqsSource") *>
broker
.consumer(sqsSource) // obtain the consumer for certain SQS source
.consume(message => IO.println(s"Received message: $message")) // bind consumer logic
.background // run in background
.void
.use(_ => IO.never)
}
}
}

This is a rather raw way of using consumer, you might want to use MessageProcessor for more elasticity and enriched syntax.

- + \ No newline at end of file diff --git a/docs/core-concepts/Sender/index.html b/docs/core-concepts/Sender/index.html index 6e87f9c4..0ab560b8 100644 --- a/docs/core-concepts/Sender/index.html +++ b/docs/core-concepts/Sender/index.html @@ -5,13 +5,13 @@ Sender | Pass4s - +

Sender

Sender is a basic abstraction over the possibility to send single message. Its simplified definition looks like this:

trait Sender[F[_], -A] extends (A => F[Unit]) with Serializable {

/** Sends a single message.
*/
def sendOne(msg: A): F[Unit]

/** Alias for [[sendOne]]. Thanks to this, you can pass a Sender where a function type is expected.
*/
def apply(msg: A): F[Unit] = sendOne(msg)

}

As you can see Sender is basically a type of function of A => F[Unit] shape. It comes with many combinators for mapping, filtering and combining Senders, as well as Functor and Monoid instances.

Please refer to Sender.scala sources and the scaladocs.

The typical way of obtaining a Sender instance is by instantiating the Broker first.

Basic example

Here's a simple sender implementation configured to use with our localstack setup. If you want to run it locally, simply save the file somewhere and run it using scala-cli using scala-cli run filename.scala

//> using scala "2.13"
//> using lib "com.ocadotechnology::pass4s-kernel:0.3.1"
//> using lib "com.ocadotechnology::pass4s-core:0.3.1"
//> using lib "com.ocadotechnology::pass4s-high:0.3.1"
//> using lib "com.ocadotechnology::pass4s-connector-sns:0.3.1"
//> using lib "org.typelevel::log4cats-noop:2.5.0"

import cats.effect.ExitCode
import cats.effect.IO
import cats.effect.IOApp
import cats.implicits._
import com.ocadotechnology.pass4s.connectors.sns.SnsArn
import com.ocadotechnology.pass4s.connectors.sns.SnsConnector
import com.ocadotechnology.pass4s.connectors.sns.SnsDestination
import com.ocadotechnology.pass4s.core.Message
import com.ocadotechnology.pass4s.core.Source
import com.ocadotechnology.pass4s.high.Broker
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.LoggerFactory
import org.typelevel.log4cats.noop.NoOpLogger
import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider
import software.amazon.awssdk.regions.Region

import java.net.URI

object Producer extends IOApp {

override def run(args: List[String]): IO[ExitCode] = {
implicit val ioLogger: Logger[IO] = NoOpLogger[IO]

// Initialize credentials
val awsCredentials = AwsBasicCredentials.create("test", "AWSSECRET");
val snsDestination = SnsDestination(SnsArn("arn:aws:sns:eu-west-2:000000000000:local_sns"))
val localstackURI = new URI("http://localhost:4566")

val credentialsProvider = StaticCredentialsProvider.create(awsCredentials)

// Create connector resource using provided credentials
val snsConnector =
SnsConnector.usingLocalAwsWithDefaultAttributesProvider[IO](localstackURI, Region.EU_WEST_2, credentialsProvider)

snsConnector.use { connector => // obtain the connector resource
val broker = Broker.fromConnector(connector)

val message = Message(Message.Payload("hello world!", Map()), snsDestination)

IO.println(s"Sending message $message to $snsDestination") *>
broker.sender.sendOne(message) *> // use the sender to send one message
IO.println("Sent, exiting!").as(ExitCode.Success)
}
}
}
- + \ No newline at end of file diff --git a/docs/getting-started/index.html b/docs/getting-started/index.html index 01fb3c35..9f7af25c 100644 --- a/docs/getting-started/index.html +++ b/docs/getting-started/index.html @@ -5,13 +5,13 @@ Getting started | Pass4s - +
-

Getting started

About

Pass4s is a Scala library providing an abstract layer for app messaging. It provides implementations for platforms like AWS SQS/SNS and ActiveMQ.

Basis installation

The library is divided into multiple modules. If you're only interested in the basic abstractions, add following to your build.sbt file:

// Algebraic abstractions (Sender/Consumer)
"com.ocadotechnology" %% "pass4s-kernel" % "v0.4.7"

// Message, Destination, CommittableMessage, Connector
"com.ocadotechnology" %% "pass4s-core" % "v0.4.7"

// Broker
"com.ocadotechnology" %% "pass4s-high" % "v0.4.7"

Modules

Connectors

ActiveMq

// ActiveMQ connector - based on Akka Alpakka
"com.ocadotechnology" %% "pass4s-connector-activemq" % "v0.4.7"
// ActiveMQ pekko connector - based on Pekko Connectors
"com.ocadotechnology" %% "pass4s-connector-pekko-activemq" % "v0.4.7"

⚠️ Warning Pekko connector is an experimental addition at the moment, as it is based on nightly build

SNS/SQS

// SNS connector
"com.ocadotechnology" %% "pass4s-connector-sns" % "v0.4.7"
// SQS connector
"com.ocadotechnology" %% "pass4s-connector-sqs" % "v0.4.7"

Kinesis

// Kinesis connector
"com.ocadotechnology" %% "pass4s-connector-kinesis" % "v0.4.7"

Useful utils

Extras - provides MessageProcessor for convenient way of building rich message consumers and an easy way to bind them to processor logic.

// high-level MessageProcessor
"com.ocadotechnology" %% "pass4s-extra" % "v0.4.7"

S3proxy - seamless support for proxying large messages through s3. Useful for sorting the large messages on sns kind of problems.

// s3proxy
"com.ocadotechnology" %% "pass4s-s3proxy" % "v0.4.7"

Circe - JSON serialization/parsing support

// circe JSON senders/consumers
"com.ocadotechnology" %% "pass4s-circe" % "v0.4.7"

Phobos - XML serialization/parsing support

// phobos XML senders/consumers
"com.ocadotechnology" %% "pass4s-phobos" % "v0.4.7"

Logging middleware that uses log4cats

// logging middleware
"com.ocadotechnology" %% "pass4s-logging" % "v0.4.7"
- +

Getting started

About

Pass4s is a Scala library providing an abstract layer for app messaging. It provides implementations for platforms like AWS SQS/SNS and ActiveMQ.

Basis installation

The library is divided into multiple modules. If you're only interested in the basic abstractions, add following to your build.sbt file:

// Algebraic abstractions (Sender/Consumer)
"com.ocadotechnology" %% "pass4s-kernel" % "0.4.8"

// Message, Destination, CommittableMessage, Connector
"com.ocadotechnology" %% "pass4s-core" % "0.4.8"

// Broker
"com.ocadotechnology" %% "pass4s-high" % "0.4.8"

Modules

Connectors

ActiveMq

// ActiveMQ connector - based on Akka Alpakka
"com.ocadotechnology" %% "pass4s-connector-activemq" % "0.4.8"
// ActiveMQ pekko connector - based on Pekko Connectors
"com.ocadotechnology" %% "pass4s-connector-pekko-activemq" % "0.4.8"

⚠️ Warning Pekko connector is an experimental addition at the moment, as it is based on nightly build

SNS/SQS

// SNS connector
"com.ocadotechnology" %% "pass4s-connector-sns" % "0.4.8"
// SQS connector
"com.ocadotechnology" %% "pass4s-connector-sqs" % "0.4.8"

Kinesis

// Kinesis connector
"com.ocadotechnology" %% "pass4s-connector-kinesis" % "0.4.8"

Useful utils

Extras - provides MessageProcessor for convenient way of building rich message consumers and an easy way to bind them to processor logic.

// high-level MessageProcessor
"com.ocadotechnology" %% "pass4s-extra" % "0.4.8"

S3proxy - seamless support for proxying large messages through s3. Useful for sorting the large messages on sns kind of problems.

// s3proxy
"com.ocadotechnology" %% "pass4s-s3proxy" % "0.4.8"

Circe - JSON serialization/parsing support

// circe JSON senders/consumers
"com.ocadotechnology" %% "pass4s-circe" % "0.4.8"

Phobos - XML serialization/parsing support

// phobos XML senders/consumers
"com.ocadotechnology" %% "pass4s-phobos" % "0.4.8"

Logging middleware that uses log4cats

// logging middleware
"com.ocadotechnology" %% "pass4s-logging" % "0.4.8"
+ \ No newline at end of file diff --git a/docs/localstack/index.html b/docs/localstack/index.html index b384f14a..4942c6ba 100644 --- a/docs/localstack/index.html +++ b/docs/localstack/index.html @@ -5,13 +5,13 @@ Localstack | Pass4s - +

Localstack

If you want to use pass4s for SNS/SQS messaging, your usual first step is to set up local development environment. Localstack is a toolkit provided by Amazon to replicate AWS locally. This section provides ready-to-use localstack setup using docker-compose.

Docker compose setup

To launch localstack simply copy the snippet below and save it locally as docker-compose.yml. Once that's done, open terminal, navigate to the place where you saved the file and run docker-compose up. Your setup is ready to go.

version: "3.8"

services:
localstack:
container_name: localstack_main
image: localstack/localstack
hostname: localhost.localstack.cloud
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
- DOCKER_HOST=unix:///var/run/docker.sock
- SERVICES=sqs,sns
- EAGER_SERVICE_LOADING=1
- SKIP_SSL_CERT_DOWNLOAD=1
- HOSTNAME_EXTERNAL=localhost.localstack.cloud
volumes:
- "/tmp/localstack:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"

setup-resources:
image: localstack/localstack
environment:
- AWS_ACCESS_KEY_ID=test
- AWS_SECRET_ACCESS_KEY=AWSSECRET
- AWS_DEFAULT_REGION=eu-west-2
entrypoint: /bin/sh -c
command: >
"
sleep 15
alias aws='aws --endpoint-url http://localstack:4566'
# Executing SNS
aws sns create-topic --name local_sns
# Executing SQS
aws sqs create-queue --queue-name local_queue
# Subscribing to SNS to SQS
aws sns subscribe --attributes 'RawMessageDelivery=true' --topic-arn arn:aws:sns:eu-west-2:000000000000:local_sns --protocol sqs --notification-endpoint arn:aws:sqs:eu-west-2:000000000000:local_queue
aws sqs get-queue-url --queue-name local_queue
# Create na S3 bucket for large messages
aws s3 mb s3://large-messages
"
depends_on:
- localstack

Resources

This setup comes with batteries included, meaning it not only does set up the service, but also some basic resources for you to play with. The provided resources are:

  • Topic local_sns to write your messages onto
  • Queue local_queue to read messages from
  • Subscription between the two, making the messages from local_sns to be pushed to local_queue
  • Bucket large-messages in case you want to use s3 proxy

Please notice how for queue creation we use --attributes 'RawMessageDelivery=true'. This is done intentionally, make sure to use this attribute with your production setup to avoid communication issues. We add this because we don't want AWS to try interpreting our JSON message contents. To find out more check out https://docs.aws.amazon.com/sns/latest/dg/sns-large-payload-raw-message-delivery.html

- + \ No newline at end of file diff --git a/docs/migration-guide/index.html b/docs/migration-guide/index.html index 4388446e..719d77b7 100644 --- a/docs/migration-guide/index.html +++ b/docs/migration-guide/index.html @@ -5,7 +5,7 @@ Migration guide | Pass4s - + @@ -18,7 +18,7 @@ The new producer will send the message in the correct format.
  • If you are having scenario where an application is both consumer and producer, then for consuming follow point 1 and for producing use firstly usingS3ProxyLegacyEncoding and then in the next release migrate to usingS3ProxyForBigPayload
  • - + \ No newline at end of file diff --git a/docs/modules/json/index.html b/docs/modules/json/index.html index 16d0b90f..b65c525e 100644 --- a/docs/modules/json/index.html +++ b/docs/modules/json/index.html @@ -5,13 +5,13 @@ JSON | Pass4s - +
    -

    JSON

    In it's core form, both the Consumer and Producer work with plain text messages. This is usually not the case for real life applications.

    This section explains how to work with messages represented in JSON. Pass4s comes with the Circe support for JSON message transformation.

    To use the module make sure to add following import to your build.sbt

    // circe JSON senders/consumers
    "com.ocadotechnology" %% "pass4s-circe" % "v0.4.7"

    With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:

    import com.ocadotechnology.pass4s.circe.syntax._

    The syntax allows you to use .asJsonSender[T] on the senders and .asJsonConsumer[T] on consumers. Please note that for this to work, you need to provide io.circe.Encoder[T] in case of Sender and io.circe.Decoder[T] for Consumer. Please refer to this section https://circe.github.io/circe/codec.html in Circe documentation for more detailed info on how encoders and decoders work.

    When applying the syntax to consumer, consider using MessageProcessor.

    - +

    JSON

    In it's core form, both the Consumer and Producer work with plain text messages. This is usually not the case for real life applications.

    This section explains how to work with messages represented in JSON. Pass4s comes with the Circe support for JSON message transformation.

    To use the module make sure to add following import to your build.sbt

    // circe JSON senders/consumers
    "com.ocadotechnology" %% "pass4s-circe" % "0.4.8"

    With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:

    import com.ocadotechnology.pass4s.circe.syntax._

    The syntax allows you to use .asJsonSender[T] on the senders and .asJsonConsumer[T] on consumers. Please note that for this to work, you need to provide io.circe.Encoder[T] in case of Sender and io.circe.Decoder[T] for Consumer. Please refer to this section https://circe.github.io/circe/codec.html in Circe documentation for more detailed info on how encoders and decoders work.

    When applying the syntax to consumer, consider using MessageProcessor.

    + \ No newline at end of file diff --git a/docs/modules/message-processor/index.html b/docs/modules/message-processor/index.html index b57a13c8..a4db4144 100644 --- a/docs/modules/message-processor/index.html +++ b/docs/modules/message-processor/index.html @@ -5,13 +5,13 @@ Message processor | Pass4s - +

    Message processor

    Message processor provides a convenient way for building rich consumer, binding it to broker and attaching message handling logic.

    The usual flow of building processor starts with initialization

    val processor = MessageProcessor.init[IO]

    Where the IO can be replaced with the effect of your preference. Once initialized, you can enrich the underlying consumer by subsequent enrich calls.

    val richProcessor = 
    processor
    .enrich(_.logged)
    .enrich(_.usingS3Proxy(consumerConfig))
    .enrich(_.asJsonConsumer[String])

    Then depending on your logic you can go either with transact if you use different effect or effectful if you want to stick to IO in our example. After that you bind the broker and provide the message handling logic. Keep in mind that you can reuse once prepared processor like in the example below.

    val processor = 
    MessageProcessor
    .init[IO]
    .enrich(_.logged)
    .enrich(_.asJsonConsumer[String])
    .transacted(runEffect)
    .bindBroker(broker)

    processor.handle(Destinations.destinationA)(MyProcessor.instanceA[AppEffect])
    processor.handle(Destinations.destinationB)(MyProcessor.instanceB[AppEffect])
    - + \ No newline at end of file diff --git a/docs/modules/s3proxy/index.html b/docs/modules/s3proxy/index.html index d85d5a33..180130ff 100644 --- a/docs/modules/s3proxy/index.html +++ b/docs/modules/s3proxy/index.html @@ -5,13 +5,13 @@ S3 Proxy | Pass4s - +

    S3 Proxy

    Some messaging solutions like SNS/SQS limit the size of the message you can send. S3 proxy solves this particular problem by sending the original payload to S3 bucket and exchanging the pointer to the S3 object on the messaging channel.

    The example below roughly shows how to use the S3 proxy on both consumer and sender.

    val senderConfig =
    S3ProxyConfig
    .Sender
    .withSnsDefaults(bucketName)
    // .copy(
    // minPayloadSize = Some(0) // You can use custom payload size
    // )
    val consumerConfig =
    S3ProxyConfig
    .Consumer
    .withSnsDefaults()
    .copy(
    shouldDeleteAfterProcessing = true // it doesn't by default, just in case there's more listeners
    )
    val broker = ??? // let's just assume you already instantiated broker
    val payload = Message.Payload("body", Map("foo" -> "bar"))

    val sender =
    broker
    .sender
    .usingS3Proxy(senderConfig)
    val consumer =
    broker
    .consumer(SqsEndpoint(SqsUrl(queueUrl)))
    .usingS3Proxy(consumerConfig)

    // no need to know anything about s3 when sending the actual message
    val sendMessageOnTopic = sender.sendOne(Message(payload, SnsDestination(SnsArn(topicArn))).widen)

    Please note that for this to work you need to have an existing s3 bucket, pass4s doesn't create any AWS resources on it's own. If you are using the provided localstack setup you can use the s3://large-messages bucket as a playground.

    For more detailed examples on s3 proxy, you might want to check out the following article https://blog.michalp.net/posts/scala/pass4s-s3-proxy/

    - + \ No newline at end of file diff --git a/docs/modules/xml/index.html b/docs/modules/xml/index.html index 42a494dc..a93715c9 100644 --- a/docs/modules/xml/index.html +++ b/docs/modules/xml/index.html @@ -5,13 +5,13 @@ XML | Pass4s - +
    -

    XML

    This section explains how to work with messages represented in XML. Pass4s comes with the Phobos support for XML message transformation.

    To use the module make sure to add following import to your build.sbt

    // phobos XML senders/consumers
    "com.ocadotechnology" %% "pass4s-phobos" % "v0.4.7"

    With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:

    import com.ocadotechnology.pass4s.phobos.syntax._

    The syntax allows you to use .asXmlSender[T] on the senders and .asXmlConsumer[T] on consumers. Please note that for this to work, you need to provide XmlEncoder[T] in case of Sender and XmlDecoder[T] for Consumer.

    Here's how to create most basic encoder and decoder using Phobos:

    import ru.tinkoff.phobos.decoding._
    import ru.tinkoff.phobos.encoding._
    import ru.tinkoff.phobos.syntax._
    import ru.tinkoff.phobos.derivation.semiauto._

    final case class XmlMessage(description: String, value: Long, rows: List[String])

    object XmlMessage {
    implicit val xmlEncoder: XmlEncoder[XmlMessage] = deriveXmlEncoder("xmlMessage")
    implicit val xmlDecoder: XmlDecoder[XmlMessage] = deriveXmlDecoder("xmlMessage")
    }

    Please refer to the project repository https://github.com/Tinkoff/phobos for more detailed guide on using Phobos.

    When applying the syntax to consumer, consider using MessageProcessor.

    - +

    XML

    This section explains how to work with messages represented in XML. Pass4s comes with the Phobos support for XML message transformation.

    To use the module make sure to add following import to your build.sbt

    // phobos XML senders/consumers
    "com.ocadotechnology" %% "pass4s-phobos" % "0.4.8"

    With that module added, you can now import additional syntax for consumers and producers. To enable the syntax add following import to your file:

    import com.ocadotechnology.pass4s.phobos.syntax._

    The syntax allows you to use .asXmlSender[T] on the senders and .asXmlConsumer[T] on consumers. Please note that for this to work, you need to provide XmlEncoder[T] in case of Sender and XmlDecoder[T] for Consumer.

    Here's how to create most basic encoder and decoder using Phobos:

    import ru.tinkoff.phobos.decoding._
    import ru.tinkoff.phobos.encoding._
    import ru.tinkoff.phobos.syntax._
    import ru.tinkoff.phobos.derivation.semiauto._

    final case class XmlMessage(description: String, value: Long, rows: List[String])

    object XmlMessage {
    implicit val xmlEncoder: XmlEncoder[XmlMessage] = deriveXmlEncoder("xmlMessage")
    implicit val xmlDecoder: XmlDecoder[XmlMessage] = deriveXmlDecoder("xmlMessage")
    }

    Please refer to the project repository https://github.com/Tinkoff/phobos for more detailed guide on using Phobos.

    When applying the syntax to consumer, consider using MessageProcessor.

    + \ No newline at end of file diff --git a/index.html b/index.html index f36588be..1096e37d 100644 --- a/index.html +++ b/index.html @@ -5,13 +5,13 @@ Pass4s documentation | Pass4s - +

    Pass4s

    Scala library providing an abstract layer for cross app messaging.

    Abstract

    Abstract away sender and consumer from implementation.

    Powered by Scala

    Designed with functional Scala in mind.

    Ocado Technology

    Brought to you by Ocado Technology.

    - + \ No newline at end of file