{"id":3427,"date":"2022-12-07T10:33:06","date_gmt":"2022-12-07T10:33:06","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/"},"modified":"2026-03-09T13:04:35","modified_gmt":"2026-03-09T13:04:35","slug":"laer-mer-om-ruby-on-rails-med-pub-sub","status":"publish","type":"post","link":"https:\/\/thecodest.co\/nb\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/","title":{"rendered":"L\u00e6r mer om Ruby on Rails med Pub\/Sub"},"content":{"rendered":"<p><strong><a href=\"https:\/\/thecodest.co\/nb\/case-studies\/providing-a-team-of-ruby-developers-for-a-fintech-company\/\">Ruby<\/a> p\u00e5 <a href=\"https:\/\/thecodest.co\/nb\/blog\/ways-to-increase-your-rails-performance\/\">Rails<\/a><\/strong> (Rails, <a href=\"https:\/\/thecodest.co\/nb\/blog\/hire-ror-developer\/\">RoR<\/a>) er en velkjent <a href=\"https:\/\/thecodest.co\/nb\/blog\/find-your-ideal-stack-for-web-development\/\">nett<\/a> applikasjonsrammeverk skrevet i <strong>Ruby<\/strong> programmeringsspr\u00e5k. <strong>Pub\/Sub<\/strong> er et kort navn p\u00e5 programvaredesignm\u00f8nstre som kalles <b>Publiser-abonnement<\/b>. Jeg skal forklare hvordan kommunikasjon mellom programvarekomponenter i Rails kan h\u00e5ndteres av Pub\/Sub.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hva er Pub\/sub?<\/h2>\n\n\n\n<p><strong>Pub\/sub<\/strong> er et programvaredesignm\u00f8nster som muliggj\u00f8r tjeneste-til-tjeneste-kommunikasjon. Tjeneste<br>inneb\u00e6rer en av de to rollene: utgiver (som produserer) eller mottaker (som konsumerer). Hva er<br>som skal konsumeres, bestemmes som en hendelse eller en melding eller et varsel. I<br>I denne artikkelen brukes de om hverandre for \u00e5 referere til det samme.<br>Tjenesten som produserer, vet ikke hvem som forbruker. Tjenesten som forbruker vet ikke<br>vet hvor meldingen kommer fra. De kan forbli ukjente for hverandre. Det er forskjellig fra<br>meldingsk\u00f8er, der komponenten som sender meldingen ofte kjenner destinasjonen<br>- Denne meldingsformen gj\u00f8r det mulig \u00e5 sende meldinger hvor som helst. Denne mekanismen er en sentral<br>av <strong>Pub\/sub<\/strong> og det betyr at de er frakoblet.<\/p>\n\n\n\n<p>For \u00e5 uttrykke sine felles interesser m\u00e5 de ha en felles forst\u00e5else. Derfor m\u00e5 de ha en felles forst\u00e5else,<br>Begge rollene har en implisitt mekanisme hvor produsenten av en melding og mottakeren av<br>forbruker av meldingen m\u00f8tes. Denne mekanismen kalles emne, abonnement eller topic. Den er<br>er ansvarlig for \u00e5 kategorisere meldinger til subjekter, og er i hovedsak et tilstandsl\u00f8st meldingsfilter.<br>Emner fungerer som kringkastingsstasjoner. En publisher produserer meldingen til emnet,<br>abonnenter mottar umiddelbart meldingen fra emnet. P\u00e5 grunn av den frikoblede<br>tjenester, er den mest effektive m\u00e5ten \u00e5 utveksle meldinger p\u00e5 \u00e5 h\u00e5ndtere dem asynkront.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Rails uten Pub\/Sub<\/h2>\n\n\n\n<p>Som standard er det ingen Rails-overhead for programvaredesignm\u00f8nstre for overf\u00f8ring av meldinger mellom komponenter. Utviklere bruker standard <strong>objektorientert programmering<\/strong> (<a href=\"https:\/\/thecodest.co\/nb\/dictionary\/object-oriented-programming-oop\/\">OOP<\/a>) paradigmet: sende parametere til funksjoner, be om klasser om verdier.<\/p>\n\n\n\n<p>N\u00e5r applikasjonen er ganske ukomplisert, kan det v\u00e6re nok. N\u00e5r applikasjonen vokser, for eksempel n\u00e5r noen operasjoner m\u00e5 utf\u00f8res asynkront, kan <a href=\"https:\/\/thecodest.co\/nb\/dictionary\/why-do-projects-fail\/\">prosjekt<\/a> trenger en abstraksjon som l\u00f8ser det <a href=\"https:\/\/thecodest.co\/nb\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">data<\/a> arbeidsflyt. I stedet for \u00e5 finne opp hjulet p\u00e5 nytt, kan utviklere implementere <strong>Pub\/sub<\/strong> for \u00e5 fylle denne mangelen p\u00e5 abstraksjon.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fordeler med Pub\/Sub med Rails<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Unng\u00e5 tilbakekallinger av aktive poster.<\/li>\n\n\n\n<li>Ved \u00e5 legge til asynkron parallellprosessering i et system kan ytelse, p\u00e5litelighet og <a href=\"https:\/\/thecodest.co\/nb\/blog\/difference-between-elasticity-and-scalability-in-cloud-computing\/\">skalerbarhet<\/a> er forbedret.<\/li>\n\n\n\n<li>Meldinger kan sendes asynkront til ulike deler av systemet.<\/li>\n\n\n\n<li>Gj\u00f8r det mulig \u00e5 sende meldinger asynkront til ulike deler av et system.<\/li>\n\n\n\n<li>Frikobling - \u00e5 legge til eller endre en funksjonalitet vil ikke p\u00e5virke noe fordi Pub\/Sub<br>kan du endre hvordan alt samhandler.<\/li>\n\n\n\n<li>Meldingskonsumenten trenger ikke lenger \u00e5 se etter oppdateringer eller nye<br>informasjon. Det reduserer leveringsforsinkelsen som kan v\u00e6re spesielt problematisk i systemer som<br>uten toleranse for forsinkelser.<\/li>\n\n\n\n<li>Det finnes ingen grense for hvor mange abonnenter systemet kan h\u00e5ndtere, fordi det kan endre seg,<br>oppgradere, formere seg eller forsvinne n\u00e5r som helst.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Ulemper med Pub\/Sub med Rails<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Den st\u00f8rste ulempen med Pub\/sub-systemer er at de er frikoblet fra publisher og<br>abonnent.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Rails Pub\/Sub introdusere<\/h2>\n\n\n\n<p>Eksempler p\u00e5 kildekode i Rails ble skrevet ved hjelp av biblioteket<br><a href=\"https:\/\/github.com\/stevo\/pubsub_on_rails\" rel=\"nofollow\">Pub\/Sub p\u00e5 Rails<\/a> (i Rubys nomenklatur kalles et bibliotek gem): Du finner flere detaljer i gems readme. Implementasjonen best\u00e5r av moduler:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Domene,<\/li>\n\n\n\n<li>Arrangement,<\/li>\n\n\n\n<li>Hendelsesbehandler,<\/li>\n\n\n\n<li>Utgiver av arrangementet,<\/li>\n\n\n\n<li>Abonnement.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Domene<\/h3>\n\n\n\n<p>Beskriver forretningslogikk for \u00e5 gi kontekst for Pub\/Sub og dermed gj\u00f8re den ren <a href=\"https:\/\/thecodest.co\/nb\/dictionary\/what-is-code-refactoring\/\">kode<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"> modul Notifications\n   extend PubSub::Domain\n end<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"> modul Rapporter\n   extend PubSub::Domain\n end\n\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Arrangement<\/h3>\n\n\n\n<p>Det er en klasse som beskriver hva som har skjedd. Deklarer klassenavnet s\u00e5 selvbeskrivende med det som skjedde som mulig, for eksempel: kansellert, endret, opprettet, \u00f8delagt, sendt, oppdatert. Hendelsesnavn kan se slik ut: ProfitAndLossStatementCreatedEvent, som betyr at det ble opprettet et regnskap.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"> class Reports::ProfitAndLossStatementCreatedEvent &lt; PubSub::DomainEvent\n   attributt :profit_and_loss_statement_id, Types::Strict::Integer\n end<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Utgiver av arrangementet<\/h3>\n\n\n\n<p>Klasse som kan sende ut hendelser. Eksempelet viser oppretting av en tjenesterapport. N\u00e5r rapporten er opprettet, sendes hendelsen for opprettelse av rapporten ut.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">class Reports::ProfitAndLossStatementService\n   include PubSub::Emit\n    def execute\n     emit(:rapport_overskudd_og_tap_oppstilling_opprettet, overskudd_og_tap_oppstilling_id: id) if result.ok?\n   end\n end<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Hendelsesbehandler<\/h3>\n\n\n\n<p>Denne klassen skal kj\u00f8res som svar p\u00e5 h\u00e5ndtering av en hendelse.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">modul Notifications\n class ReportsProfitAndLossStatementCreatedHandler &lt; PubSub::DomainEventHandler\n   def call\n     ReportMailer.resultat_og_tap_oppstilling(resultat_og_tap_oppstilling).deliver_now\n   end\n\n   private\n\n   def resultat_og_tapsoppstilling\n     ProfitAndLossStatement.find(event_data.profit_and_loss_statement_id)\n   end\n end\nend<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Abonnement<\/h3>\n\n\n\n<p>Hendelser er knyttet til h\u00e5ndtererne sine gjennom abonnementer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"yaml\" class=\"language-yaml\">notifications:\n rapporter__overskudd_og_underskudd_oppstilling_opprettet: async<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Eksempler p\u00e5 brukstilfeller:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\"F\u00f8lg\"-funksjonen i sosiale nettverk,<\/li>\n\n\n\n<li>Tingenes internett,<\/li>\n\n\n\n<li>Mailing,<\/li>\n\n\n\n<li>Varsling om genererte filer.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Lignende m\u00f8nstre<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><b>EventBus<\/b> - komponenter kan sende hendelser til EventBus uten \u00e5 vite hvem som vil plukke dem opp eller hvor mange respondenter som vil <a href=\"https:\/\/thecodest.co\/nb\/blog\/react-development-all-you-have-to-know\/\">reagere<\/a>,<\/li>\n\n\n\n<li><b>Observat\u00f8r<\/b> - opprettholder subjektet en liste over avhengige personer, kalt observat\u00f8rer, og varsler dem n\u00e5r tilstanden deres endres,<\/li>\n\n\n\n<li><b>Sammensl\u00e5ing<\/b> - Ved polling sp\u00f8r klientene systemet med jevne mellomrom om det finnes nye hendelser eller data.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Edelstener<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p><a href=\"https:\/\/github.com\/edisonywh\/rocketman\" rel=\"nofollow\">https:\/\/github.com\/edisonywh\/rocketman<\/a><\/p>\n<\/li>\n\n\n\n<li>\n<p><a href=\"https:\/\/github.com\/krisleech\/wisper\" rel=\"nofollow\">https:\/\/github.com\/krisleech\/wisper<\/a><\/p>\n<\/li>\n\n\n\n<li>\n<p><a href=\"https:\/\/github.com\/stevo\/pubsub_on_rails\" rel=\"nofollow\">https:\/\/github.com\/stevo\/pubsub<em>p\u00e5<\/em>skinner<\/a><\/p>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Sammendrag<\/h2>\n\n\n\n<p>Pub\/sub er ikke en vanlig tiln\u00e6rming i Ruby in Rails. Som introdusert i artikkelen, kan dette m\u00f8nsteret gi mange fordeler for prosjektet - det kan gj\u00f8re koden ren, frakoble tjenester og gj\u00f8re dem enkelt skalerbare.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/contact\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/interested_in_cooperation_.png\" alt=\"samarbeidsbanner\"\/><\/a><\/figure>","protected":false},"excerpt":{"rendered":"<p>Pub\/Sub kan gi prosjektet mange fordeler - det kan gj\u00f8re koden ren, frakoble tjenester og gj\u00f8re dem enkelt skalerbare. L\u00e6r mer om Pub\/Sub i denne artikkelen, og l\u00f8ft prosjektet ditt!<\/p>","protected":false},"author":2,"featured_media":3428,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[12],"class_list":["post-3427","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development","tag-it"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Learn More about Ruby on Rails with Pub\/Sub - The Codest<\/title>\n<meta name=\"description\" content=\"Explore the Pub\/Sub design pattern in Ruby on Rails and see how it enables event-driven communication and scalable system architecture.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/nb\/blogg\/laer-mer-om-ruby-on-rails-med-pub-sub\/\" \/>\n<meta property=\"og:locale\" content=\"nb_NO\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn More about Ruby on Rails with Pub\/Sub\" \/>\n<meta property=\"og:description\" content=\"Explore the Pub\/Sub design pattern in Ruby on Rails and see how it enables event-driven communication and scalable system architecture.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/nb\/blogg\/laer-mer-om-ruby-on-rails-med-pub-sub\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-07T10:33:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-09T13:04:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_with_pubsub.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"Learn More about Ruby on Rails with Pub\\\/Sub\",\"datePublished\":\"2022-12-07T10:33:06+00:00\",\"dateModified\":\"2026-03-09T13:04:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/\"},\"wordCount\":778,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_with_pubsub.png\",\"keywords\":[\"IT\"],\"articleSection\":[\"Software Development\"],\"inLanguage\":\"nb-NO\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/\",\"name\":\"Learn More about Ruby on Rails with Pub\\\/Sub - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_with_pubsub.png\",\"datePublished\":\"2022-12-07T10:33:06+00:00\",\"dateModified\":\"2026-03-09T13:04:35+00:00\",\"description\":\"Explore the Pub\\\/Sub design pattern in Ruby on Rails and see how it enables event-driven communication and scalable system architecture.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#breadcrumb\"},\"inLanguage\":\"nb-NO\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"nb-NO\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_with_pubsub.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_with_pubsub.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learn More about Ruby on Rails with Pub\\\/Sub\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"nb-NO\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"nb-NO\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"nb-NO\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/nb\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"L\u00e6r mer om Ruby on Rails med Pub\/Sub - The Codest","description":"Utforsk Pub\/Sub-designm\u00f8nsteret i Ruby on Rails og se hvordan det muliggj\u00f8r hendelsesstyrt kommunikasjon og skalerbar systemarkitektur.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thecodest.co\/nb\/blogg\/laer-mer-om-ruby-on-rails-med-pub-sub\/","og_locale":"nb_NO","og_type":"article","og_title":"Learn More about Ruby on Rails with Pub\/Sub","og_description":"Explore the Pub\/Sub design pattern in Ruby on Rails and see how it enables event-driven communication and scalable system architecture.","og_url":"https:\/\/thecodest.co\/nb\/blogg\/laer-mer-om-ruby-on-rails-med-pub-sub\/","og_site_name":"The Codest","article_published_time":"2022-12-07T10:33:06+00:00","article_modified_time":"2026-03-09T13:04:35+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_with_pubsub.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"Learn More about Ruby on Rails with Pub\/Sub","datePublished":"2022-12-07T10:33:06+00:00","dateModified":"2026-03-09T13:04:35+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/"},"wordCount":778,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_with_pubsub.png","keywords":["IT"],"articleSection":["Software Development"],"inLanguage":"nb-NO","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/","url":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/","name":"L\u00e6r mer om Ruby on Rails med Pub\/Sub - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_with_pubsub.png","datePublished":"2022-12-07T10:33:06+00:00","dateModified":"2026-03-09T13:04:35+00:00","description":"Utforsk Pub\/Sub-designm\u00f8nsteret i Ruby on Rails og se hvordan det muliggj\u00f8r hendelsesstyrt kommunikasjon og skalerbar systemarkitektur.","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#breadcrumb"},"inLanguage":"nb-NO","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/"]}]},{"@type":"ImageObject","inLanguage":"nb-NO","@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_with_pubsub.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_with_pubsub.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Learn More about Ruby on Rails with Pub\/Sub"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"nb-NO"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"nb-NO","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"nb-NO","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/nb\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/posts\/3427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/comments?post=3427"}],"version-history":[{"count":8,"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/posts\/3427\/revisions"}],"predecessor-version":[{"id":7913,"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/posts\/3427\/revisions\/7913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/media\/3428"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/media?parent=3427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/categories?post=3427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/nb\/wp-json\/wp\/v2\/tags?post=3427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}