Merge pull request #205 from m3rlinez/master
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel / MsmqBindingBase.cs
1 //
2 // MsmqBindingBase.cs
3 //
4 // Author: Atsushi Enomoto  <atsushi@ximian.com>
5 //
6 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
15 // 
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
18 // 
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 //
27
28 using System;
29 using System.ServiceModel.Channels;
30 using System.ServiceModel.Description;
31
32 namespace System.ServiceModel
33 {
34         public abstract class MsmqBindingBase : Binding, IBindingRuntimePreferences
35         {
36                 Uri custom_dead_letter_queue;
37                 DeadLetterQueue dead_letter_queue = DeadLetterQueue.System;
38                 bool durable = true, exactly_once = true, use_msmq_trace, use_source_journal;
39                 int max_retry_cycles = 2, receive_retry_count = 5;
40                 long max_recv_msg_size = 0x10000;
41                 ReceiveErrorHandling receive_error_handling;
42                 TimeSpan retry_cycle_delay = TimeSpan.FromMinutes (30), ttl = TimeSpan.FromDays (1);
43
44                 public Uri CustomDeadLetterQueue {
45                         get { return custom_dead_letter_queue; }
46                         set { custom_dead_letter_queue = value; }
47                 }
48
49                 public DeadLetterQueue DeadLetterQueue {
50                         get { return dead_letter_queue; }
51                         set { dead_letter_queue = value; }
52                 }
53
54                 public bool Durable {
55                         get { return durable; }
56                         set { durable = value; }
57                 }
58
59                 public bool ExactlyOnce {
60                         get { return exactly_once; }
61                         set { exactly_once = value; }
62                 }
63
64                 public long MaxReceivedMessageSize {
65                         get { return max_recv_msg_size; }
66                         set { max_recv_msg_size = value; }
67                 }
68
69                 public int MaxRetryCycles {
70                         get { return max_retry_cycles; }
71                         set { max_retry_cycles = value; }
72                 }
73
74                 public ReceiveErrorHandling ReceiveErrorHandling {
75                         get { return receive_error_handling; }
76                         set { receive_error_handling = value; }
77                 }
78
79                 public int ReceiveRetryCount {
80                         get { return receive_retry_count; }
81                         set { receive_retry_count = value; }
82                 }
83
84                 public TimeSpan RetryCycleDelay {
85                         get { return retry_cycle_delay; }
86                         set { retry_cycle_delay = value; }
87                 }
88
89                 public TimeSpan TimeToLive {
90                         get { return ttl; }
91                         set { ttl = value; }
92                 }
93
94                 public override string Scheme {
95                         get {
96                                 foreach (BindingElement be in CreateBindingElements ())
97                                         if (be is TransportBindingElement)
98                                                 return ((TransportBindingElement) be).Scheme;
99                                 throw new Exception ("INTERNAL ERROR: no TransportBindingElement was created.");
100                         }
101                 }
102
103                 public bool UseMsmqTracing {
104                         get { return use_msmq_trace; }
105                         set { use_msmq_trace = value; }
106                 }
107
108                 public bool UseSourceJournal {
109                         get { return use_source_journal; }
110                         set { use_source_journal = value; }
111                 }
112
113                 [MonoTODO]
114                 bool IBindingRuntimePreferences.ReceiveSynchronously {
115                         get { throw new NotImplementedException (); }
116                 }
117         }
118 }