3 people like it.

MSMQ Functional Client

F# Functional-style API for MSMQ, providing simple client operations like Send, Receive, and Peek.

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
136: 
137: 
138: 
139: 
140: 
141: 
142: 
143: 
144: 
145: 
146: 
147: 
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: 
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: 
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: 
174: 
175: 
176: 
177: 
178: 
179: 
180: 
181: 
182: 
183: 
184: 
185: 
186: 
187: 
188: 
189: 
190: 
191: 
192: 
193: 
194: 
195: 
196: 
197: 
198: 
199: 
200: 
201: 
202: 
203: 
204: 
205: 
206: 
207: 
208: 
209: 
210: 
211: 
212: 
213: 
214: 
215: 
216: 
217: 
218: 
219: 
220: 
221: 
222: 
223: 
224: 
225: 
226: 
227: 
228: 
229: 
230: 
231: 
232: 
233: 
234: 
235: 
236: 
237: 
238: 
239: 
240: 
241: 
242: 
243: 
244: 
245: 
#r "System.Messaging"
#r "System.Transactions"

open FSharp.Control
open System
open System.IO
open System.Messaging
open System.Text
open System.Threading
open System.Transactions

type MsmqPropertyFilter =
| NoProperties
| AllProperties
| IdOnly
| BodyOnly
| IdAndBody
| CustomFilter of MessagePropertyFilter

type MsmqFormatName =
| MsmqDirect of string

type MsmqQueue =
    private {
        MsmqFormatName: MsmqFormatName
        MessageQueue: MessageQueue
    } member queue.FormatName = 
        match queue.MsmqFormatName with
        | MsmqDirect queuePath -> sprintf "DIRECT=OS:%s" queuePath
      member queue.Queue = queue.MessageQueue

type MsmqMessageBody =
| Stream of Stream
| Binary of byte []
| Text of string

type MsmqTransaction =
| Local of MessageQueueTransaction
| Distributed
| Ambient
| AutoCommit

type MsmqMode =
| NonTransactional
| Transactional of MsmqTransaction

type MsmqError =
| MsmqReceiveTimedOut
| MsmqException of MessageQueueException
| NonMsmqException of exn

type ICommittable =
    abstract member Commit: unit -> Result<unit, MsmqError>
    abstract member Abort: unit -> Result<unit, MsmqError>

type MsmqMessage =
| Committed of Message
| Uncommitted of Message * ICommittable

[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>]
module FormatName =
    let direct queue = MsmqDirect queue

