azure-servicebus-0.1.5.0: Haskell wrapper over Microsoft Azure ServiceBus REST API

Copyright(c) Hemanth Kapila, 2014
LicenseBSD3
Maintainersaihemanth@gmail.com
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Web.WindowsAzure.ServiceBus.Queue

Contents

Description

Provides API to pull from and push to ServiceBus queue Please refer to Service Bus Rest API for information on the API provided by Microsoft Service bus.

Simple example for how to use this library is as below

import Web.WindowsAzure.ServiceBus.Queue
import Web.WindowsAzure.ServiceBus
import qualified Data.ByteString.Char8 as C

queueName = "queueName"
sbNamespace = "namespace"
sbIssuerKey = C.pack "1287361251262as="
sbIssuerName = C.pack "owner"

sbinfo = SBInfo sbNamespace sbIssuerName sbIssuerKey 
message = C.pack "Hello from Haskell"

main = do
  sbContext <- sbContext sbinfo
  enQueueBS queueName message sbContext
  res <- deQueue queueName 30 sbContext
  print res

see examples (available as a part of distribution) for a more detailed example.

Synopsis

Documentation

data QLockedMsgInfo Source

QLockedMsgInfo provides Information of the locked message from a queue.

Instances

Pushing data to Queue

enQueueBS :: String -> ByteString -> SBContext -> IO () Source

publish a message containing ByteString to queue.

The following publishes a strict bytestring bs to queue q\

enQueueBS q bs ctx

enQueueLBS :: String -> ByteString -> SBContext -> IO () Source

publish a message containing ByteString to queue

The following publishes a lazy bytestring ,lbs, to queue q,

enQueueLBS q lbs  ctx

Reading data from Queue

deQueue :: String -> Int -> SBContext -> IO ByteString Source

Reads and deletes the message from a queue.

In order to destructively read the latest message from the queue (with a time out of n seconds),

deQueue queueName n context

Note that the timeout can be at the most 55 seconds. This silently ignores the timeouts greater than 55

peekLockQueue :: String -> Int -> SBContext -> IO (LockedMsgInfo, ByteString) Source

Peek Lock Message from a Queue. Non-Destructive Read.

Atomically retrieves the next message from a queue and locks it for further processing. The message is guaranteed not to be delivered to other receivers (on the same subscription) during the duration of the lock.

Refer ServiceBus documentation for semantics of the underlying REST API.