带有.Net Core 2.2的WebsphereMQ

编程入门 行业动态 更新时间:2024-10-23 11:20:54
本文介绍了带有.Net Core 2.2的WebsphereMQ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用.Net Core 2.2连接到WebsphereMQ队列。 我真的对如何执行此操作感到困惑。在显示我正在尝试(和失败)的内容之前,我需要澄清一下:

I'm trying to connect to a WebsphereMQ queue using .Net Core 2.2. I'm really confused on how to do this. I would like some clarification before showing what I'm trying (and failing):

  • 我应该使用哪个lib以及如何获取它? (NMS?AMQP?WebsphereClient?)
    • 我已经看到一些示例,这些示例通常使用安装WebsphereMQ(???)时附带的某些DLL。那是对的吗?我需要安装WebsphereMQ吗? (现在我将其放在可以连接到所需队列的远程服务器中)。

    到目前为止,我一直在尝试安装 WebSphereMQClient 并尝试使用以下代码连接到队列:

    What I have tried so far was installing the WebSphereMQClient and trying to connect to the queue with the following code:

    public void StartListener() { try { var xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var cf = xff.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, WebsphereMqHost); cf.SetIntProperty(XMSC.WMQ_PORT, WebsphereMqPort); cf.SetStringProperty(XMSC.WMQ_CHANNEL, WebsphereMqChannel); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, WebsphereMqQueueManager); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); var conn = cf.CreateConnection(); var sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge); var queue = sess.CreateQueue(QueueName); var consumer = sess.CreateConsumer(queue); consumer.MessageListener = OnWebsphereMsg; conn.Start(); } catch (Exception e) { _logger.LogError(e); } }

    但第一行出现例外:

    System.Exception: Fatal error. Failed to initialize XMSFactoryFactory ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'IBM.XMS.Client.Impl.XmsFactoryFactoryImpl' threw an exception. ---> System.TypeInitializationException: The type initializer for 'IBM.XMS.Util.Tr' threw an exception. ---> System.TypeInitializationException: The type initializer for 'IBM.XMS.Util.ConfigMgr' threw an exception. ---> System.MissingMethodException: Method not found: 'System.AppDomainSetup System.AppDomain.get_SetupInformation()'. at IBM.XMS.Util.ConfigMgr..cctor() --- End of inner exception stack trace --- at IBM.XMS.Util.Tr.ResolveTraceSpec() at IBM.XMS.Util.Tr.LoadTraceConfig() at IBM.XMS.Util.Tr..cctor() --- End of inner exception stack trace --- at IBM.XMS.Util.Tr.Register(Type aClass, String group, String resourceBundleName) at IBM.XMS.Client.Impl.XmsFactoryFactoryImpl..cctor() --- End of inner exception stack trace --- at IBM.XMS.Client.Impl.XmsFactoryFactoryImpl.GetClientFactory(Int32 connectionType) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at IBM.XMS.XMSFactoryFactory.GetXmsFactory(Int32 connectionType) --- End of inner exception stack trace --- at IBM.XMS.XMSFactoryFactory.GetXmsFactory(Int32 connectionType) at IBM.XMS.XMSFactoryFactory.GetInstance(Int32 connectionType) at MyApp.Integrations.Configurations.WebsphereMqIntegrationsManager.StartListener(ListenersEnum listener, Dictionary`2 parameters).

    我注意到WebsphereMqClient不符合.NET Standard。是由于该错误引起的吗?

    I have notice that the WebsphereMqClient is not compliant with .NET Standard. Is this error caused because of it? How can I connect to Websphere with my .NET Core app?

    谢谢,

    推荐答案

    amqmxmsstd.dll是必须使用的库,可以从MQ v9.1.1中获得。以下是信息中心链接,该链接讨论将XMS与Microsoft .NET Core一起使用。 将XMS与Microsoft .NET Core配合使用

    amqmxmsstd.dll is the library that has to be used and it is available from MQ v9.1.1. Following is the infocenter link which talks about using XMS with Microsoft .NET Core. Using XMS with Microsoft .NET Core

    您需要同时使用amqmdnetstd.dll和amqmxmsstd.dll来开发XMS .NET应用程序,并且这两个dll都使用.NET Standard.Following信息中心链接介绍了用于构建这些库的框架。 为.NET Standard安装IBM MQ类

    You would need both amqmdnetstd.dll and amqmxmsstd.dll for developing XMS .NET applications and both these dll's are built using .NET Standard.Following infocenter link talks about the framework used to build these libraries. Installing IBM MQ classes for .NET Standard

    正如Josh指出的那样,您可以使用MQ Redist客户端来获取库。 从 IBM MQ Redist客户端

    As Josh pointed out,you can use MQ Redist client to get libraries. Download "9.1.1.0-IBM-MQC-Redist-Win64" from IBM MQ Redist clients

更多推荐

带有.Net Core 2.2的WebsphereMQ

本文发布于:2023-11-07 11:15:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566300.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Core   Net   WebsphereMQ

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!