[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>]
module Msmq =
    let private getDirectFormatName queuePath =
        sprintf "FORMATNAME:DIRECT=OS:%s" queuePath

    let connect filter = function
    | MsmqDirect queuePath ->   
        let formatName = getDirectFormatName queuePath
        match filter with
        | NoProperties -> 
            new MessageQueue()
        | AllProperties -> 
            let propertyFilter = 
                let pf = MessagePropertyFilter()
                pf.SetAll()
                pf
            new MessageQueue(formatName, MessageReadPropertyFilter = propertyFilter)
        | IdOnly -> 
            new MessageQueue(formatName, MessageReadPropertyFilter = MessagePropertyFilter(Id = true, LookupId = true))
        | BodyOnly -> 
            new MessageQueue(formatName, MessageReadPropertyFilter = MessagePropertyFilter(Body = true))
        | IdAndBody ->
            new MessageQueue(formatName, MessageReadPropertyFilter = MessagePropertyFilter(Id = true, LookupId = true, Body = true))
        | CustomFilter propertyFilter ->
            new MessageQueue(formatName, MessageReadPropertyFilter = propertyFilter)
        |> fun queue -> {MsmqFormatName = MsmqDirect queuePath; MessageQueue = queue}

    let private bodyToStream = function
    | Stream stream -> stream
    | Binary bytes -> new MemoryStream(bytes) :> Stream
    | Text str -> new MemoryStream(UTF8Encoding(false).GetBytes str) :> Stream

    let private sendStream (f: Stream -> Message) (g: Message -> unit) (stream: Stream) =
        use s = stream
        s |> f |> g

    let send mode message (msmq: MsmqQueue) =
        let queue = msmq.Queue
        let sendMessage f =  message |> bodyToStream |> sendStream (fun s -> new Message(BodyStream = s)) f
        match mode with
        | NonTransactional ->
            sendMessage queue.Send
        | Transactional transaction ->
            match transaction with
            | Local tx -> 
                sendMessage (fun message -> queue.Send(message, tx))
            | Distributed -> 
                use tx = new TransactionScope(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled)
                sendMessage (fun message -> queue.Send(message, MessageQueueTransactionType.Automatic))
                tx.Complete()
            | Ambient ->
                sendMessage (fun message -> queue.Send(message, MessageQueueTransactionType.Automatic))
            | AutoCommit ->
                sendMessage (fun message -> queue.Send(message, MessageQueueTransactionType.Single))

    let private tryAsync f =
        async {
            try
                let! message = f
                return Ok message
            with
            | :? MessageQueueException as ex ->
                return
                    if ex.MessageQueueErrorCode <> MessageQueueErrorCode.IOTimeout
                    then Error MsmqReceiveTimedOut
                    else Error (MsmqException ex)
            | ex -> 
                return Error (NonMsmqException ex)
        }

    let receive timeout mode (msmq: MsmqQueue) = 
        let queue = msmq.Queue
        match mode with
        | NonTransactional -> 
            Async.FromBeginEnd ((fun _ -> queue.BeginReceive(timeout)), queue.EndReceive)
        | Transactional tx ->
            match tx with
            | Local transaction -> 
                async { return queue.Receive(timeout, transaction) }
            | Distributed ->
                async {
                    use transaction = new TransactionScope(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled)
                    let message = queue.Receive(timeout, MessageQueueTransactionType.Automatic)
                    transaction.Complete()
                    return message
                }
            | Ambient ->
                async { return queue.Receive(timeout, MessageQueueTransactionType.Automatic) }
            | AutoCommit ->
                async { return queue.Receive(timeout, MessageQueueTransactionType.Single) }
        |> tryAsync

    let peek timeout (msmq: MsmqQueue) = 
        let queue = msmq.Queue
        Async.FromBeginEnd ((fun _ -> queue.BeginPeek(timeout)), queue.EndPeek) 
        |> tryAsync        

    let private tryMsmqOp f =
        try f() |> Ok
        with | :? MessageQueueException as ex -> Error (if ex.MessageQueueErrorCode = MessageQueueErrorCode.IOTimeout then MsmqReceiveTimedOut else MsmqException ex)
             | ex -> Error (NonMsmqException ex)

    let subscribe (cancellation: CancellationToken) mode msmq =
        let timeout = TimeSpan.FromSeconds 10.0        
        let rec getMessages () =
            asyncSeq {
                let! message = 
                    match mode with
                    | NonTransactional -> async.Bind(receive timeout mode msmq, Result.bind (Committed >> Ok) >> async.Return)
                    | Transactional tx ->
                        match tx with
                        | Local transaction -> 
                            let committable = 
                                { new ICommittable with
                                    member __.Commit () = tryMsmqOp transaction.Commit
                                    member __.Abort () = tryMsmqOp transaction.Abort
                                }                                        
                            async.Bind(receive timeout mode msmq, Result.bind (fun message -> Ok (Uncommitted (message, committable))) >> async.Return)
                        | Distributed ->
                            async {
                                let transaction = new TransactionScope(TransactionScopeOption.RequiresNew, TransactionScopeAsyncFlowOption.Enabled)
                                let! result = receive timeout (Transactional Ambient) msmq
                                match result with
                                | Ok message ->
                                    let committable =
                                        {new ICommittable with
                                            member __.Commit () = tryMsmqOp (transaction.Complete >> transaction.Dispose)
                                            member __.Abort () = tryMsmqOp (transaction.Dispose)
                                        }
                                    return Ok <| Uncommitted (message, committable)
                                | Error e -> 
                                    return Error e
                            }
                        | Ambient ->
                            async {
                                use transaction = 
                                    let tx = new MessageQueueTransaction()
                                    tx.Begin()
                                    tx
                                let! result = receive timeout (Transactional Ambient) msmq
                                match result with
                                | Ok message ->
                                    let committable =
                                        {new ICommittable with
                                            member __.Commit () = tryMsmqOp transaction.Commit
                                            member __.Abort () = tryMsmqOp transaction.Dispose
                                        }
                                    return Ok <| Uncommitted (message, committable)
                                | Error e ->
                                    return Error e
                            }
                        | AutoCommit -> async.Bind(receive timeout mode msmq, Result.bind (Committed >> Ok) >> async.Return)

                match message with
                | Ok msg -> yield msg
                | Error _ -> () // Note:  Swallows Errors

                if not cancellation.IsCancellationRequested
                then yield! getMessages ()
            }
        getMessages ()       


