Permalink
Browse files

Made changes as per code review feedback

  • Loading branch information...
1 parent c422ce0 commit e3831f9bdf65aa09bc40b977a9a2f12d9d310a62 @abnanda1 abnanda1 committed with abnanda1 Dec 17, 2013
@@ -20,6 +20,8 @@ public class ServiceBusConnectionContext : IDisposable
private readonly SubscriptionContext[] _subscriptions;
private readonly TopicClient[] _topicClients;
+ private readonly TraceSource _trace;
+
public object SubscriptionsLock { get; private set; }
public object TopicClientsLock { get; private set; }
@@ -30,8 +32,6 @@ public class ServiceBusConnectionContext : IDisposable
public bool IsDisposed { get; private set; }
- private TraceSource _trace;
-
public ServiceBusConnectionContext(ServiceBusScaleoutConfiguration configuration,
NamespaceManager namespaceManager,
IList<string> topicNames,
@@ -52,7 +52,7 @@ public class ServiceBusConnectionContext : IDisposable
_topicClients = new TopicClient[topicNames.Count];
_trace = traceSource;
-
+
TopicNames = topicNames;
Handler = handler;
ErrorHandler = errorHandler;
@@ -74,11 +74,9 @@ public Task Publish(int topicIndex, Stream stream)
TimeToLive = _configuration.TimeToLive
};
- long messageSize = message.Size / 1024;
-
- if (messageSize > _configuration.MaximumMessageSize)
+ if (message.Size > _configuration.MaximumMessageSize)
{
- _trace.TraceError("Message size {0}KB exceeds the maximum size limit of 256KB : {1}", messageSize, message);
+ _trace.TraceError("Message size {0}KB exceeds the maximum size limit of {1}KB : {2}", message.Size / 1024, _configuration.MaximumMessageSize / 1024, message);
}
return _topicClients[topicIndex].SendAsync(message);
@@ -29,7 +29,7 @@ public ServiceBusScaleoutConfiguration(string connectionString, string topicPref
TopicPrefix = topicPrefix;
TopicCount = 1;
TimeToLive = TimeSpan.FromMinutes(1);
- MaximumMessageSize = 256;
+ MaximumMessageSize = 256 * 1024;
OperationTimeout = null;
}
@@ -81,12 +81,12 @@ public int TopicCount
public TimeSpan IdleSubscriptionTimeout { get; set; }
/// <summary>
- /// Sets the operation timeout for all Service Bus operations
+ /// Gets or Sets the operation timeout for all Service Bus operations
/// </summary>
public TimeSpan? OperationTimeout { get; set; }
/// <summary>
- /// Sets the maximum message size (in KB) that can be sent or received
+ /// Gets or Sets the maximum message size (in bytes) that can be sent or received
/// Default value is set to 256KB which is the maximum recommended size for Service Bus operations
/// </summary>
public int MaximumMessageSize { get; set; }

0 comments on commit e3831f9

Please sign in to comment.