activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KateMacdonald <kate.helen.macdon...@gmail.com>
Subject NMS NetTxConnection fails to create a session when hostname includes a hyphen
Date Mon, 29 Oct 2012 17:02:52 GMT
All our local machines hostnames include a hyphen, e.g. "Machine-M1234".

This is causing an exception when I try to create a session from a
NetTxConnection as the GuidFromId() method is failing to parse the BrokerId
into a Guid because of this hyphen in the hostname; e.g.
"ID:MACHINE-M123-49158-1351527642035-0:1"

Renaming all our machines isn't an option. Other than downloading the
source, re-implementing this method and recompiling is there anything simple
I can do to fix this issue?

Thanks.

private static Guid GuidFromId(string id)
{
	// Remove the ID: prefix, that's non-unique to be sure
	string resId = id.TrimStart("ID:".ToCharArray());

	// Remaing parts should be host-port-timestamp-instance:sequence
	string[] parts = resId.Split(":-".ToCharArray());

	// We don't use the hostname here, just the remaining bits.
	int a = Int32.Parse(parts[1]);
	short b = Int16.Parse(parts[3]);
	short c = Int16.Parse(parts[4]);
	byte[] d = System.BitConverter.GetBytes(Int64.Parse(parts[2]));

	return new Guid(a, b, c, d);
}



--
View this message in context: http://activemq.2283324.n4.nabble.com/NMS-NetTxConnection-fails-to-create-a-session-when-hostname-includes-a-hyphen-tp4658395.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Mime
View raw message