// Example Usage:

""".\private$\test.msmq"""
|> FormatName.direct
|> Msmq.connect IdAndBody
|> Msmq.subscribe cancellation.Token (Transactional Distributed)
|> AsyncSeq.iterAsyncParallel (fun message -> 
    async {
        match message with
        | Committed msg -> 
            printfn "%A:  Received Committed Message %A" DateTime.Now msg.Id
        | Uncommitted (msg, tx) -> 
            printfn "%A:  Received Unommitted Message %A" DateTime.Now msg.Id
            match tx.Commit() with
            | Ok _ -> printfn "%A:  Committed Message %A" DateTime.Now msg.Id
            | Error e -> printfn "%A:  Error Committing Message %A -- %A" DateTime.Now msg.Id e
    })
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Control

--------------------
namespace Microsoft.FSharp.Control
namespace System
namespace System.IO
namespace System.Messaging
namespace System.Text
namespace System.Threading
namespace System.Transactions
type MsmqPropertyFilter =
  | NoProperties
  | AllProperties
  | IdOnly
  | BodyOnly
  | IdAndBody
  | CustomFilter of MessagePropertyFilter

Full name: Script.MsmqPropertyFilter
union case MsmqPropertyFilter.NoProperties: MsmqPropertyFilter
union case MsmqPropertyFilter.AllProperties: MsmqPropertyFilter
union case MsmqPropertyFilter.IdOnly: MsmqPropertyFilter
union case MsmqPropertyFilter.BodyOnly: MsmqPropertyFilter
union case MsmqPropertyFilter.IdAndBody: MsmqPropertyFilter
union case MsmqPropertyFilter.CustomFilter: MessagePropertyFilter -> MsmqPropertyFilter
Multiple items
type MessagePropertyFilter =
  new : unit -> MessagePropertyFilter
  member AcknowledgeType : bool with get, set
  member Acknowledgment : bool with get, set
  member AdministrationQueue : bool with get, set
  member AppSpecific : bool with get, set
  member ArrivedTime : bool with get, set
  member AttachSenderId : bool with get, set
  member Authenticated : bool with get, set
  member AuthenticationProviderName : bool with get, set
  member AuthenticationProviderType : bool with get, set
  ...

Full name: System.Messaging.MessagePropertyFilter

--------------------
MessagePropertyFilter() : unit
type MsmqFormatName = | MsmqDirect of string

Full name: Script.MsmqFormatName
union case MsmqFormatName.MsmqDirect: string -> MsmqFormatName
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
type MsmqQueue =
  private {MsmqFormatName: MsmqFormatName;
           MessageQueue: MessageQueue;}
  member FormatName : string
  member Queue : MessageQueue

Full name: Script.MsmqQueue
Multiple items
MsmqQueue.MsmqFormatName: MsmqFormatName

--------------------
type MsmqFormatName = | MsmqDirect of string

Full name: Script.MsmqFormatName
Multiple items
MsmqQueue.MessageQueue: MessageQueue

--------------------
type MessageQueue =
  inherit Component
  new : unit -> MessageQueue + 5 overloads
  member AccessMode : QueueAccessMode
  member Authenticate : bool with get, set
  member BasePriority : int16 with get, set
  member BeginPeek : unit -> IAsyncResult + 4 overloads
  member BeginReceive : unit -> IAsyncResult + 4 overloads
  member CanRead : bool
  member CanWrite : bool
  member Category : Guid with get, set
  member Close : unit -> unit
  ...

