Mat*_*zak 2 c# apache activemq-classic
我希望有人能够帮助我解决与C#中ActiveMQ集成的困难.这是我到目前为止所做的:
using Apache.NMS;
using Apache.NMS.ActiveMQ;
namespace JMSTest {
class Program {
static void Main(string[] args) {
IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
IConnection connection = factory.CreateConnection();
ISession session = connection.CreateSession();
}
}
}
Run Code Online (Sandbox Code Playgroud)
非常基本的东西:只需创建一个连接工厂,然后用它来创建连接,最后创建一个会话.现在,当我执行此代码时,这是抛出的异常:
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at Apache.NMS.ActiveMQ.OpenWire.StringPackageSplitter.StringPackageSplitterEnumerator.System.Collections.IEnumerator.get_Current()
at Apache.NMS.ActiveMQ.OpenWire.OpenWireBinaryWriter.Write(String text)
at Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalString(String value, BinaryWriter dataOut)
at Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionIdMarshaller.LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.LooseMarshalNestedObject(DataStructure o, BinaryWriter dataOut)
at Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, BinaryWriter dataOut)
at Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionInfoMarshaller.LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Marshal(Object o, BinaryWriter ds)
at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command command) : Transport connection error: Index and length must refer to a location within the string.
Parameter name: length
Run Code Online (Sandbox Code Playgroud)
有谁知道发生了什么事?我正在使用Apache ActiveMQ 5.2.0版(从他们的网站上下载).
我尝试了你在这里完全相同的东西,它似乎工作.intraweb上的某个人对您在Nabble上的请求做出回应,确认有一个错误(在哪里?).也许下载最新版本的Apache.NMS/Apache.NMS.ActiveMQ,然后再试一次.
Apache.NMS附带Spring.NET - 这可能是获得Apache.NMS的最佳和最简单的方法.
| 归档时间: |
|
| 查看次数: |
3507 次 |
| 最近记录: |