Author: jgomes
Date: Wed Sep 16 22:49:16 2009
New Revision: 815996
URL: http://svn.apache.org/viewvc?rev=815996&view=rev
Log:
Additional patch changes from Iddo Shoham for MulticastDiscovery failover
support.
Expanded one change related to changes submitted - refactored the
ResponseRequired flag setting to be set at higher level individual messages,
rather than automatically setting it on Oneway() calls on the transport.
Fixes [AMQNET-184]. (See https://issues.apache.org/activemq/browse/AMQNET-184)
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ResponseCorrelator.cs
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs?rev=815996&r1=815995&r2=815996&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
Wed Sep 16 22:49:16 2009
@@ -264,6 +264,7 @@
messagePull.ConsumerId = this.info.ConsumerId;
messagePull.Destination = this.info.Destination;
messagePull.Timeout = timeout;
+ messagePull.ResponseRequired = false;
Tracer.Debug("Sending MessagePull: " +
messagePull);
lock(closedLock)
@@ -306,7 +307,8 @@
ack.FirstMessageId = message.MessageId;
ack.LastMessageId = message.MessageId;
ack.MessageCount = 1;
-
+ ack.ResponseRequired = false;
+
if(session.Transacted)
{
session.DoStartTransaction();
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs?rev=815996&r1=815995&r2=815996&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
Wed Sep 16 22:49:16 2009
@@ -479,6 +479,7 @@
{
if(AsyncSend)
{
+ message.ResponseRequired = false;
Connection.Oneway(message);
}
else
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs?rev=815996&r1=815995&r2=815996&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
Wed Sep 16 22:49:16 2009
@@ -64,6 +64,7 @@
info.ConnectionId = session.Connection.ConnectionId;
info.TransactionId = transactionId;
info.Type = (int) TransactionType.Begin;
+ info.ResponseRequired = false;
session.Connection.Oneway(info);
}
}
@@ -77,7 +78,7 @@
info.ConnectionId = session.Connection.ConnectionId;
info.TransactionId = transactionId;
info.Type = (int) TransactionType.Rollback;
-
+ info.ResponseRequired = false;
transactionId = null;
session.Connection.Oneway(info);
}
@@ -102,7 +103,7 @@
info.ConnectionId = session.Connection.ConnectionId;
info.TransactionId = transactionId;
info.Type = (int) TransactionType.CommitOnePhase;
-
+ info.ResponseRequired = false;
transactionId = null;
session.Connection.Oneway(info);
}
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs?rev=815996&r1=815995&r2=815996&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
Wed Sep 16 22:49:16 2009
@@ -87,14 +87,14 @@
public ITransport CreateTransport(Uri location)
{
- URISupport.CompositeData cd = URISupport.parseComposite(location);
+ URISupport.CompositeData cd =
URISupport.parseComposite(location);
- if(cd.Components.Length > 0)
- {
- agent.DiscoveryURI = cd.Components[0];
- }
+ if(cd.Components.Length > 0)
+ {
+ agent.DiscoveryURI = cd.Components[0];
+ }
- if(!agent.IsStarted)
+ if(!agent.IsStarted)
{
agent.Start();
}
@@ -113,18 +113,18 @@
}
TcpTransportFactory tcpTransFactory = new
TcpTransportFactory();
- return tcpTransFactory.CreateTransport(new Uri(hostUri
+ location.Query));
+ return tcpTransFactory.CompositeConnect(new Uri(hostUri
+ location.Query));
}
public ITransport CompositeConnect(Uri location)
{
- return CreateTransport(location);
+ return CreateTransport(location);
}
public ITransport CompositeConnect(Uri location, SetTransport
setTransport)
{
- throw new NMSConnectionException("Composite connection
not supported with Discovery transport.");
+ return CreateTransport(location);
}
#endregion
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs?rev=815996&r1=815995&r2=815996&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
Wed Sep 16 22:49:16 2009
@@ -932,7 +932,7 @@
{
Tracer.DebugFormat("Attempting connect to: {0}", uri.ToString());
transport = TransportFactory.CompositeConnect(uri);
-
chosenUri = uri;
+
chosenUri = transport.RemoteAddress;
break;
}
catch(Exception e)
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ResponseCorrelator.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ResponseCorrelator.cs?rev=815996&r1=815995&r2=815996&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ResponseCorrelator.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ResponseCorrelator.cs
Wed Sep 16 22:49:16 2009
@@ -65,10 +65,11 @@
public override void Oneway(Command command)
{
- int commandId = GetNextCommandId();
+ if(0 == command.CommandId)
+ {
+ command.CommandId = GetNextCommandId();
+ }
- command.CommandId = commandId;
- command.ResponseRequired = false;
next.Oneway(command);
}