Full name: System.Messaging.MessageQueue

--------------------
MessageQueue() : unit
MessageQueue(path: string) : unit
MessageQueue(path: string, accessMode: QueueAccessMode) : unit
MessageQueue(path: string, sharedModeDenyReceive: bool) : unit
MessageQueue(path: string, sharedModeDenyReceive: bool, enableCache: bool) : unit
MessageQueue(path: string, sharedModeDenyReceive: bool, enableCache: bool, accessMode: QueueAccessMode) : unit
val queue : MsmqQueue
member MsmqQueue.FormatName : string

Full name: Script.MsmqQueue.FormatName
MsmqQueue.MsmqFormatName: MsmqFormatName
val queuePath : string
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
member MsmqQueue.Queue : MessageQueue

Full name: Script.MsmqQueue.Queue
MsmqQueue.MessageQueue: MessageQueue
type MsmqMessageBody =
  | Stream of Stream
  | Binary of byte []
  | Text of string

Full name: Script.MsmqMessageBody
Multiple items
union case MsmqMessageBody.Stream: Stream -> MsmqMessageBody

--------------------
type Stream =
  inherit MarshalByRefObject
  member BeginRead : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
  member BeginWrite : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
  member CanRead : bool
  member CanSeek : bool
  member CanTimeout : bool
  member CanWrite : bool
  member Close : unit -> unit
  member CopyTo : destination:Stream -> unit + 1 overload
  member Dispose : unit -> unit
  member EndRead : asyncResult:IAsyncResult -> int
  ...

Full name: System.IO.Stream
union case MsmqMessageBody.Binary: byte [] -> MsmqMessageBody
Multiple items
val byte : value:'T -> byte (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.byte

--------------------
type byte = Byte

Full name: Microsoft.FSharp.Core.byte
Multiple items
union case MsmqMessageBody.Text: string -> MsmqMessageBody

--------------------
namespace System.Text
type MsmqTransaction =
  | Local of MessageQueueTransaction
  | Distributed
  | Ambient
  | AutoCommit

Full name: Script.MsmqTransaction
union case MsmqTransaction.Local: MessageQueueTransaction -> MsmqTransaction
Multiple items
type MessageQueueTransaction =
  new : unit -> MessageQueueTransaction
  member Abort : unit -> unit
  member Begin : unit -> unit
  member Commit : unit -> unit
  member Dispose : unit -> unit
  member Status : MessageQueueTransactionStatus

Full name: System.Messaging.MessageQueueTransaction

--------------------
MessageQueueTransaction() : unit
union case MsmqTransaction.Distributed: MsmqTransaction
union case MsmqTransaction.Ambient: MsmqTransaction
union case MsmqTransaction.AutoCommit: MsmqTransaction
type MsmqMode =
  | NonTransactional
  | Transactional of MsmqTransaction

Full name: Script.MsmqMode
union case MsmqMode.NonTransactional: MsmqMode
union case MsmqMode.Transactional: MsmqTransaction -> MsmqMode
type MsmqError =
  | MsmqReceiveTimedOut
  | MsmqException of MessageQueueException
  | NonMsmqException of exn

Full name: Script.MsmqError
union case MsmqError.MsmqReceiveTimedOut: MsmqError
union case MsmqError.MsmqException: MessageQueueException -> MsmqError
type MessageQueueException =
  inherit ExternalException
  member GetObjectData : info:SerializationInfo * context:StreamingContext -> unit
  member Message : string
  member MessageQueueErrorCode : MessageQueueErrorCode

Full name: System.Messaging.MessageQueueException
union case MsmqError.NonMsmqException: exn -> MsmqError
type exn = Exception

Full name: Microsoft.FSharp.Core.exn
type ICommittable =
  interface
    abstract member Abort : unit -> 'a0
    abstract member Commit : unit -> 'a0
  end

