{"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":"lar-dig-mer-om-ruby-on-rails-med-pub-sub","status":"publish","type":"post","link":"https:\/\/thecodest.co\/sv\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/","title":{"rendered":"L\u00e4s mer om Ruby on Rails med Pub\/Sub"},"content":{"rendered":"<p><strong><a href=\"https:\/\/thecodest.co\/sv\/case-studies\/providing-a-team-of-ruby-developers-for-a-fintech-company\/\">Ruby<\/a> p\u00e5 <a href=\"https:\/\/thecodest.co\/sv\/blog\/ways-to-increase-your-rails-performance\/\">R\u00e4ls<\/a><\/strong> (Rails, <a href=\"https:\/\/thecodest.co\/sv\/blog\/hire-ror-developer\/\">RoR<\/a>) \u00e4r en v\u00e4lk\u00e4nd <a href=\"https:\/\/thecodest.co\/sv\/blog\/find-your-ideal-stack-for-web-development\/\">webb<\/a> applikationsramverk som \u00e4r skrivet i <strong>Ruby<\/strong> programmeringsspr\u00e5k. <strong>Pub\/Sub<\/strong> \u00e4r ett kort namn p\u00e5 designm\u00f6nster f\u00f6r programvara som kallas <b>Publicera och prenumerera<\/b>. Jag ska f\u00f6rklara hur kommunikation mellan programvarukomponenter i Rails kan hanteras med Pub\/Sub.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Vad \u00e4r Pub\/sub?<\/h2>\n\n\n\n<p><strong>Pub\/sub<\/strong> \u00e4r ett designm\u00f6nster f\u00f6r programvara som m\u00f6jligg\u00f6r kommunikation mellan tj\u00e4nster. Tj\u00e4nst<br>inneb\u00e4r en av de tv\u00e5 rollerna: utgivare (som producerar) eller mottagare (som konsumerar). Vad \u00e4r<br>som ska konsumeras best\u00e4ms som en h\u00e4ndelse eller ett meddelande eller en notifiering. I<br>i denna artikel anv\u00e4nds de synonymt f\u00f6r att referera till samma sak.<br>Tj\u00e4nsten som producerar vet inte vem som konsumerar. Tj\u00e4nsten som konsumerar vet inte<br>k\u00e4nna till meddelandets ursprung. De kan f\u00f6rbli ok\u00e4nda f\u00f6r varandra. Det skiljer sig fr\u00e5n<br>meddelandek\u00f6er, d\u00e4r den komponent som skickar meddelandet ofta k\u00e4nner till dess destination<br>- Den h\u00e4r typen av meddelanden g\u00f6r att du kan skicka meddelanden var som helst. Denna mekanism \u00e4r en central<br>av <strong>Pub\/sub<\/strong> och det betyder att de \u00e4r frikopplade.<\/p>\n\n\n\n<p>F\u00f6r att kunna uttrycka sina \u00f6msesidiga intressen m\u00e5ste de ha en gemensam f\u00f6rst\u00e5else. Det \u00e4r d\u00e4rf\u00f6r,<br>b\u00e5da rollerna har en implicit pinnmekanism d\u00e4r producenten av ett meddelande och mottagaren av<br>konsument av meddelandet m\u00f6ts. Denna mekanism kallas \u00e4mne, prenumeration eller topic. Den \u00e4r<br>ansvarar f\u00f6r att kategorisera meddelanden till \u00e4mnen, \u00e4r det i huvudsak ett statl\u00f6st meddelandefilter.<br>\u00c4mnen fungerar som s\u00e4ndningsstationer. En utgivare producerar meddelandet till \u00e4mnet,<br>prenumeranterna omedelbart f\u00e5r meddelandet fr\u00e5n \u00e4mnet. P\u00e5 grund av den frikopplade<br>\u00e4r det mest effektiva s\u00e4ttet att utbyta meddelanden att hantera dem asynkront.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Rails utan Pub\/Sub<\/h2>\n\n\n\n<p>Som standard finns det ingen Rails-overhead f\u00f6r mjukvarudesignm\u00f6nster f\u00f6r att skicka meddelanden mellan komponenter. Utvecklare anv\u00e4nder standard <strong>objektorienterad programmering<\/strong> (<a href=\"https:\/\/thecodest.co\/sv\/dictionary\/object-oriented-programming-oop\/\">OOP<\/a>) paradigm: skicka parametrar till funktioner, fr\u00e5ga efter klasser om v\u00e4rden.<\/p>\n\n\n\n<p>N\u00e4r applikationen \u00e4r ganska okomplicerad kan det r\u00e4cka. N\u00e4r applikationen v\u00e4xer, t.ex. n\u00e4r vissa operationer m\u00e5ste utf\u00f6ras asynkront, kan <a href=\"https:\/\/thecodest.co\/sv\/dictionary\/why-do-projects-fail\/\">projekt<\/a> beh\u00f6ver en abstraktion som l\u00f6ser det <a href=\"https:\/\/thecodest.co\/sv\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">data<\/a> arbetsfl\u00f6de. Ist\u00e4llet f\u00f6r att uppfinna hjulet p\u00e5 nytt kan utvecklare implementera <strong>Pub\/sub<\/strong> f\u00f6r att fylla denna brist p\u00e5 abstraktion.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">F\u00f6rdelar med Pub\/Sub med Rails<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Undvik \u00e5terkallelser i Active Record.<\/li>\n\n\n\n<li>Genom att l\u00e4gga till asynkron parallellbearbetning i ett system f\u00f6rb\u00e4ttras prestanda, tillf\u00f6rlitlighet och <a href=\"https:\/\/thecodest.co\/sv\/blog\/difference-between-elasticity-and-scalability-in-cloud-computing\/\">Skalbarhet<\/a> \u00e4r f\u00f6rb\u00e4ttrade.<\/li>\n\n\n\n<li>Meddelanden kan s\u00e4ndas asynkront till olika delar av systemet.<\/li>\n\n\n\n<li>G\u00f6r det m\u00f6jligt att s\u00e4nda meddelanden asynkront till olika delar av ett system.<\/li>\n\n\n\n<li>Frikoppling - att l\u00e4gga till eller \u00e4ndra en funktion p\u00e5verkar inte n\u00e5got annat eftersom Pub\/Sub<br>kan du \u00e4ndra hur allt samverkar.<\/li>\n\n\n\n<li>Meddelandekonsumenten beh\u00f6ver inte l\u00e4ngre regelbundet kontrollera om det finns uppdateringar eller nya<br>information. Det minskar leveransf\u00f6rdr\u00f6jningen som kan vara s\u00e4rskilt problematisk i system<br>med ingen tolerans f\u00f6r f\u00f6rseningar.<\/li>\n\n\n\n<li>Det finns ingen gr\u00e4ns f\u00f6r hur m\u00e5nga abonnenter systemet kan hantera eftersom det kan \u00e4ndras,<br>uppgraderas, m\u00e5ngfaldigas eller f\u00f6rsvinna n\u00e4r som helst.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Nackdelar med Pub\/Sub med Rails<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Den st\u00f6rsta nackdelen med Pub\/sub-system \u00e4r att de inte kopplar ihop utgivare och<br>abonnent.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Rails Pub\/Sub inf\u00f6ra<\/h2>\n\n\n\n<p>Exempel p\u00e5 k\u00e4llkod i Rails skrevs med hj\u00e4lp av biblioteket<br><a href=\"https:\/\/github.com\/stevo\/pubsub_on_rails\" rel=\"nofollow\">Pub\/Sub p\u00e5 Rails<\/a> (i Rubys nomenklatur kallas ett bibliotek f\u00f6r gem): Du hittar mer information i gemens readme. Implementeringen best\u00e5r av moduler:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Dom\u00e4n,<\/li>\n\n\n\n<li>H\u00e4ndelse,<\/li>\n\n\n\n<li>H\u00e4ndelsehanterare,<\/li>\n\n\n\n<li>Utgivare av evenemang,<\/li>\n\n\n\n<li>Prenumeration.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Dom\u00e4n<\/h3>\n\n\n\n<p>Beskriver aff\u00e4rslogiken f\u00f6r att ge Pub\/Sub ett sammanhang och d\u00e4rmed g\u00f6ra den ren <a href=\"https:\/\/thecodest.co\/sv\/dictionary\/what-is-code-refactoring\/\">kod<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"> modul Meddelanden\n   extend PubSub::Dom\u00e4n\n avsluta<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"> modul Rapporter\n   extend PubSub::Dom\u00e4n\n avsluta\n\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">H\u00e4ndelse<\/h3>\n\n\n\n<p>Det \u00e4r en klass som beskriver vad som h\u00e4nde. Deklarera klassnamnet s\u00e5 sj\u00e4lvbeskrivande med vad som h\u00e4nde som m\u00f6jligt, till exempel: cancelled, changed, created, destroyed, sent, updated. H\u00e4ndelsenamn kan se ut som: ProfitAndLossStatementCreatedEvent, vilket inneb\u00e4r att en finansiell rapport skapades.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"> class Reports::ProfitAndLossStatementCreatedEvent &lt; PubSub::DomainEvent\n   attribut :profit_and_loss_statement_id, Types::Strict::Integer\n slut<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Utgivare av evenemang<\/h3>\n\n\n\n<p>Klass som kan avge h\u00e4ndelser. Exemplet visar hur man skapar en servicerapport. N\u00e4r rapporten har skapats, emitterar du h\u00e4ndelsen f\u00f6r att skapa rapporten.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">class Reports::Vinst-och-f\u00f6rlustredovisningService\n   inkluderar PubSub::Emit\n    def exekvera\n     emit(:report_profit_and_loss_statement_created, profit_and_loss_statement_id: id) if result.ok?\n   end\n slut<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">H\u00e4ndelsehanterare<\/h3>\n\n\n\n<p>Denna klass b\u00f6r exekveras som svar p\u00e5 hanteringen av en h\u00e4ndelse.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">modul Notifieringar\n class ReportsProfitAndLossStatementCreatedHandler &lt; PubSub::DomainEventHandler\n   def anrop\n     ReportMailer.vinst_och_f\u00f6rlustutl\u00e5tande(vinst_och_f\u00f6rlustutl\u00e5tande).deliver_now\n   slut\n\n   privat\n\n   def vinst_och_f\u00f6rlust_uttalande\n     ProfitAndLossStatement.find(event_data.profit_and_loss_statement_id)\n   slut\n slut\nslut<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Prenumeration<\/h3>\n\n\n\n<p>H\u00e4ndelser kopplas till sina hanterare genom prenumerationer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"yaml\" class=\"language-yaml\">meddelanden:\n rapporter__vinst_och_f\u00f6rlust_utr\u00e4kning_skapad: async<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Exempel p\u00e5 anv\u00e4ndningsomr\u00e5den:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\"F\u00f6lj\"-funktionen i sociala n\u00e4tverk,<\/li>\n\n\n\n<li>Sakernas internet,<\/li>\n\n\n\n<li>Mailing,<\/li>\n\n\n\n<li>Meddelande om genererade filer.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Liknande m\u00f6nster<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><b>EventBus<\/b> - komponenter kan skicka evenemang till EventBus utan att veta vem som ska h\u00e4mta dem eller hur m\u00e5nga som kommer att <a href=\"https:\/\/thecodest.co\/sv\/blog\/react-development-all-you-have-to-know\/\">reagera<\/a>,<\/li>\n\n\n\n<li><b>Observat\u00f6r<\/b> - uppr\u00e4tth\u00e5ller subjektet en lista \u00f6ver beroende parter, s\u00e5 kallade observat\u00f6rer, och meddelar dem n\u00e4r deras tillst\u00e5nd \u00e4ndras,<\/li>\n\n\n\n<li><b>Poolning<\/b> - Vid polling fr\u00e5gar klienterna regelbundet systemet om det finns n\u00e5gra nya h\u00e4ndelser eller data.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u00c4delstenar<\/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>R\u00e4ls<\/a><\/p>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Sammanfattning<\/h2>\n\n\n\n<p>Pub\/sub \u00e4r inte ett vanligt tillv\u00e4gag\u00e5ngss\u00e4tt i Ruby in Rails. Som introduceras i artikeln kan detta m\u00f6nster ge m\u00e5nga f\u00f6rdelar f\u00f6r projektet - det kan g\u00f6ra koden ren, frikoppla tj\u00e4nster och g\u00f6ra dem l\u00e4tt skalbara.<\/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=\"samarbetsbanner\"\/><\/a><\/figure>","protected":false},"excerpt":{"rendered":"<p>Pub\/Sub kan ge m\u00e5nga f\u00f6rdelar f\u00f6r projektet - det kan g\u00f6ra koden ren, frikoppla tj\u00e4nster och g\u00f6ra dem l\u00e4tt skalbara. L\u00e4r dig mer om Pub\/Sub i f\u00f6ljande artikel och f\u00e5 ditt projekt att lyfta!<\/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\/sv\/blogg\/lar-dig-mer-om-ruby-on-rails-med-pub-sub\/\" \/>\n<meta property=\"og:locale\" content=\"sv_SE\" \/>\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\/sv\/blogg\/lar-dig-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\":\"sv-SE\",\"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\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/learn-more-about-ruby-on-rails-with-pub-sub\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@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\":\"sv-SE\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@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\":\"sv-SE\",\"@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\\\/sv\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"L\u00e4s mer om Ruby on Rails med Pub\/Sub - The Codest","description":"Utforska designm\u00f6nstret Pub\/Sub i Ruby on Rails och se hur det m\u00f6jligg\u00f6r h\u00e4ndelsestyrd kommunikation och skalbar 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\/sv\/blogg\/lar-dig-mer-om-ruby-on-rails-med-pub-sub\/","og_locale":"sv_SE","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\/sv\/blogg\/lar-dig-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":"sv-SE","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\u00e4s 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":"Utforska designm\u00f6nstret Pub\/Sub i Ruby on Rails och se hur det m\u00f6jligg\u00f6r h\u00e4ndelsestyrd kommunikation och skalbar systemarkitektur.","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/#breadcrumb"},"inLanguage":"sv-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/learn-more-about-ruby-on-rails-with-pub-sub\/"]}]},{"@type":"ImageObject","inLanguage":"sv-SE","@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":"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":"sv-SE"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"sv-SE","@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":"sv-SE","@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\/sv\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/comments?post=3427"}],"version-history":[{"count":8,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3427\/revisions"}],"predecessor-version":[{"id":7913,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3427\/revisions\/7913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/media\/3428"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/media?parent=3427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/categories?post=3427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/tags?post=3427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}