<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Karait消息隊列系統(tǒng)

          聯(lián)合創(chuàng)作 · 2023-10-01 00:44

          Karait是一個消息隊列系統(tǒng),其消息存儲采用了MongoDB的Capped Collections結(jié)構(gòu),這一結(jié)構(gòu)的特點就是集合的大小可設(shè)定,當(dāng)數(shù)據(jù)大小超出設(shè)定大小時,新數(shù)據(jù)會抹掉舊數(shù)據(jù)。

          Karait目前提供Python和Ruby的客戶端操作包,也就是說你可以使用Python或Ruby來寫消息,用Python或Ruby來讀隊列。

          Ruby 版本示例代碼:

          require 'karait'
          
          queue = Karait::Queue.new(
              :host => 'localhost', # MongoDB host. Defaults to localhost.
              :port => 27017, # MongoDB port. Defaults to 27017.
              :database => 'karait', # Database that will store the karait queue. Defaults to karait.
              :queue => 'messages', # The capped collection that karait writes to. Defaults to messages.
              :average_message_size => 8192, # How big do you expect the messages will be in bytes? Defaults to 8192.
              :queue_size => 4096 # How many messages should be allowed in the queue. Defaults to 4096.
          )
          
          queue.write({
              :name => 'Benjamin',
              :action => 'Rock'
          })
          
          # or
          
          message = Karait::Message.new
          message.name = 'Benjamin'
          message.action = 'Rock!'
          
          queue.write(message, :routing_key => 'my_routing_key', :expire => 3.)
          瀏覽 26
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产丝袜足交在线 | 黄色av网站在线观看 | 男女操逼视频免费看 | 成人在线综合豆花 | 伊人精品视频 |