Full name: Script.ICommittable
abstract member ICommittable.Commit : unit -> 'a0

Full name: Script.ICommittable.Commit
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
abstract member ICommittable.Abort : unit -> 'a0

Full name: Script.ICommittable.Abort
type MsmqMessage =
  | Committed of Message
  | Uncommitted of Message * ICommittable

Full name: Script.MsmqMessage
union case MsmqMessage.Committed: Message -> MsmqMessage
Multiple items
type Message =
  inherit Component
  new : unit -> Message + 2 overloads
  member AcknowledgeType : AcknowledgeTypes with get, set
  member Acknowledgment : Acknowledgment
  member AdministrationQueue : MessageQueue with get, set
  member AppSpecific : int with get, set
  member ArrivedTime : DateTime
  member AttachSenderId : bool with get, set
  member Authenticated : bool
  member AuthenticationProviderName : string with get, set
  member AuthenticationProviderType : CryptographicProviderType with get, set
  ...

Full name: System.Messaging.Message

--------------------
Message() : unit
Message(body: obj) : unit
Message(body: obj, formatter: IMessageFormatter) : unit
union case MsmqMessage.Uncommitted: Message * ICommittable -> MsmqMessage
Multiple items
type CompilationRepresentationAttribute =
  inherit Attribute
  new : flags:CompilationRepresentationFlags -> CompilationRepresentationAttribute
  member Flags : CompilationRepresentationFlags

Full name: Microsoft.FSharp.Core.CompilationRepresentationAttribute

--------------------
new : flags:CompilationRepresentationFlags -> CompilationRepresentationAttribute
type CompilationRepresentationFlags =
  | None = 0
  | Static = 1
  | Instance = 2
  | ModuleSuffix = 4
  | UseNullAsTrueValue = 8
  | Event = 16

Full name: Microsoft.FSharp.Core.CompilationRepresentationFlags
CompilationRepresentationFlags.ModuleSuffix: CompilationRepresentationFlags = 4
Multiple items
type RequireQualifiedAccessAttribute =
  inherit Attribute
  new : unit -> RequireQualifiedAccessAttribute

Full name: Microsoft.FSharp.Core.RequireQualifiedAccessAttribute

--------------------
new : unit -> RequireQualifiedAccessAttribute
val direct : queue:string -> MsmqFormatName

Full name: Script.FormatNameModule.direct
val queue : string
val private getDirectFormatName : queuePath:string -> string

Full name: Script.MsmqModule.getDirectFormatName
val connect : filter:MsmqPropertyFilter -> _arg1:MsmqFormatName -> MsmqQueue

Full name: Script.MsmqModule.connect
val filter : MsmqPropertyFilter
val formatName : string
Multiple items
type MessageQueue =
  inherit Component
  new : unit -> MessageQueue + 5 overloads
  member AccessMode : QueueAccessMode
  member Authenticate : bool with get, set
  member BasePriority : int16 with get, set
  member BeginPeek : unit -> IAsyncResult + 4 overloads
  member BeginReceive : unit -> IAsyncResult + 4 overloads
  member CanRead : bool
  member CanWrite : bool
  member Category : Guid with get, set
  member Close : unit -> unit
  ...

Full name: System.Messaging.MessageQueue

--------------------
MessageQueue() : unit
MessageQueue(path: string) : unit
MessageQueue(path: string, accessMode: QueueAccessMode) : unit
MessageQueue(path: string, sharedModeDenyReceive: bool) : unit
MessageQueue(path: string, sharedModeDenyReceive: bool, enableCache: bool) : unit
MessageQueue(path: string, sharedModeDenyReceive: bool, enableCache: bool, accessMode: QueueAccessMode) : unit
val propertyFilter : MessagePropertyFilter
val pf : MessagePropertyFilter
MessagePropertyFilter.SetAll() : unit
val queue : MessageQueue
val private bodyToStream : _arg1:MsmqMessageBody -> Stream

