Skip to content

Commit fca388c

Browse files
committed
feat(): upgrade WindowsAzure.ServiceBus
1 parent 351d476 commit fca388c

12 files changed

Lines changed: 19 additions & 41 deletions

File tree

‎src/ProjectExtensions.Azure.ServiceBus/Interfaces/ITopicClient.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
namespace ProjectExtensions.Azure.ServiceBus.Interfaces {
44

55
interface ITopicClient {
6-
IAsyncResult BeginSend(IBrokeredMessage message, AsyncCallback callback, object state);
7-
void EndSend(IAsyncResult result);
6+
void Send(IBrokeredMessage message);
87
void Close();
98
}
109
}

‎src/ProjectExtensions.Azure.ServiceBus/ProjectExtensions.Azure.ServiceBus.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
<Version>5.1.3</Version>
163163
</PackageReference>
164164
<PackageReference Include="WindowsAzure.ServiceBus">
165-
<Version>2.4.9</Version>
165+
<Version>6.2.2</Version>
166166
</PackageReference>
167167
</ItemGroup>
168168
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

‎src/ProjectExtensions.Azure.ServiceBus/Sender/AzureBusSender.cs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void SendAsync<T>(T methodObj, object methodState, Action<IMessageSentRes
118118
logger.Debug("sendAction BeginSend Type={0} Serializer={1} MessageId={2}", obj.GetType().FullName, serializer.GetType().FullName, message.MessageId);
119119

120120
// Send the event asynchronously.
121-
defaultClient.BeginSend(message, cb, null);
121+
defaultClient.Send(message);
122122
}
123123
catch (Exception ex) {
124124
failureException = ex;
@@ -127,11 +127,12 @@ public void SendAsync<T>(T methodObj, object methodState, Action<IMessageSentRes
127127
},
128128
(ar) => {
129129
try {
130+
//NOTE: Refactor to no longer call the end action
130131
failureException = null; //we may retry so we must null out the error.
131132
// Complete the asynchronous operation. This may throw an exception that will be handled internally by the retry policy.
132-
logger.Debug("sendAction EndSend Begin Type={0} Serializer={1} MessageId={2}", obj.GetType().FullName, serializer.GetType().FullName, message.MessageId);
133-
defaultClient.EndSend(ar);
134-
logger.Debug("sendAction EndSend End Type={0} Serializer={1} MessageId={2}", obj.GetType().FullName, serializer.GetType().FullName, message.MessageId);
133+
//logger.Debug("sendAction EndSend Begin Type={0} Serializer={1} MessageId={2}", obj.GetType().FullName, serializer.GetType().FullName, message.MessageId);
134+
//defaultClient.EndSend(ar);
135+
//logger.Debug("sendAction EndSend End Type={0} Serializer={1} MessageId={2}", obj.GetType().FullName, serializer.GetType().FullName, message.MessageId);
135136
}
136137
catch (Exception ex) {
137138
failureException = ex;

‎src/ProjectExtensions.Azure.ServiceBus/Wrappers/SubscriptionClientWrapper.cs‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,8 @@ public int PrefetchCount {
3535
}
3636
}
3737

38-
public IAsyncResult BeginReceive(TimeSpan serverWaitTime, AsyncCallback callback, object state) {
39-
return client.BeginReceive(serverWaitTime, callback, state);
40-
}
41-
42-
public IBrokeredMessage EndReceive(IAsyncResult result) {
43-
var msg = client.EndReceive(result);
44-
if (msg != null) {
45-
return new BrokeredMessageWrapper(msg);
46-
}
47-
return null;
38+
public IBrokeredMessage BeginReceive(TimeSpan serverWaitTime) {
39+
return new BrokeredMessageWrapper(client.Receive(serverWaitTime));
4840
}
4941

5042
public void OnMessage(Action<IBrokeredMessage> callback, OnMessageOptions onMessageOptions) {

‎src/ProjectExtensions.Azure.ServiceBus/Wrappers/TopicClientWrapper.cs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ public TopicClientWrapper(TopicClient topicClient) {
1414
this.topicClient = topicClient;
1515
}
1616

17-
public IAsyncResult BeginSend(IBrokeredMessage message, AsyncCallback callback, object state) {
17+
public void Send(IBrokeredMessage message) {
1818
if (!(message is BrokeredMessageWrapper)) {
1919
throw new ArgumentOutOfRangeException("message", "message must be BrokeredMessage for Azure use");
2020
}
21-
return topicClient.BeginSend((message as BrokeredMessageWrapper).GetMessage(), callback, state);
22-
}
23-
24-
public void EndSend(IAsyncResult result) {
25-
topicClient.EndSend(result);
21+
topicClient.Send((message as BrokeredMessageWrapper).GetMessage());
2622
}
2723

2824
public void Close() {

‎src/Samples/PubSubUsingCastleWindsor/PubSubUsingCastleWindsor.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<Version>5.1.3</Version>
104104
</PackageReference>
105105
<PackageReference Include="WindowsAzure.ServiceBus">
106-
<Version>2.4.9</Version>
106+
<Version>6.2.2</Version>
107107
</PackageReference>
108108
</ItemGroup>
109109
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

‎src/Samples/PubSubUsingConfiguration/PubSubUsingConfiguration.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<Version>5.1.3</Version>
9090
</PackageReference>
9191
<PackageReference Include="WindowsAzure.ServiceBus">
92-
<Version>2.4.9</Version>
92+
<Version>6.2.2</Version>
9393
</PackageReference>
9494
</ItemGroup>
9595
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

‎src/Samples/PubSubUsingNinject/PubSubUsingNinject.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<Version>5.1.3</Version>
9898
</PackageReference>
9999
<PackageReference Include="WindowsAzure.ServiceBus">
100-
<Version>2.4.9</Version>
100+
<Version>6.2.2</Version>
101101
</PackageReference>
102102
</ItemGroup>
103103
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

‎src/Samples/PubSubUsingStructureMap/PubSubUsingStructureMap.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
<Version>4.7.1</Version>
101101
</PackageReference>
102102
<PackageReference Include="WindowsAzure.ServiceBus">
103-
<Version>2.4.9</Version>
103+
<Version>6.2.2</Version>
104104
</PackageReference>
105105
</ItemGroup>
106106
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

‎src/Samples/PubSubUsingUnity/PubSubUsingUnity.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
<Version>5.11.10</Version>
101101
</PackageReference>
102102
<PackageReference Include="WindowsAzure.ServiceBus">
103-
<Version>2.4.9</Version>
103+
<Version>6.2.2</Version>
104104
</PackageReference>
105105
</ItemGroup>
106106
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

0 commit comments

Comments
 (0)