{"id":69621,"date":"2020-02-21T02:56:53","date_gmt":"2020-02-20T23:56:53","guid":{"rendered":"https:\/\/prohoster.info\/blog\/rabbitmq-chast-2-razbiraemsya-s-exchanges"},"modified":"2020-03-03T16:14:48","modified_gmt":"2020-03-03T13:14:48","slug":"rabbitmq-chast-2-razbiraemsya-s-exchanges","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rabbitmq-chast-2-razbiraemsya-s-exchanges","title":{"rendered":"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><code>Shk\u00ebmbim<\/code> \u2014 k\u00ebmbim ose pik\u00eb k\u00ebmbimi. N\u00eb t\u00eb d\u00ebrgohen mesazhe. <code>Shk\u00ebmbim<\/code> <strong>distribuon mesazhin<\/strong> n\u00eb nj\u00eb ose disa radh\u00eb. Ai <strong>rute mesazhet n\u00eb radh\u00eb<\/strong> n\u00eb baz\u00eb t\u00eb lidhjeve t\u00eb krijuara (<code>bindings<\/code>) midis tij dhe radh\u00ebs. <\/p>\n<p><\/p>\n<p><code>Shk\u00ebmbim<\/code> nuk \u00ebsht\u00eb <noindex><a rel=\"nofollow\" href=\"http:\/\/erlang.org\/doc\/reference_manual\/processes.html\">proces Erlang<\/a><\/noindex>. P\u00ebr arsye t\u00eb zgjerueshm\u00ebris\u00eb <code>exchange<\/code> \u2014 \u00ebsht\u00eb nj\u00eb varg (link p\u00ebr modulin me kodin, ku ndodhet logjika e rutes) n\u00eb baz\u00ebn e t\u00eb dh\u00ebnave t\u00eb integruara <noindex><a rel=\"nofollow\" href=\"https:\/\/ru.wikipedia.org\/wiki\/Mnesia\">mnesia<\/a><\/noindex>. 1 mij\u00eb k\u00ebmbimtar\u00eb do t\u00eb konsumojn\u00eb vet\u00ebm 1MB memorie. <\/p>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h3 id=\"oglavlenie\">P\u00ebrmbajtja<\/h3>\n<p><\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/488654\/\">RabbitMQ. Pjesa 1. Introduction. Erlang, AMQP dhe RPC<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/489086\/\">RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges<\/a><\/noindex><\/li>\n<li>RabbitMQ. Pjesa 3. T\u00eb kuptojm\u00eb Queues dhe Bindings<\/li>\n<li>RabbitMQ. Pjesa 4. T\u00eb kuptojm\u00eb \u00e7far\u00eb jan\u00eb mesazhet dhe frames<\/li>\n<li>RabbitMQ. Pjesa 5. Performanca e publikimit dhe konsumimit t\u00eb mesazheve<\/li>\n<li>RabbitMQ. Pjesa 6. Pasqyr\u00eb e moduleve Federation dhe Shovel<\/li>\n<li>RabbitMQ. Pjesa 7. N\u00eb detaje p\u00ebr Connection dhe Chanel<\/li>\n<li>RabbitMQ. Pjesa 8. RabbitMQ n\u00eb .NET<\/li>\n<li>RabbitMQ. Pjesa 9. Monitorimi<\/li>\n<\/ul>\n<p><\/p>\n<h4 id=\"direct-exchange\"><em>Shk\u00ebmbimi Direk<\/em><\/h4>\n<p><\/p>\n<p><code>Shk\u00ebmbimi direkt<\/code> \u2014 p\u00ebrdoret kur nevojitet <strong>t\u00eb d\u00ebrgoni mesazhin n\u00eb radh\u00eb t\u00eb caktuara<\/strong>. Mesazhi publikohet n\u00eb k\u00ebmbimtar me nj\u00eb <strong>\u00e7el\u00ebs rute<\/strong> dhe p\u00ebrfundon n\u00eb t\u00eb gjitha radh\u00ebt q\u00eb jan\u00eb t\u00eb lidhura me k\u00ebt\u00eb k\u00ebmbimtar me nj\u00eb \u00e7el\u00ebs rute t\u00eb ngjash\u00ebm. <strong>\u00c7el\u00ebsi i rutes \u00ebsht\u00eb nj\u00eb varg<\/strong>. K\u00ebrkimi i p\u00ebrputhjes realizohet p\u00ebrmes <strong>kontrollit t\u00eb p\u00ebrputhshm\u00ebris\u00eb s\u00eb vargjeve<\/strong>.<\/p>\n<p><\/p>\n<p>Prezantimi vizual i rrjedh\u00ebs s\u00eb mesazheve:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/8ce3ab37542f2a7f8e7ac02a737c5f88.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>N\u00eb <code>rabbitmq<\/code> ekziston koncepti <strong>k\u00ebmbimi i parazgjedhur<\/strong>. Kjo \u00ebsht\u00eb <code>k\u00ebmbimi direkt<\/code> pa em\u00ebr. N\u00ebse p\u00ebrdoret k\u00ebmbimi i parazgjedhur, at\u00ebher\u00eb mesazhi do t\u00eb rutohet n\u00eb radhen me emrin e barabart\u00eb <strong>me \u00e7el\u00ebsin e rutes s\u00eb mesazhit<\/strong>. <\/p>\n<p><\/p>\n<h4 id=\"topic-exchange\"><em>Shk\u00ebmbimi Tematik<\/em><\/h4>\n<p><\/p>\n<p><code>Shk\u00ebmbimi tematik<\/code> \u2013 ngjash\u00ebm <code>k\u00ebmbimi direkt<\/code> ofron mund\u00ebsin\u00eb e realizimit t\u00eb rutes selektive duke krahasuar \u00e7el\u00ebsin e rutes. Por, n\u00eb k\u00ebt\u00eb rast, \u00e7el\u00ebsi p\u00ebrcaktohet <strong>sip\u00ebrmarrjeve<\/strong>. Gjat\u00eb krijimit t\u00eb sip\u00ebrmarrjeve p\u00ebrdoren <code>0<\/code> nj\u00eb ose m\u00eb shum\u00eb fjal\u00eb (g\u00ebrmat <code>AZ<\/code> dhe <code>az<\/code> dhe numrat <code>0-9<\/code>), t\u00eb ndara me pik\u00eb, si dhe simbolet <code>*<\/code> dhe <code>#<\/code>. <\/p>\n<p><\/p>\n<ul>\n<li><code>*<\/code> \u2014 mund t\u00eb z\u00ebvend\u00ebsohet me sakt\u00ebsisht <code>1<\/code> fjal\u00eb <\/li>\n<li><code>#<\/code> \u2014 mund t\u00eb z\u00ebvend\u00ebsohet me <code>0<\/code> nj\u00eb ose m\u00eb shum\u00eb fjal\u00eb <\/li>\n<\/ul>\n<p><\/p>\n<p>Prezantimi vizual i rrjedh\u00ebs s\u00eb mesazheve:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/a0ce48b291a3003eabbe61b3dfa5a4e1.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Duke filluar nga versioni <code>RabbitMQ 2.4.0<\/code> algoritmi i rutes p\u00ebr <code>k\u00ebmbimin tematik<\/code> ka filluar t\u00eb funksionoj\u00eb deri <code>145<\/code> m\u00eb shpejt. Kjo arrit\u00ebn p\u00ebrmes implementimit t\u00eb qasjes <noindex><a rel=\"nofollow\" href=\"https:\/\/www.rabbitmq.com\/blog\/2011\/03\/28\/very-fast-and-scalable-topic-routing-part-2\/\">implementimi trie<\/a><\/noindex>, i cili n\u00ebnkupton paraqitjen e sip\u00ebrmarrjeve si nj\u00eb struktur\u00eb peme. P\u00ebr shembull sip\u00ebrmarrjet <code>a.b.c<\/code>, <code>a.*.b.c<\/code>, <code>a.#.c<\/code> dhe <code>b.b.c<\/code> do t\u00eb paraqiten me k\u00ebt\u00eb struktur\u00eb:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/56ef5809fec9eb6c1b50a362b89dd05a.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>K\u00ebrkimi i p\u00ebrputhjes me sip\u00ebrmarrjen realizohet duke filluar nga rr\u00ebnj\u00ebt dhe duke ndjekur nga lart posht\u00eb.<\/p>\n<p><\/p>\n<p>Karakteristikat:<\/p>\n<p><\/p>\n<ul>\n<li>p\u00ebrdorimi i k\u00ebtij k\u00ebmbimi mund t\u00eb jet\u00eb <strong>nj\u00eb zgjedhje e mir\u00eb p\u00ebr zhvillimin e ardhsh\u00ebm t\u00eb mundsh\u00ebm t\u00eb aplikacionit<\/strong>, pasi sip\u00ebrmarrjet gjithmon\u00eb mund t\u00eb konfigurohen n\u00eb m\u00ebnyr\u00eb q\u00eb mesazhi t\u00eb publikohet n\u00eb m\u00ebnyr\u00eb t\u00eb ngjashme <code>k\u00ebmbimi direkt<\/code> ose <code>k\u00ebmbimit fanout<\/code><\/li>\n<li>sip\u00ebrmarrjet q\u00eb p\u00ebrdorin <code>*<\/code> <strong>\u00ebsht\u00eb shum\u00eb m\u00eb e shpejt\u00eb:<\/strong>, m\u00eb t\u00eb shpejt\u00eb se ato q\u00eb p\u00ebrdorin <code>#<\/code>. <\/li>\n<li><code>k\u00ebmbimin tematik<\/code> m\u00ebngjes <code>k\u00ebmbimi direkt<\/code><\/li>\n<\/ul>\n<p><\/p>\n<h4 id=\"fanout-exchange\"><em>Shk\u00ebmbimi Fanout<\/em><\/h4>\n<p><\/p>\n<p><code>Shk\u00ebmbimi fanout<\/code> \u2013 <strong>t\u00eb gjitha mesazhet d\u00ebrgohen n\u00eb t\u00eb gjitha radh\u00ebt<\/strong> edhe n\u00ebse n\u00eb mesazh \u00ebsht\u00eb caktuar nj\u00eb \u00e7el\u00ebs i rutes.<\/p>\n<p><\/p>\n<p>Karakteristikat:<\/p>\n<p><\/p>\n<ul>\n<li><code>RabbitMQ<\/code> <strong>nuk punon me \u00e7el\u00ebsat e ruterimit dhe shablon\u00ebt<\/strong> \u00e7ka ndikon pozitivisht n\u00eb performanc\u00eb. Ky \u00ebsht\u00eb m\u00eb i shpejti <code>exchange<\/code>;<\/li>\n<li>t\u00eb gjith\u00eb konsumator\u00ebt duhet t\u00eb jen\u00eb n\u00eb gjendje t\u00eb procesojn\u00eb t\u00eb gjitha mesazhet;<\/li>\n<\/ul>\n<p><\/p>\n<p>Prezantimi vizual i rrjedh\u00ebs s\u00eb mesazheve:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/575d86093f151016aef8058fc7d92907.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<h4 id=\"headers-exchange\"><em>Headers Exchange<\/em><\/h4>\n<p><\/p>\n<p><code>Headers exchange<\/code> \u2014 d\u00ebrgon mesazhe n\u00eb radh\u00ebt e lidhura n\u00eb baz\u00eb t\u00eb krahasimit t\u00eb \u00e7ifteve (\u00e7el\u00ebs, vler\u00eb) t\u00eb pron\u00ebs <code>headers<\/code> t\u00eb dy lidhjeve dhe pron\u00ebs s\u00eb ngjashme t\u00eb mesazhit. <code>headers<\/code> p\u00ebrfaq\u00ebson <code>Dictionary<\/code>. <\/p>\n<p><\/p>\n<p>N\u00ebse n\u00eb fjalor shtohet nj\u00eb \u00e7el\u00ebs i ve\u00e7ant\u00eb <code>x-match<\/code> me vler\u00ebn <code>any<\/code>, at\u00ebher\u00eb mesazhi ruterizohet me p\u00ebrputhje t\u00eb pjesshme t\u00eb \u00e7ifteve (\u00e7el\u00ebs, vler\u00eb). Ky sjellje \u00ebsht\u00eb e ngjashme me operatorin <code>or<\/code>. <\/p>\n<p><\/p>\n<pre><code class=\"cs\">var bindingArguments = new Dictinary();\nbindingArguments.add(\"x-match\", \"any\");<\/code><\/pre>\n<p><\/p>\n<p>Me defekt, \u00e7el\u00ebsi <code>x-match<\/code> p\u00ebrmban vler\u00ebn <code>t\u00eb gjitha<\/code>. Kjo do t\u00eb thot\u00eb se mesazhi ruterizohet me p\u00ebrputhje t\u00eb plot\u00eb t\u00eb \u00e7ifteve (\u00e7el\u00ebs, vler\u00eb). Ky sjellje \u00ebsht\u00eb e ngjashme me operatorin <code>dhe<\/code>.<\/p>\n<p><\/p>\n<p>Prezantimi vizual i rrjedh\u00ebs s\u00eb mesazheve:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/e9a02a0df88cb2c0538b97cec9002bf4.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Karakteristikat:<\/p>\n<p><\/p>\n<ul>\n<li>fleksibilitet shtes\u00eb<\/li>\n<li>shpenzime shtes\u00eb p\u00ebr llogaritje. T\u00eb gjitha \u00e7iftet (\u00e7el\u00ebs, vler\u00eb) t\u00eb atributit <code>headers<\/code> duhet t\u00eb renditen sipas emrit t\u00eb \u00e7el\u00ebsit para se t\u00eb llogariten vlerat p\u00ebr ruterizimin e mesazhit. <strong>M\u00eb i ngadalsh\u00ebm se llojet e tjera t\u00eb exchange<\/strong>.<\/li>\n<\/ul>\n<p><\/p>\n<h4 id=\"consistent-hashing-exchange\"><em>Consistent-Hashing Exchange<\/em><\/h4>\n<p><\/p>\n<p>Ky exchange \u00ebsht\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/rabbitmq\/rabbitmq-consistent-hash-exchange\">nj\u00eb plug-in<\/a><\/noindex> dhe <strong>nuk \u00ebsht\u00eb i integruar<\/strong> n\u00eb <code>RabbitMQ<\/code>.<\/p>\n<p><\/p>\n<p><code>Consistent-hashing exchange<\/code> (exchange me hashing t\u00eb q\u00ebndruesh\u00ebm) \u2013 p\u00ebrdoret kur ka disa radh\u00eb q\u00eb jan\u00eb prit\u00ebs t\u00eb mundsh\u00ebm t\u00eb mesazhit dhe kur duhet t\u00eb balancohen ngarkesat midis tyre. Lidhja e mesazhit me radh\u00ebn ndodh sipas pesh\u00ebs (nj\u00eb vler\u00eb stringu e kusht\u00ebzuar nga <code>0 - n<\/code>). <\/p>\n<p><\/p>\n<p>Pesha ekuivalente e radh\u00ebve \u2013 thot\u00eb se \u00e7do radh\u00eb do t\u00eb marr\u00eb <strong>nj\u00eb num\u00ebr t\u00eb p\u00ebraf\u00ebrt<\/strong> mesazhesh (\u00e7do mesazh do t\u00eb vendoset vet\u00ebm n\u00eb nj\u00eb radh\u00eb). <strong>Nuk ka garanci t\u00eb plot\u00eb p\u00ebr shp\u00ebrndarjen e barabart\u00eb t\u00eb mesazheve<\/strong>. <\/p>\n<p><\/p>\n<p>Prezantimi vizual i rrjedh\u00ebs s\u00eb mesazheve:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/dd22749cad463fe86619a98276554e10.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><code>Hash<\/code> llogaritet n\u00eb baz\u00eb t\u00eb \u00e7el\u00ebsit t\u00eb ruterimit ose pron\u00ebs <code>headers<\/code> t\u00eb mesazhit. N\u00ebse t\u00eb gjitha mesazhet q\u00eb publikohen kan\u00eb \u00e7el\u00ebsa t\u00eb ndrysh\u00ebm t\u00eb ruterimit ose <code>headers<\/code>, at\u00ebher\u00eb shp\u00ebrndarja do t\u00eb ndodh\u00eb sipas pesh\u00ebs. Ndryshe do t\u00eb p\u00ebrdoret \u00e7el\u00ebsi i ruterimit ose <code>headers<\/code>.<\/p>\n<p><\/p>\n<p><strong>Duhet t\u00eb ndihmoj\u00eb, kur kapaciteti i konsumatorit ka nevoj\u00eb p\u00ebr rritje m\u00eb t\u00eb lart\u00eb sesa zgjidhja me disa konsumator\u00eb q\u00eb p\u00ebrdorin nj\u00eb radh\u00eb.<\/strong><\/p>\n<p><\/p>\n<h4 id=\"kombinirovanie-obmennikov-e2e\"><em>Kombinimi i exchange-ve (E2E)<\/em><\/h4>\n<p><\/p>\n<p>Sjellja e t\u00eb gjitha exchange-ve mund t\u00eb kombinohet p\u00ebrmes lidhjes <strong>Exchange-to-Exchange<\/strong> (kombinimi i exchange-ve nuk p\u00ebrfshihet n\u00eb specifikimin <code>AMQP<\/code>. Ky \u00ebsht\u00eb nj\u00eb zgjerim i protokollit nga <code>RabbitMQ<\/code>).<\/p>\n<p><\/p>\n<p>Prezantimi vizual i rrjedh\u00ebs s\u00eb mesazheve:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/41ea01a0f43f2dd195fa4f34f7fc176c.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>P\u00ebrmes <code>E2E<\/code> ne mund t\u00eb gjejm\u00eb konfigurimin e duhur t\u00eb shkall\u00ebzuesh\u00ebm, i cili p\u00ebrmbush k\u00ebrkesat ekzistuese dhe ato n\u00eb rritje.<\/p>\n<p><\/p>\n<h4 id=\"sozdanie-exchange\"><em>Krijimi i Exchange<\/em><\/h4>\n<p><\/p>\n<p>Krijimi i k\u00ebmbimit b\u00ebhet p\u00ebrmes sinhronizimit <code>RPC<\/code> k\u00ebrkese sinkrone ndaj serverit. K\u00ebrkesa b\u00ebhet me metod\u00ebn <code>Exchange.Declare<\/code>, e thirrur me parametrat:<\/p>\n<p><\/p>\n<ul>\n<li>emri i k\u00ebmbimit<\/li>\n<li>tipi i k\u00ebmbimit<\/li>\n<li>parametra t\u00eb tjer\u00eb<\/li>\n<\/ul>\n<p><\/p>\n<p>Shembujt e krijimit <code>exchange<\/code> me ndihm\u00ebn e <noindex><a rel=\"nofollow\" href=\"https:\/\/www.rabbitmq.com\/dotnet.html\">RabbitMQ.Client<\/a><\/noindex>:<\/p>\n<p><\/p>\n<pre><code class=\"cs\">\/\/...\nchannel.ExchangeDeclare(\n    exchange: &quot;my_exchange&quot;,\n    type: &quot;direct&quot;,\n    durable: &quot;false&quot;,\n    autoDelete: &quot;false&quot;,\n    arguments: null\n);\n\/\/...<\/code><\/pre>\n<p><\/p>\n<ul>\n<li><code>exchange<\/code> \u2014 emri i k\u00ebmbimit q\u00eb duam t\u00eb krijojm\u00eb. Emri duhet t\u00eb jet\u00eb unik<\/li>\n<li><code>lloji<\/code> \u2014 tipi i k\u00ebmbimit<\/li>\n<li><code>durable<\/code> \u2014 n\u00ebse e vendosni <code>true<\/code>, nuk \u00ebsht\u00eb e nevojshme, madje, ajo jep nj\u00eb gabim sintaksor <code>exchange<\/code> do t\u00eb jet\u00eb konstant. Ai do t\u00eb ruhet n\u00eb disk dhe do t\u00eb mbijetoj\u00eb pas rivendosjes s\u00eb serverit\/brokerit. N\u00ebse vlera <code>false<\/code>, nuk \u00ebsht\u00eb e nevojshme, madje, ajo jep nj\u00eb gabim sintaksor <code>exchange<\/code> \u00ebsht\u00eb p\u00ebrkohshme dhe do t\u00eb fshihet, kur serveri\/brokeri t\u00eb rivendoset<\/li>\n<li><code>autoDelete<\/code> \u2014 fshirja automatike. <code>Shk\u00ebmbim<\/code> do t\u00eb fshihet, kur t\u00eb gjitha radh\u00ebt e lidhura me t\u00eb t\u00eb fshihen<\/li>\n<li><code>arguments<\/code> \u2014 argumente t\u00eb opcionalit. Shpesh, p\u00ebrmes argumenteve p\u00ebrcaktojn\u00eb <code>k\u00ebmbimin alternativ<\/code> (<strong>k\u00ebmbim alternativ<\/strong>). N\u00ebse mesazhi nuk mund t\u00eb kaloj\u00eb n\u00eb rrug\u00ebn fillestare, ai mund t\u00eb d\u00ebrgohet n\u00eb k\u00ebmbimin alternativ p\u00ebr t\u00eb u orientuar n\u00eb nj\u00eb rrug\u00eb tjet\u00ebr.<\/li>\n<\/ul>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/6a352e92f94dadf58ba24de453806133.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>N\u00ebse krijimi <code>exchange<\/code> <strong>\u00ebsht\u00eb i mundur<\/strong>, at\u00ebher\u00eb serveri do t'i d\u00ebrgoj\u00eb klientit nj\u00eb <code>RPC<\/code> p\u00ebrgjigje <code>Exchange.DeclareOk<\/code>. N\u00ebse krijimi <strong>nuk \u00ebsht\u00eb i mundur<\/strong> (k\u00ebrkesa u refuzua me <code>Exchange.Declare<\/code>), at\u00ebher\u00eb <strong>kanali do t\u00eb mbyllet<\/strong> serveri p\u00ebrmes komand\u00ebs asinkrone <code>Channel.Close<\/code> dhe klienti do t\u00eb marr\u00eb p\u00ebrjashtimin <noindex><a rel=\"nofollow\" href=\"https:\/\/www.rabbitmq.com\/releases\/rabbitmq-dotnet-client\/v3.6.10\/rabbitmq-dotnet-client-3.6.10-client-htmldoc\/html\/type-RabbitMQ.Client.Exceptions.OperationInterruptedException.html\">OperationInterruptedException<\/a><\/noindex>, i cili do t\u00eb p\u00ebrmbaj\u00eb kodin e gabimit dhe p\u00ebrshkrimin e tij. <\/p>\n<p><\/p>\n<p>K\u00ebmbimi duhet t\u00eb krijohet para se t\u00eb publikohet mesazhe. N\u00ebse publikoni nj\u00eb mesazh n\u00eb nj\u00eb k\u00ebmbim q\u00eb nuk ekziston \u2014 <code>RabbitMQ<\/code> do ta fshij\u00eb n\u00eb heshtje.<\/p>\n<p><\/p>\n<h4 id=\"sozdanie-exchange-cherez-graficheskiy-interfeys\"><em>Krijimi i Exchange p\u00ebrmes nd\u00ebrfaqes grafike<\/em><\/h4>\n<p><\/p>\n<p>Hyni n\u00eb panelin e administratorit <code>RabbitMQ<\/code> me p\u00ebrdoruesin <code>guest<\/code> (username: <code>guest<\/code> dhe password: <code>guest<\/code>). Ju lutemi vini re se p\u00ebrdoruesi <code>guest<\/code> mund t\u00eb lidhet vet\u00ebm nga localhost. Tani kalojm\u00eb te skeda <code>K\u00ebmbime<\/code> dhe klikojm\u00eb <code>Shto nj\u00eb k\u00ebmbim t\u00eb ri<\/code>. Plot\u00ebsojm\u00eb parametrat:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"RabbitMQ. Pjesa 2. T\u00eb kuptojm\u00eb Exchanges\" src=\"\/wp-content\/uploads\/2020\/02\/c4fd31b8cdb8182690ec8c01ccd2a460.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Shumica e pronar\u00ebve jan\u00eb p\u00ebrshkruar m\u00eb sip\u00ebr. K\u00ebtu do t\u00eb theksojm\u00eb se n\u00ebse p\u00ebrcaktoni <code>Internal<\/code>, at\u00ebher\u00eb k\u00ebmbimi mund t\u00eb p\u00ebrdoret vet\u00ebm p\u00ebr <code>E2E<\/code>. <code>Producer<\/code> nuk mund t\u00eb d\u00ebrgoj\u00eb mesazhe n\u00eb nj\u00eb k\u00ebmbim t\u00eb till\u00eb.<\/p>\n<p><\/p>\n<h3 id=\"zaklyuchenie\">P\u00ebrfundim<\/h3>\n<p><\/p>\n<p>Kur zhvilloni nj\u00eb sistem, \u00ebsht\u00eb e p\u00ebrshtatshme t\u00eb p\u00ebrshkruani topologjin\u00eb e <noindex><a rel=\"nofollow\" href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9C%D0%B0%D1%80%D1%88%D1%80%D1%83%D1%82%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F\">orientimit<\/a><\/noindex> p\u00ebrmes nj\u00eb grafi. Por para se t\u00eb filloni nd\u00ebrtimin e grafit, \u00ebsht\u00eb e nevojshme t\u00eb identifikoni rrug\u00ebt me trafikun m\u00eb t\u00eb madh, pasi ato k\u00ebrkojn\u00eb <strong>kapacitet m\u00eb t\u00eb lart\u00eb<\/strong> (performanc\u00ebn). Pastaj mund t\u00eb klasifikoni trafikun. Dhe m\u00eb pas t\u00eb filloni nd\u00ebrtimin.<\/p>\n<p><\/p>\n<p>N\u00ebse n\u00eb grafikun e nd\u00ebrtuar ka <strong>nj\u00eb num\u00ebr t\u00eb kufizuar<\/strong> \u00e7el\u00ebsash t\u00eb orientimit, at\u00ebher\u00eb \u00ebsht\u00eb e nevojshme t\u00eb shikoni p\u00ebr disa <code>k\u00ebmbimit fanout<\/code>, t\u00eb cilat lidhen 1:1 me \u00e7el\u00ebsin e orientimit. Kujtojm\u00eb se <code>k\u00ebmbimit fanout<\/code> \u00ebsht\u00eb m\u00eb i shpejti.<\/p>\n<p><\/p>\n<p>N\u00ebse numri i rrug\u00ebve <strong>t\u00eb tendoset n\u00eb pafund\u00ebsi<\/strong>, at\u00ebher\u00eb duhet t\u00eb kushtoni v\u00ebmendje ndaj <code>k\u00ebmbimin tematik<\/code> apo, n\u00ebse modeli nuk \u00ebsht\u00eb i nevojsh\u00ebm, mund t\u00eb zgjidhni <code>k\u00ebmbim t\u00eb drejtp\u00ebrdrejt\u00eb<\/code>, pasi ai \u00ebsht\u00eb m\u00eb i shpejt\u00eb <code>k\u00ebmbimin tematik<\/code>.<\/p>\n<p><\/p>\n<p>Kombinimet e ndryshme <code>exchange<\/code> duhet t\u00eb ndihmojn\u00eb n\u00eb gjetjen e konfigurimit t\u00eb duhur <strong>t\u00eb shkall\u00ebzuesh\u00ebm<\/strong>, i cili p\u00ebrmbush k\u00ebrkesat ekzistuese dhe ato n\u00eb rritje t\u00eb sistemit.<\/p>\n<p><\/p>\n<p>Numri <code>exchange<\/code> dhe radh\u00ebt duhet t\u00eb jen\u00eb minimale krahasuar me numrin e rrug\u00ebve.<\/p>\n<p><\/p>\n<p>N\u00eb artikullin e ardhsh\u00ebm do t\u00eb fillojm\u00eb t\u00eb shqyrtojm\u00eb m\u00eb n\u00eb detaje Queues dhe Bindings.<\/p>\n<p><\/p>\n<h3 id=\"ssylki\">Linket<\/h3>\n<p><\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/www.rabbitmq.com\/\">Faqja e projektit RabbitMQ<\/a><\/noindex><\/li>\n<\/ul>\n<p>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/489086\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>Exchange \u2014 \u043e\u0431\u043c\u0435\u043d\u043d\u0438\u043a \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u043e\u0431\u043c\u0435\u043d\u0430. \u0412 \u043d\u0435\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. Exchange \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043e\u0434\u043d\u0443 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439. \u041e\u043d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0432\u044f\u0437\u0435\u0439 (bindings) \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044c\u044e. Exchange \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Erlang-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c. \u0418\u0437 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u0438 exchange \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 (\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c \u0441 \u043a\u043e\u0434\u043e\u043c, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u043b\u043e\u0433\u0438\u043a\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438) \u0432\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":69622,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-69621","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"Exchange \u2014 \u043e\u0431\u043c\u0435\u043d\u043d\u0438\u043a \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u043e\u0431\u043c\u0435\u043d\u0430. \u0412 \u043d\u0435\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. Exchange \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043e\u0434\u043d\u0443 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rabbitmq-chast-2-razbiraemsya-s-exchanges\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47RabbitMQ. \u0427\u0430\u0441\u0442\u044c 2. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 Exchanges | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"Exchange \u2014 \u043e\u0431\u043c\u0435\u043d\u043d\u0438\u043a \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u043e\u0431\u043c\u0435\u043d\u0430. \u0412 \u043d\u0435\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. Exchange \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043e\u0434\u043d\u0443 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rabbitmq-chast-2-razbiraemsya-s-exchanges\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-02-20T23:56:53+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-03-03T13:14:48+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47RabbitMQ. Pjesa 2. Duke u shqyrtuar Exchanges | ProHoster","description":"Exchange \u2014 nj\u00eb pik\u00eb k\u00ebmbimi. N\u00eb t\u00eb d\u00ebrgohen mesazhe. Exchange shp\u00ebrndan mesazhin n\u00eb nj\u00eb ose m\u00eb shum\u00eb radh\u00eb.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rabbitmq-chast-2-razbiraemsya-s-exchanges","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47RabbitMQ. \u0427\u0430\u0441\u0442\u044c 2. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 Exchanges | ProHoster","og:description":"Exchange \u2014 \u043e\u0431\u043c\u0435\u043d\u043d\u0438\u043a \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u043e\u0431\u043c\u0435\u043d\u0430. \u0412 \u043d\u0435\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. Exchange \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043e\u0434\u043d\u0443 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439.","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rabbitmq-chast-2-razbiraemsya-s-exchanges","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-02-20T23:56:53+00:00","article:modified_time":"2020-03-03T13:14:48+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"69621","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 17:31:26","updated":"2022-09-28 03:24:29","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/69621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=69621"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/69621\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/69622"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=69621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=69621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=69621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}