ようへいの日々精進XP

よかろうもん

2016 年 10 月 02 日(日)

久しぶりに

雨が降っていない朝。洗濯物が捗る。

奥さんは

中洲の美容院に朝早く出かけていった。中洲の美容院と聞くと夜の蝶達御用達の美容院もあったりするのかなと妄想...夜の若い蝶が集う待合室に飛んで火にいる香椎の蝶...妄想が膨らんで面白い。

久しぶりに(2)

香椎浜を走った。左足太ももが痛かったり、風邪をひいたりしていてサボっていたので体は重かったし、昨晩のおろしにんにくがヒットしたのかお腹が痛くてトイレにピットイン...結局、一周で止めた。

イオンモール香椎浜

  • いつものタリーズが満員御礼、スタバに河岸を変えて MCP 70-533 の勉強等
  • スタバでタゾチャイティラテをがぶ飲みしたら腹痛再来、トイレに駆け込む
  • トイレ後はタリーズにて引続き資料を読んだり、調べ物をしたり...周囲の人の会話が耳に飛び込んできて、色々と考えさせられた

Azure Service Bus の Queue を触ってみた

Azure キューと Service Bus キュー

azure.microsoft.com

そもそも、Azure キューと Service Bus のキューが在って混乱しそう。

個人的に気になったのが FIFO で順番が保証されているところ。Amazon SQS には無い機能。

Python でちょこっと

  • requirements.txt
azure-batch
azure-servicebus==0.20.2
azure-mgmt-scheduler

azure-servicebus==0.20.2 しておかないと、'could not convert string to float: max-age=31536000' のエラーに見舞われる。

  • Namespace 作成

PowerShell で実行。

New-AzureSBNamespace -Name 'oreno-namespace' -Location 'Japan West' -NamespaceType 'Messaging' -CreateACSNamespace $true

以下のように出力される。

Name                  : oreno-namespace
Region                : Japan West
DefaultKey            : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Status                : Active
CreatedAt             : 2016/10/02 16:44:38
AcsManagementEndpoint : https://oreno-namespace-sb.accesscontrol.windows.net/
ServiceBusEndpoint    : https://oreno-namespace.servicebus.windows.net/
ConnectionString      : Endpoint=sb://oreno-namespace.servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NamespaceType         : Messaging
  • 送信側
from azure.servicebus import ServiceBusService, Message, Queue
import time

service_namespace = 'oreno-namespace'
account_key       = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
issuer            = 'owner'

sbs = ServiceBusService(service_namespace,
     account_key=account_key,
     issuer=issuer)

num = 0
while num < 100:
  time.sleep(1)
  print 'Test Message' + str(num)
  sbs.send_queue_message('taskqueue', Message(b'Test Message' + str(num)))
  num += 1

print 'finished.'
  • 受信側
from azure.servicebus import ServiceBusService, Message, Queue
import time

service_namespace = 'oreno-namespace'
account_key       = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
issuer            = 'owner'

sbs = ServiceBusService(service_namespace,
     account_key=account_key,
     issuer=issuer)

while 1:
    time.sleep(1)
    msg = sbs.receive_queue_message('taskqueue', peek_lock=False)
    print(msg.body)
  • 実行してみると...

f:id:inokara:20161003002253p:plain

一応、順番が守られているっぽい。

時間があればもう少し突っ込んで触ってみたい。

俺のカレー

カレーを作る。

細かく刻んだトマト、玉ねぎと豚ひき肉、鶏肉をコンソメスープで適当に煮込んで市販のカレールウを 2 個位放り込んで適当に煮込んだもの。後はカレー粉でサッと炒めたじゃがいも、人参等の野菜を後乗せで食べる。(鷹の爪、ローリエも投入している)

カレーの保存を考慮する際にじゃがいもや人参を一緒に煮込んでいるとそれらの消費期限を気にしなければいけないが、野菜を後乗せすることで、野菜はお好みで選べるし、消費期限をあまり考慮する必要がなるメリットがあると考えている。

まあまあ美味しかった。