Full name: Script.MsmqModule.bodyToStream
val stream : Stream
val bytes : byte []
Multiple items
type MemoryStream =
  inherit Stream
  new : unit -> MemoryStream + 6 overloads
  member CanRead : bool
  member CanSeek : bool
  member CanWrite : bool
  member Capacity : int with get, set
  member Flush : unit -> unit
  member GetBuffer : unit -> byte[]
  member Length : int64
  member Position : int64 with get, set
  member Read : buffer:byte[] * offset:int * count:int -> int
  ...

Full name: System.IO.MemoryStream

--------------------
MemoryStream() : unit
MemoryStream(capacity: int) : unit
MemoryStream(buffer: byte []) : unit
MemoryStream(buffer: byte [], writable: bool) : unit
MemoryStream(buffer: byte [], index: int, count: int) : unit
MemoryStream(buffer: byte [], index: int, count: int, writable: bool) : unit
MemoryStream(buffer: byte [], index: int, count: int, writable: bool, publiclyVisible: bool) : unit
val str : string
Multiple items
type UTF8Encoding =
  inherit Encoding
  new : unit -> UTF8Encoding + 2 overloads
  member Equals : value:obj -> bool
  member GetByteCount : chars:string -> int + 2 overloads
  member GetBytes : chars:char * charCount:int * bytes:byte * byteCount:int -> int + 2 overloads
  member GetCharCount : bytes:byte * count:int -> int + 1 overload
  member GetChars : bytes:byte * byteCount:int * chars:char * charCount:int -> int + 1 overload
  member GetDecoder : unit -> Decoder
  member GetEncoder : unit -> Encoder
  member GetHashCode : unit -> int
  member GetMaxByteCount : charCount:int -> int
  ...

Full name: System.Text.UTF8Encoding

--------------------
UTF8Encoding() : unit
UTF8Encoding(encoderShouldEmitUTF8Identifier: bool) : unit
UTF8Encoding(encoderShouldEmitUTF8Identifier: bool, throwOnInvalidBytes: bool) : unit
val private sendStream : f:(Stream -> Message) -> g:(Message -> unit) -> stream:Stream -> unit

Full name: Script.MsmqModule.sendStream
val f : (Stream -> Message)
val g : (Message -> unit)
val s : Stream
val send : mode:MsmqMode -> message:MsmqMessageBody -> msmq:MsmqQueue -> unit

Full name: Script.MsmqModule.send
val mode : MsmqMode
val message : MsmqMessageBody
val msmq : MsmqQueue
property MsmqQueue.Queue: MessageQueue
val sendMessage : ((Message -> unit) -> unit)
val f : (Message -> unit)
MessageQueue.Send(obj: obj) : unit
MessageQueue.Send(obj: obj, label: string) : unit
MessageQueue.Send(obj: obj, transactionType: MessageQueueTransactionType) : unit
MessageQueue.Send(obj: obj, transaction: MessageQueueTransaction) : unit
MessageQueue.Send(obj: obj, label: string, transactionType: MessageQueueTransactionType) : unit
MessageQueue.Send(obj: obj, label: string, transaction: MessageQueueTransaction) : unit
val transaction : MsmqTransaction
val tx : MessageQueueTransaction
val message : Message
val tx : TransactionScope
Multiple items
type TransactionScope =
  new : unit -> TransactionScope + 7 overloads
  member Complete : unit -> unit
  member Dispose : unit -> unit

Full name: System.Transactions.TransactionScope

--------------------
TransactionScope() : unit
TransactionScope(scopeOption: TransactionScopeOption) : unit
TransactionScope(transactionToUse: Transaction) : unit
TransactionScope(scopeOption: TransactionScopeOption, scopeTimeout: TimeSpan) : unit
TransactionScope(scopeOption: TransactionScopeOption, transactionOptions: TransactionOptions) : unit
TransactionScope(transactionToUse: Transaction, scopeTimeout: TimeSpan) : unit
TransactionScope(scopeOption: TransactionScopeOption, transactionOptions: TransactionOptions, interopOption: EnterpriseServicesInteropOption) : unit
TransactionScope(transactionToUse: Transaction, scopeTimeout: TimeSpan, interopOption: EnterpriseServicesInteropOption) : unit
type TransactionScopeOption =
  | Required = 0
  | RequiresNew = 1
  | Suppress = 2

Full name: System.Transactions.TransactionScopeOption
field TransactionScopeOption.Required = 0
type MessageQueueTransactionType =
  | None = 0
  | Automatic = 1
  | Single = 3

Full name: System.Messaging.MessageQueueTransactionType
field MessageQueueTransactionType.Automatic = 1
TransactionScope.Complete() : unit
field MessageQueueTransactionType.Single = 3
val private tryAsync : f:Async<'a> -> Async<'b>

Full name: Script.MsmqModule.tryAsync
val f : Async<'a>
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val message : 'a
val ex : MessageQueueException
property MessageQueueException.MessageQueueErrorCode: MessageQueueErrorCode
type MessageQueueErrorCode =
  | Base = -1072824320
  | Generic = -1072824319
  | Property = -1072824318
  | QueueNotFound = -1072824317
  | QueueExists = -1072824315
  | InvalidParameter = -1072824314
  | InvalidHandle = -1072824313
  | OperationCanceled = -1072824312
  | SharingViolation = -1072824311
  | ServiceNotAvailable = -1072824309
  ...

Full name: System.Messaging.MessageQueueErrorCode
field MessageQueueErrorCode.IOTimeout = -1072824293
val ex : exn
val receive : timeout:TimeSpan -> mode:MsmqMode -> msmq:MsmqQueue -> Async<'a>

Full name: Script.MsmqModule.receive
val timeout : TimeSpan
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task -> Async<unit>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken

Full name: Microsoft.FSharp.Control.Async

--------------------
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>
static member Async.FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
MessageQueue.BeginReceive() : IAsyncResult
MessageQueue.BeginReceive(timeout: TimeSpan) : IAsyncResult
MessageQueue.BeginReceive(timeout: TimeSpan, stateObject: obj) : IAsyncResult
MessageQueue.BeginReceive(timeout: TimeSpan, stateObject: obj, callback: AsyncCallback) : IAsyncResult
MessageQueue.BeginReceive(timeout: TimeSpan, cursor: Cursor, state: obj, callback: AsyncCallback) : IAsyncResult
MessageQueue.EndReceive(asyncResult: IAsyncResult) : Message
val tx : MsmqTransaction
val transaction : MessageQueueTransaction
MessageQueue.Receive() : Message
MessageQueue.Receive(timeout: TimeSpan) : Message
MessageQueue.Receive(transactionType: MessageQueueTransactionType) : Message
MessageQueue.Receive(transaction: MessageQueueTransaction) : Message
MessageQueue.Receive(timeout: TimeSpan, transactionType: MessageQueueTransactionType) : Message
MessageQueue.Receive(timeout: TimeSpan, transaction: MessageQueueTransaction) : Message
MessageQueue.Receive(timeout: TimeSpan, cursor: Cursor) : Message
MessageQueue.Receive(timeout: TimeSpan, cursor: Cursor, transactionType: MessageQueueTransactionType) : Message
MessageQueue.Receive(timeout: TimeSpan, cursor: Cursor, transaction: MessageQueueTransaction) : Message
val transaction : TransactionScope
val peek : timeout:TimeSpan -> msmq:MsmqQueue -> Async<'a>

Full name: Script.MsmqModule.peek
MessageQueue.BeginPeek() : IAsyncResult
MessageQueue.BeginPeek(timeout: TimeSpan) : IAsyncResult
MessageQueue.BeginPeek(timeout: TimeSpan, stateObject: obj) : IAsyncResult
MessageQueue.BeginPeek(timeout: TimeSpan, stateObject: obj, callback: AsyncCallback) : IAsyncResult
MessageQueue.BeginPeek(timeout: TimeSpan, cursor: Cursor, action: PeekAction, state: obj, callback: AsyncCallback) : IAsyncResult
MessageQueue.EndPeek(asyncResult: IAsyncResult) : Message
val private tryMsmqOp : f:(unit -> 'a) -> 'b

Full name: Script.MsmqModule.tryMsmqOp
val f : (unit -> 'a)
val subscribe : cancellation:CancellationToken -> mode:MsmqMode -> msmq:MsmqQueue -> AsyncSeq<'a>

Full name: Script.MsmqModule.subscribe
val cancellation : CancellationToken
Multiple items
type CancellationToken =
  struct
    new : canceled:bool -> CancellationToken
    member CanBeCanceled : bool
    member Equals : other:CancellationToken -> bool + 1 overload
    member GetHashCode : unit -> int
    member IsCancellationRequested : bool
    member Register : callback:Action -> CancellationTokenRegistration + 3 overloads
    member ThrowIfCancellationRequested : unit -> unit
    member WaitHandle : WaitHandle
    static member None : CancellationToken
  end

Full name: System.Threading.CancellationToken

--------------------
CancellationToken()
CancellationToken(canceled: bool) : unit
Multiple items
type TimeSpan =
  struct
    new : ticks:int64 -> TimeSpan + 3 overloads
    member Add : ts:TimeSpan -> TimeSpan
    member CompareTo : value:obj -> int + 1 overload
    member Days : int
    member Duration : unit -> TimeSpan
    member Equals : value:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member Hours : int
    member Milliseconds : int
    member Minutes : int
    ...
  end

Full name: System.TimeSpan

--------------------
TimeSpan()
TimeSpan(ticks: int64) : unit
TimeSpan(hours: int, minutes: int, seconds: int) : unit
TimeSpan(days: int, hours: int, minutes: int, seconds: int) : unit
TimeSpan(days: int, hours: int, minutes: int, seconds: int, milliseconds: int) : unit
TimeSpan.FromSeconds(value: float) : TimeSpan
val getMessages : (unit -> AsyncSeq<'b>)
val asyncSeq : AsyncSeq.AsyncSeqBuilder

Full name: FSharp.Control.AsyncSeqExtensions.asyncSeq
val message : obj
member AsyncBuilder.Bind : computation:Async<'T> * binder:('T -> Async<'U>) -> Async<'U>
member AsyncBuilder.Return : value:'T -> Async<'T>
val committable : ICommittable
MessageQueueTransaction.Commit() : unit
val __ : ICommittable
abstract member ICommittable.Abort : unit -> 'a0
MessageQueueTransaction.Abort() : unit
field TransactionScopeOption.RequiresNew = 1
val result : obj
TransactionScope.Dispose() : unit
MessageQueueTransaction.Begin() : unit
MessageQueueTransaction.Dispose() : unit
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
property CancellationToken.IsCancellationRequested: bool
module FormatName

from Script
module Msmq

from Script
Multiple items
module AsyncSeq

from FSharp.Control

--------------------
type AsyncSeq<'T> = IAsyncEnumerable<'T>

Full name: FSharp.Control.AsyncSeq<_>
val iterAsyncParallel : action:('T -> Async<unit>) -> source:AsyncSeq<'T> -> Async<unit>

Full name: FSharp.Control.AsyncSeq.iterAsyncParallel
val message : MsmqMessage
val msg : Message
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
Multiple items
type DateTime =
  struct
    new : ticks:int64 -> DateTime + 10 overloads
    member Add : value:TimeSpan -> DateTime
    member AddDays : value:float -> DateTime
    member AddHours : value:float -> DateTime
    member AddMilliseconds : value:float -> DateTime
    member AddMinutes : value:float -> DateTime
    member AddMonths : months:int -> DateTime
    member AddSeconds : value:float -> DateTime
    member AddTicks : value:int64 -> DateTime
    member AddYears : value:int -> DateTime
    ...
  end

Full name: System.DateTime

--------------------
DateTime()
   (+0 other overloads)
DateTime(ticks: int64) : unit
   (+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : unit
   (+0 other overloads)
property DateTime.Now: DateTime
property Message.Id: string
val tx : ICommittable
abstract member ICommittable.Commit : unit -> 'a0

More information

Link:http://fssnip.net/7Vj
Posted:5 years ago
Author:Aaron Eshbach
Tags: asyncseq , msmq , queue