diff --git "a/formatted_data.jsonl" "b/formatted_data.jsonl"
new file mode 100644--- /dev/null
+++ "b/formatted_data.jsonl"
@@ -0,0 +1,2542 @@
+{"text": "### Human: On my team at work, we use the IBM MQ technology a lot for cross-application communication. I've seen lately on Hacker News and other places about other MQ technologies likeRabbitMQ. I have a basic understanding of what it is (a commonly checked area to put and get messages), but what I want to know what exactly is it good at? How will I know where I want to use it and when? Why not just stick with more rudimentary forms of interprocess messaging?### Assistant: All the explanations so far are accurate and to the point - but might be missing something: one of the main benefits of message queueing: resilience.Imagine this: you need to communicate with two or three other systems. A common approach these days will be web services which is fine if you need an answers right away.However: web services can be down and not available - what do you do then? Putting your message into a message queue (which has a component on your machine/server, too) typically will work in this scenario - your message just doesn't get delivered and thus processed right now - but it will later on, when the other side of the service comes back online.So in many cases, using message queues to connect disparate systems is a more reliable, more robust way of sending messages back and forth. It doesn't work well for everything (if you want to know thecurrentstock price for MSFT, putting that request into a queue might not be the best of ideas) - but in lots of cases, like putting an order into your supplier's message queue, it works really well and can help ease some of the reliability issues with other technologies.\n"}
+{"text": "### Human: I am trying to develop a JMSstandalone applicationto read and write to a Queue on MQSeries.\nMy boss asked me to usepure java JMS(not ibm.mq lib) to do that.Here is the information that need to make the jms connection:mq.hostname=10.10.10.10\n mq.channel=API.CLIENTCHL\n mq.queueManager=MQPETAPI\n mq.port=1422Do you know how to do that Or do you have any link that teach me to do that.### Assistant: The issue here is the requirement that \"My boss asked me to use pure java JMS (not ibm.mq lib) to do that.\" JMS is a specification and each implementation must comply with the API and the semantics, but is free to do whatever they want at a low level. It is always necessary to use the implementation classes provided by the transport vendor. Therefore if you use WebSphere MQ as the transport, you will need to use the IBM MQ JMS classes to write a JMS application.That said, if you stick with pure JMS API calls you would be able to plug in any transport vendor's classes. This is what is usually intended when you are given requirements such as that mentioned in the original post.There's an article describing exactly what you are looking to do calledRunning a standalone Java application on WebSphere MQ V6.0It uses only the JMS API and it uses JNDI in a local file system (a .bindings file). By swapping out the IBM JMS classes for another vendor and using their JNDI tools you would be able to plug in any JMS transport without changing your code using this approach.If you want to do the same thing without JNDI, look at the sample programs provided with the MQ client install where you obtained your Java classes. In a UNIX/Linux system these are in/opt/mqm/sampand on Windows they are ininstall_dir/tools/jms/samples. TheSimpleRequestor.javasample has the following code for initializing your connection factory without JNDI:try {\n // Create a connection factory\n JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\n JmsConnectionFactory cf = ff.createConnectionFactory();\n\n // Set the properties\n cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, \"localhost\");\n cf.setIntProperty(WMQConstants.WMQ_PORT, 1414);\n cf.setStringProperty(WMQConstants.WMQ_CHANNEL, \"SYSTEM.DEF.SVRCONN\");\n cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\n cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, \"QM1\");Because this approach does not use JNDI, you are required to write code that is not transportable across transport vendors. It is IBM WebSphere MQ specific.If you grabbed the MQ jars from somewhere and do not have the full install (and thus do not have the samples) you can download it asSupportPac MQC7. The download is free. In general you should use the latest client, even with a back-level queue manager. Obviously you do not get V7 functionality from a V6 QMgr but the JMS implementation in the V7 client is much improved, even for V6 functionality. If for some reason you really must use the V6 client, you can download it asSupportPacMQC6. Whichever client version you use, make sure to use the corresponding Infocenter.V6 InfocenterV7 InfocenterFinally, the landing page with an index for all the SupportPacs ishere.\n"}
+{"text": "### Human: What is the difference between a message channel and a message queue itself?They're different things. The queue actually holds messages which will be processed (pushed to the listener) in FIFO manner.A channel is a medium through which messages are transmitted.What does that mean exactly? In a book \"Enterprise Integration Patterns\" it says:Connect the applications using a Message Channel, where one application writes information to the channel and the other one reads that information from the channel.Does this mean that this message channel actually abstracts the queue away from the producer and consumer of the message? But it really doesn't right? When a producer has to place a message into a queue, it actually specifies the queue manager and queue names it want's to connect to.There's also the concept of different protocols in channels and different data formats in channels where you have a separate channel for each protocol you're using maybe and maybe a separate channel for each data format (XML, JSON etc).\nThis would facilitate the different queues to pick up from different channels. But why not directly call different queues for different data formats? What exactly is the role of the channel? Is it just a connection?I'm a completely new at MQM. I've just been assigned to this project which involves producing and consuming messages and I'm trying to wrap my mind around this.### Assistant: To expand a bit on Shashi's answer, please keep in mind that the EIP book referenced talks about high level messaging patterns. In that context the authors needed a generic term for the medium by which messages are transferred between two points and chose the word \"channel\".For purposes of the book the achannelconnects any two endpoints that move messages, for any message transport vendor. In this case a channel has attributes that are classes of service and support the various patterns. It may be 1-1, 1-many, many-1, many-many, etc.So for example if it is ZeroMQ, the endpoints are two peer-to-peer nodes and there's no messaging engine between them. For IBM MQ one endpoint is always the queue manager (a type of messaging engine) and the other is an application or another queue manager.Based on this example, it should be obvious thatchannelas used in the book andchannelas defined by any messaging transport are at different levels of abstraction. As used by MQ, achannelis a specific set of configuration parameters that define a communication path and includes such attributes asCONNAME,MAXMSGL, tuning parameters, SSL parameters, etc. Once an MQchannelis successfully started, you can see a running instance of it by displaying the channel status. In the case ofCLUSRCVR,SVRCONN, and (less commonly)RCVRorRQSTRchannels, you may see multiple instances of the same channel active simultaneously.If you are still with me, you may have noticed that the MQ usage of the termchannelalways describes one or more point-to-point network connections whereas the EIP book's usage of the termchannelis roughly translated as \"the thing that moves messages between application endpoints.\" Consider that two applications connected directly to the queue manager using shared memory would be using achannelas defined in EIP butnotas the term is defined by IBM MQ.Based on that example, it should be clear that the EIP version of the termchannelincludes the queue managerandany MQ connections between the queue manager and application endpoints.To sum up:The EIP book'schannelis all messaging infrastructure that isn't one of the application endpoints, and in an MQ context it includes the queue manager and any MQ channels.The IBM MQchannelis a specific configuration defining network connectivity between the queue manager and another queue manager or a client application.I hope this clarifies the terminology rather than confusing things further. I will update based on any comments if needed.\n"}
+{"text": "### Human: If we use JMS request/reply mechanism using \"Temporary Queue\", will that code be scalable?As of now, we don't know if we will supporting 100 requests per second, or 1000s of requests per second.The code below is what I am thinking of implementing. It makes use of JMS in a 'Synchronous' fashion. The key parts are where the 'Consumer' gets created to point a 'Temporary Queue' that was created for this session. I just can't figure out whether using such Temporary Queues is a scalable design.destination = session.createQueue(\"queue:///Q1\");\n producer = session.createProducer(destination);\n tempDestination = session.createTemporaryQueue();\n consumer = session.createConsumer(tempDestination);\n\n long uniqueNumber = System.currentTimeMillis() % 1000;\n TextMessage message = session\n .createTextMessage(\"SimpleRequestor: Your lucky number today is \" + uniqueNumber);\n\n // Set the JMSReplyTo\n message.setJMSReplyTo(tempDestination);\n\n // Start the connection\n connection.start();\n\n // And, send the request\n producer.send(message);\n System.out.println(\"Sent message:\\n\" + message);\n\n // Now, receive the reply\n Message receivedMessage = consumer.receive(15000); // in ms or 15 seconds\n System.out.println(\"\\nReceived message:\\n\" + receivedMessage);Update:I came across another pattern, seethis blogThe idea is to use 'regular' Queues for both Send and Receive. However for 'Synchronous' calls, in order to get the desired Response (i.e. matching the request), you create a Consumer that listens to the Receive queue using a 'Selector'.Steps:// 1. Create Send and Receive Queue.\n // 2. Create a msg with a specific ID\n final String correlationId = UUID.randomUUID().toString();\n final TextMessage textMessage = session.createTextMessage( msg );\n textMessage.setJMSCorrelationID( correlationId );\n\n // 3. Start a consumer that receives using a 'Selector'.\n consumer = session.createConsumer( replyQueue, \"JMSCorrelationID = '\" + correlationId + \"'\" );So the difference in this pattern is that we don't create a new temp Queue for each new request.\nInstead all responses come to only one queue, but use a 'selector' to make sure each request-thread receives the only the response that is cares about.I think the downside here is that you have to use a 'selector'. I don't know yet if that is less preferred or more preferred than earlier mentioned pattern. Thoughts?### Assistant: Regarding the update in your post - selectors are very efficient if performed on the message headers, like you are doing with the Correlation ID.Spring Integrationalso internally does this forimplementing a JMS Outbound gateway.\n"}
+{"text": "### Human: What is the difference between a Websphere Message Broker and a Queue Manager. I guess the queue manager puts messages in the queue, takes messages out of the queue, moves messages to backout queues etc. So what is the job of the broker?Does it sit between the publisher and the Queue Manager or between the consumer and the Queue Manager?### Assistant: Websphere MQ is a software which uses theAMQ(Asynchronous messaging protocol). You can achieve asynchronous messaging between your applications via Websphere MQ, which will make your infrastructure loosely coupled(Applications can keep working even though other applications are down in the infrastructure).But the applications in your infrastructure may not be able to understand each others' message formats, and hence just sending the message to the target application may not be enough. You mayrequire transformationof the message.You can do it by writingyour own program using the Websphere MQ API. \nYour program should be able to do the below things:Pick message from a specific queue (using MQGET)Should be able to understand the message. That is say it's an XML message. Then your program must be able to parse the XML and read the\n data in it.After reading the input message you will make your output message based on the requirements.Then you will either publish the message or put the message in some specific queue(say TargetQ), so that the target application can get\n the message. Target application will then get the message either by\n issuing MQGET on the TargetQ or subscribing to the topic which was\n published from your application.But writing your own program will take a lot of development time and effort and also may be a bit complex.So, IBM provided its own software to do the job, which is\"Websphere Message Broker\".WMB allows you to create programsvery easilyanda lot faster.Appropriate nodes in WMB will do all above steps for you. In fact it provides lot many features than the above steps.Websphere MQ still doesn't have an HTTP listener. But, a message broker does. It allows you to hostweb servicesand have HTTP based flows etc that too in a secure way(Supports SSL).\n"}
+{"text": "### Human: What is the difference between a dead letter Queue and a back out queue?In WebSphere MQ terms and in terms of Application Servers.All J2EE/JEE app servers have a MQ Provider do they also have a construct of a Dead Letter Queue or is that something specific to WebSphere MQ?My understanding of a back out queue is as follows:If MQ is unable to deliver the message to a destination after a specified number of attempts it moves the message to the back out queue.I do not have a clear understanding of a Dead Letter queue.Appreciate any assistance.### Assistant: The dead letter queue was always used in MQSeries (the last time I used MQ) to store messages that arrived at the queue manager but the queue didn't exist.For example, if the message was address to queue managerXand queueY, it would arrive via a channel at managerX.If the receiver channel discovered there was no queueY, it would be placed in the dead letter queue.The backout queue, on the other hand, is more of an application-level thing (at least in terms of MQ). When an MQ client cannot process the message for some reason, it can back it out for later processing (back to it's original queue).If it's backed out too many times (the threshold can be configured), it gets moved to the backout queue.\n"}
+{"text": "### Human: My understanding is that:MDBs (Message Driven Beans) connect via Activation Specification.MDPs (Message Driven POJO) connect via Connection Factory.This diagramfrom IBMis helpful:To me,this explanation from IBMdoes not shed much light on the difference:Connection factory-- used by the application to get connections to the messaging bus.Queue-- used by the application to send and receive messages.Activation specification-- used by the application's message-driven bean to connect to the queue and receive messages.One realdifference I have found is that:Session beans and entity beans [aka MDPs] allow you to send JMS messages and to\n receive themsynchronously, but not asynchronously. To avoid tying up\n server resources, you may prefer not to use blocking synchronous\n receives in a server-side component.To receive messages\n asynchronously, use a message-driven bean[MDB].So the unsatisfying list I have so far is:Use ActivationSpec with an MDB and ConnectionFactory with a POJO (but wait, can POJOsuse ActivationSpec too?)MDB's operate asynchronously. MBP's operate synchronously.My question is: Are there other differences? Can you clarify the difference ?References:Deploying message-driven beans and JMS applications into the Service Integration BusSpring JMS vs MDB### Assistant: @Jeffrey Knight: Let me try to clarify based on my experience.We understand MDB are beans to consume incoming messages. Now there is need to specify what kind of messages, from which destination a particular MDB wants to consume to.MDB is basically a message end point.Prior to JCA compliant MDBs:flow in websphere was :-incoming message --> listened by Message listener --> listener\n ports-->deliver to MDBSo typically a developer would create a MDB and specify message destination details in ejb-jar.xml as follows:-\n javax.jms.Queue\n\njms/QCF\n\n javax.jms.QueueConnectionFactory\n Container\nand a deployer would need to create listener port and associate deployed MDB to the listener port. QueueConnectionFactory specified above is made to create connections to queue.Post JCA compliant MDBs:Post JCA, MDB is treated as a JCA resource. JCA specification incorporated messaging framework APIs as well. Flow in case of JCA is:-incoming message --> listened by Message listener --> Resource Adapter-->deliver to MDBNow since JCA was created to work with any type of resouce be it JDBC, JMS, EIS etc, so it has a generic \"Activation Spec\" way of creating configurations for any adapter. In ra.xml file, it is mentioned what kind of activation spec is needed by that particular adapter to work. Activation spec is not a runtime entity, it is just a configuration details used by resource adapter. In above case JCA adapter will use connection from queue connection factory mentioned in activation spec. So basically queue connection factory in above both cases are same.In case of websphere, you can use either SIB (Service Integration Bus) destinations for messaging OR external software like websphere MQ for messaging.In case of SIB destinations for messaging:-\nSIB has implemented a JCA resource adapter. So MDB using destination on SIB can use activation spec to specify destination details. and resource adapter module can interact with messaging engine and can deliver the messages to MDB.In case of external messaging framework like websphere MQ:-\nSince websphere MQ has not implemented any JCA adapter, so we will need to configure listener port to connect to destinations residing on websphere MQ. It is listener port who will deliver the messages to MDB.In short, both cases use queue connection factory to get queue connection. In one case, it is resource adapter (with configuration information in form of activation spec) used to deliver messages where as in other case it is listener port (bound to queue & factory) used to deliver messages.I hope this clarifies now.\n"}
+{"text": "### Human: I am getting this error while connecting to IBM MQ. I know that this is because of privileges, but is there any way just to check the connection with IBM MQ?Please suggest.### Assistant: The 2035 suggests that your connection is getting to the QMgr. If you had the wrong channel name, host or port you would get back a 2059. The 2035 means that the connection made it to the listener, found a channel of the name that was requested and attempted a connection.If you want to test past this point it will be necessary to either authorize the ID that you are using to connect or to put an authorized ID in the MCAUSER attribute of the channel.For a detailed explanation of how the WMQ security works on client channels, see the WMQ Base Hardening presentation athttp://t-rob.net/links.\n"}
+{"text": "### Human: Our Java app writes to MQ Series queues via a Weblogic JMS Message Bridge. The actual MQ Series connection/queue details are stored in the MQ Series .bindings file on the app server. I've never really got my head around the bindings file and what all the entries mean. Can anyone provide guidance to understand this file?### Assistant: Before addressing the .bindings file, we need to step back a bit and look at JNDI - the Java Naming and Directory Interface - and how it is used by JMS. The Queue, Topic and various types of Connection Factory are all run-time JMS objects with methods and attributes. But you can pre-define them and store them in a registry where the JMS application can retrieve them using JNDI lookups.This is helpful because the objects are like coins in that they have a JMS side and a provider-specific side. On the JMS side, any administered object looks about the same. Regardless of the underlying transport provider, a ConnectionFactory has the same methods and attributes. However, on the provider-specific side, the administered objects look very different from one transport provider to the next. For example, the ConnectionFactory used with a WebSphere MQ transport will have an attribute for the Queue Manager. No other transport provider has a \"queue manager\" so this attribute is only valid in a WMQ context.The two aspects of administered objects are the \"glue\" that allows JMS to work independently of transport provider. In your code you just have to look up a ConnectionFactory and you get an object suitable to perform method calls against. Under the covers, the provider's JMS classes use the provider-specific object attributes to supply context to convert the generic JMS API calls into provider-specific calls. Thus the connection object that you instantiate results in a WMQ CONNECT call which specifies a QMgr name, host, port, channel and a variety of other parameters.OK, I promised to get to the .bindings file. I said previously that the JNDI lookup was against \"a registry\" and that usually means LDAP or similar. But Sun engineered JNDI like JMS in that there is an API that your program uses and an SPI or Service Provider Interface that is used by the registry. So, although JNDIcanbe implemented in LDAP, there is nothing that says itmustbe implemented in LDAP. One of the base implementations that Sun provided right out of the box was to use the local filesystem as the registry. In this implementation, the root context is a file folder. Each context can store either another sub-context (another file folder) or object definitions. Typically there is one folder for the root context and all of the objects are defined at that level. The file that holds the object definitions is...you guessed it... the .bindings file.The objects in the .bindings file are represented in Name/Type/Value triplets. So each .bindings file typically has many objects. Each object has many attributes. Each attribute has a name, a value and the type of variable that holds the value. The best way to get a handle on the .bindings file is to sort it which will put all the objects and their attributes together and make it more human-readable. For a list of possible properties, seethe manual.Of course, the .bindings file is supposed to be a compiled artifact and not intended to be human readable. IBM provides the JMSAdmin tool to generate and read the .bindings file. You can also use WMQ Explorer to manage the administered objects in a .bindings file. These are also discussed in the manual linked above. There is also a (some say) good tutorial in developerWorkshere.\n"}
+{"text": "### Human: I'd like to connect to a Websphere 6.0 MQ via Java. I have already working code for a \"normal\" queue, but now I need to access a new queue which is SSL encrypted (keystore). I have been sent a file called something.jks, which I assume is a certificate I need to store somewhere. I have been searching the net, but I can't find the right information.This is the code I use for the \"normal\" queue. I assume I need to set some property, but not sure which one.MQQueueConnectionFactory connectionFactory = new MQQueueConnectionFactory();\nconnectionFactory.setChannel(channel_);\nconnectionFactory.setHostName(hostname_);\nconnectionFactory.setPort(port_);\nconnectionFactory.setQueueManager(queueManager_);\nconnectionFactory.setTransportType(1);\nconnectionFactory.setSSsetSSLCertStores(arg0)\n\nConnection connection = connectionFactory.createConnection();\nconnection.setExceptionListener(this);\nsession_ = connection.createSession(DEFAULT_TRANSACTED, DEFAULT_ACKMODE);\nconnection.start();\n\njavax.jms.Queue fQueue = session_.createQueue(queue_);\nconsumer = session_.createConsumer(fQueue);### Assistant: Alex Fehners tutorial in developerWorks is a bit old (2005) but has code samples that should work for you.SSL configuration of the Websphere MQ Java/JMS clientYour Java app will authenticate the QMgr based on its certificate. That means the jks file you were provided must have either the QMgr's self-signed certificate or it will have the root certificate of a Certificate Authority that signed the QMgr's certificate. In either case you point to the file using the-Djavax.net.ssl.trustStore=as noted in the article linked above. If the jks has a password, you will need to specify-Djavax.net.ssl.trustStorePassword=as well. Authenticating the QMgr with a truststore isalwaysrequired. The next part may or may not be required.The other piece of the puzzle is that the QMgr may require your app to present a certificate. In other words, the QMgr cert isalwaysauthenticated, whether the app is required to authenticate is optional. If it is then you have what is known as \"mutual authentication\". If the channel that you connect to has been configured withSSLCAUTH(REQUIRED)then mutual auth has been enabled and the QMgr must have your application's self-signed cert or a CA root cert that signed your app's cert in its keystore. Hopefully whoever set up your jks file will have arranged for this already.Assuming mutual auth is required, then your jks will have, in addition to the QMgr's trusted cert, a private cert representing your application. To get the app to fetch the cert and present it to the QMgr, you use the-Djavax.net.ssl.keyStore=and-Djavax.net.ssl.keyStorePassword=parameters. Note these saykeystore whereas the previous parms saidtruststore.My recommendation is to work with the WMQ administrator to set up and test the SSL connection. The first phase should be to test the channel withSSLCAUTH(OPTIONAL). This verifies that the application can resolve and authenticate the QMgr's certificate. Only when you get this working would the WMQ admin then change the channel toSSLCAUTH(REQUIRED)which tests authentication in the reverse direction.I wouldhighlyrecommend that you use the WMQ v7 client for a new application. This is for two reasons: 1) v6 is end-of-life as of Sept 2011; 2) the v7 code has a lot more diagnostic capability built in. The v7 client code is completely compatible with a v6 QMgr and works like the v6 client. You just don't get the v7 functionality. Download the WMQ client code free here:IBM - MQC7: WebSphere MQ V7.0 ClientsI'm running the WMQ Hands-On Security Lab at IMPACT this year and will be posting the scripts and lab guide over the weekend athttp://t-rob.netso check back for that.\n"}
+{"text": "### Human: Can we rename a Queue without deleting and recreating it?### Assistant: It is not possible to rename a WebSphere MQ queue. There are two options:You can define an alias over an existing queue where the alias has the desired name.You can define a new queue with the desired name and move any messages into it from the original queue.In the event that you take the second option, there are a number of tools to move the messages. Two of the more popular tools are mqmon fromSupportPac MO71and the Q program fromSupportPac MA01.\n"}
+{"text": "### Human: i am trying to access MQ queues using JMS. i am getting the belowjava.lang.UnsatisfiedLinkError: no mqjbnd05 in java.library.pathi am passing-Djava.library.path=\"C:\\Program Files\\IBM\\WebSphere MQ\\java\\lib\"as the VM argument while running the program in eclipse. This issue is discussed quite a lot on the net but with out any conclusion. Has anyone resolved this? TIA.### Assistant: As I had to deal with this error myself; and it took me a lot of time to find the right answer, I'd like to share it with the next one, who comes along this thread...Actually the solution to the problem was very simple (at least in my case). It was not related to anyCLASSPATH,java.library.pathor installation issues.I simply forgot to switch theMQConnectionFactoryinto the Client mode.This has to be done, by simply callingcf.setTransportType(WMQConstants.WMQ_CM_CLIENT);orcf.setTransportType(WMQConstants.WMQ_CM_BINDINGS_THEN_CLIENT);or any other connection type, that fits your needs.By default, the ConnectionFactory is in \"Binding\" mode (WMQ_CM_BINDINGS), which is intended for local server installations, as it is is stated in the IBM Documentation:To connect to a queue manager inbindings mode, a WebSphere MQ classes for JMS applicationmust run on the same systemon which the queue manager is running.This transport type is the same as theXMSC_WMQ_CONNECTION_MODE(WMQConstants.WMQ_CONNECTION_MODE) property, when using JNDI or theJmsFactoryFactory.The same should apply to the other ConnectionFactory types:MQQueueConnectionFactory,MQTopicConnectionFactory,MQXAConnectionFactory,MQXAQueueConnectionFactoryandMQXATopicConnectionFactoryCheck the IMB Knowledge Center for more information about the different connection/binding options:https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q031720_.htmhttps://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q030560_.htm\n"}
+{"text": "### Human: I am using Oracle Service Bus(OSB) as the MOM, and the destination URI is a IBM MQ queue. I just want to know which would be the preferred transport. OSB provides 2 adapters for the same, JMS adapter and MQ adapter for transport. Does any one knows what are the PROS and CONS of the same. TIA### Assistant: Typically, sending messages via the native MQI interface will be faster than using JMS. In reality I doubt you will see a real difference, unless you are sending tons of messages per day. However, there are other things to consider than just speed. For example, if you are not familiar with MQI applications the learning curve will be steeper than JMS.JMS header information is mapped to an MQRFH2 header when sent to another JMS destination via MQ. The inclusion of a MQRFH2 header is driven off of the Destination object you create. If the destination is a JMS endpoint then the header is included.I have included a link below that explains how the fields are mapped:Mapping JMS messages onto MQI messages.In reality, unless you are sending millions of messages a day I would assume that the performance of JMS on WebsphereMQ will be more than adequate for your needs. As far as thread blocking goes in request reply I don't think you need to worry about this. By default the reply in WebsphereMQ is consumed by a seperate thread, not the requesting thread.\n"}
+{"text": "### Human: We're working on an application that supports AMQP for queuing. Some of our clients are using Websphere MQ. I'm just wondering at a high level how interchangeable these two protocols are in terms of functionality. I'm usingcelery, which should allow me to abstract out the lower-level stuff as long as I can write a Websphere MQ backend. What I'm trying to figure out is how difficult a challenge this will be.Does Websphere MQ provide a superset of AMQP's functionality? Does either one have any \"features\" that might make my life difficult?### Assistant: UPDATE 23 June 2015IBM has announcedMQ Lightwhich is their implementation of AMQP. theirStatement of Directionsays that they intend to deliver features to allow programs designed to run on MQ Light to run in MQ at some point in the future but have yet to announce when that will be. MQ Light is in open Beta as of this writing.Getting payloads moved between these systems will be relatively straightforward with a simple bridging app that reads off one system and writes to the other. They both have queues and topics and explicit routing is possible.The interesting parts include such fun concepts as...Mapping reply-to destinations. Especially dynamic reply-to destinations.TransactionalityAny kind of routing more complicated than \"pick up off this queue/topic, put to this one. For example a gateway that routes to multiple destinations based on queue name.Message-level security.Mapping identities for connection-level security.No possibility of end-to-end message encryption.So if all you need is on the order of \"get from AMQP:QUEUEA, put to WMQ:QUEUEB\" and transactionality is not important you should have a an easy time of it. Beyond that it depends on exactly what you want to do.\n"}
+{"text": "### Human: Background:I have a relatively old application that uses Websphere MQ for messaging. It runs on WAS (Websphere Application Server) and uses MDBs (Message Driven Beans). I was successfully able to replace all MDBs usingSpring Integration - JMS. My next step is try to see if I can port it out of WAS so that it can run on any other servlet container with a non-IBM JRE (I am trying: apache tomcat). Note that securing channels using SSL is a requirement. I prefer using JNDI.End Goal:To decouple my application from the application server (WAS) and other infrastructure like messaging (MQ). But taking this out of WAS onto tomcat is the first step. Next comes the task of updating my messaging infrastructure with something more scalable. This allows me to update individual components of the infrastructure that my app relies on, one thing at a time (app server, messaging layer, datastore) without disrupting my application too much, as I go.Question:Now, my challenge is to define JNDI resources on tomcat that can access Websphere MQ. I have made some progress on this using non-SSL channels that I defined in the context.xml file like so:\nMy next step is to get this to work with SSL channels. I understand the part that involves setting up the keystores (kdb file and cert generation and exchanging), configuring the SSL channels on the QM etc. I have all that working already. How do I get tomcat to use my keystore, cipher suite etc? Pointers or a working example would be great!Note: I am using Spring Integration 4.2, Websphere MQ v8, Tomcat v9, currently.I must add that I did try everything without the JNDI first. So here's my spring jms non-ssl config without the JNDI, that works:\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n QM_SANDBOX\n \n \n SANDBOX_Q\n \n### Assistant: I think I finally figured out how to pull this off... here's a brief description of the steps. If you need more details let me know.Pre-reqs: \nWebsphere MQ Server installed (at least v 8.0.0.2)\nConfigure the QM, SSL and non-SSL channels, create Qs and all that good stuff you need.\nNeedless to say, you need the Websphere MQ jars. Be mindful of any licensing restrictions.Step 1: Get the direct connection working with no SSL, no JNDI. You will need to use these beans to configure your spring based JMS listeners and JMS Templates etc.\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n QM_SANDBOX\n \n \n SANDBOX_Q\n \nStep 2: Get the direct connection working with SSL, no JNDI. I found setting this up a little tricky.2a. Since I was using a non-IBM JRE, I had to make sure the cipher specs & cipher suites needed to be configured according to the mappings specified here:http://www-01.ibm.com/support/docview.wss?uid=swg1IV66840This obviously means that we at least have to have our Websphere MQ upgraded to 8.0.0.2. In my case I used ECDHE_RSA_AES_256_GCM_SHA384 on the SSL channel and configured the jms beans within application to use TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, like so:\n \n \n \n\n\n \n \n \n \n \n \n\n\n\n \n QM_SANDBOX\n \n \n SANDBOX_Q\n \n2b. Create certs, keystores (kdbs), exchange certs etc. There are many ways to do this. But be mindful that you will need to stash passwords, the key label for the queue manager must be \u2018ibmwebspheremqqmgr\u2019 \u2013 all in lower case, no spaces, (without quotes), the key label must be like \u2018ibmwebspheremquserid\u2019 \u2013 all in lower case, no spaces, (without quotes) where userid is the userid that runs tomcat. If you need more details on exactly how I did it using self signed certs, let me know.2c. Now you have to get the JVM that tomcat runs, to read your keystores. There are many ways but here's how I did it:\nCreate a setenv.bat file in the tomcat bin folder, with the following contents (debugging SSL is optional)set JAVA_OPTS=\"-Djavax.net.ssl.trustStore=C:\\path-to-keystore\\key.jks\" \"-Djavax.net.ssl.trustStorePassword=topsecret\" \"-Djavax.net.ssl.keyStore=C:\\path-to-keystore\\key.jks\" \"-Djavax.net.ssl.keyStorePassword=topsecret\" \"-Djavax.net.debug=ssl\" \"-Dcom.ibm.mq.cfg.useIBMCipherMappings=false\"2d. Start tomcat using the following command:catalina.bat run > ..\\logs\\tomcat.log 2>&1To stop, just press ctrl+c (on windows). Whichever way you do it, make sure that setenv.bat is used during start up. Or use JAVA_OPTS to set the keystore properties.2e. Verify that the using the SSL channel works.Step 3: Get a JNDI connection working with non-SSL, JNDI\nThere are many was to set up JNDI on tomcat. Here's how I did it: Within the web application create a file META-INF/Context.xml with the following contents:\nNow in your spring config, instead of the direct configurations, all you have to do is:\nNote that for brevity, I just didn't use resource references. In case you do, there a few additional steps which are straight forward.Step 4: Now the final step is to use an SSL channel and JNDI. Assuming you have done step 2, this is easy. Modify the META-INF/Context.xml with the following contents:\nNote the line with SCPHS=\"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\". If you need to set other such parameters, see the \"Short Form\" column in this link:https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.ref.dev.doc/q111800_.htm%23jm10910_?lang=enHopefully all this works for you. Good luck!Once this configuration works, sending messages is pretty straight forward. But this is how you can listen for a message on a queue using Spring JMS\nReference:https://docs.spring.io/spring/docs/current/spring-framework-reference/html/jms.htmlStep 1: Use Spring's DefaultMessageListenerContainer and configure your beans in an xml file like so (spring-beans.xml):\n\n\n \n \n\n \n \n \n \n \n \n\nStep 2: Add this to your web.xml\n contextConfigLocation\n /WEB-INF/context/spring-beans.xml\n \n\n\n org.springframework.web.context.ContextLoaderListener\nStep 3: Write a Message Listener class like so:import javax.jms.JMSException;\nimport javax.jms.Message;\nimport javax.jms.MessageListener;\nimport javax.jms.TextMessage;\n\npublic class ExampleListener implements MessageListener {\n\n public void onMessage(Message message) {\n if (message instanceof TextMessage) {\n try {\n System.out.println(((TextMessage) message).getText());\n }\n catch (JMSException ex) {\n throw new RuntimeException(ex);\n }\n }\n else {\n throw new IllegalArgumentException(\"Message must be of type TextMessage\");\n }\n }\n}Alternatively, instead of step 3, if you are using spring integration, you can do something like so:\n \n\n\n \n"}
+{"text": "### Human: Im having a problem on a Spring based webapp that is being deployed to Websphere and interacts with IBM MQ.All is fine until I try some failure tests.While the webapp is up and running, I stop IBM MQ. I then invoke the webapp to send a JMS message out. The webapp hung at the call to JmsTemplate.convertAndSend and the following exception was found in the ffdc directory.Note the JmsTemplate was initialised using the JNDIObjectFactoryBean where it had got the MQ Connection Factory settings from Websphere.Can anyone explain the reason behind the \"Initializaton Failure\" ??[27/01/11 14:29:39:498 GMT] FFDC Exception:java.lang.NoClassDefFoundError SourceId:com.ibm.ws.asynchbeans.J2EEContext.run ProbeId:894 Reporter:com.ibm.ws.asynchbeans.J2EEContext@1280128\njava.lang.NoClassDefFoundError: com.ibm.msg.client.wmq.common.internal.Reason (initialization failure)\n at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1024)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:997)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:63)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.initialise(WMQMessageProducer.java:758)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.(WMQMessageProducer.java:972)\n at com.ibm.msg.client.wmq.internal.WMQSession.createProducer(WMQSession.java:943)\n at com.ibm.msg.client.jms.internal.JmsSessionImpl.createProducer(JmsSessionImpl.java:1162)\n at com.ibm.msg.client.jms.internal.JmsQueueSessionImpl.createSender(JmsQueueSessionImpl.java:131)\n at com.ibm.mq.jms.MQQueueSession.createSender(MQQueueSession.java:148)\n at com.ibm.mq.jms.MQQueueSession.createProducer(MQQueueSession.java:249)\n at com.ibm.ejs.jms.JMSMessageProducerHandle.(JMSMessageProducerHandle.java:132)\n at com.ibm.ejs.jms.JMSSessionHandle.createProducer(JMSSessionHandle.java:1788)\n at org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:968)\n at org.springframework.jms.core.JmsTemplate.createProducer(JmsTemplate.java:949)\n at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:568)\n at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:541)\n at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)\n at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539)\n at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:617)### Assistant: The \"(initialization failure)\" means that the static initializer (\"\") method of the class previously threw an unchecked exception. When this occurs, the JVM marks the class as bad, and subsequent attempts to use or access the class result in NoClassDefFoundError. Search your logs for errors that include \"Reason.\" in the stack trace to find the underlying cause.(In general, the NoClassDefFoundError should include a \"Caused by\" with the exception that occurred in the static initializer, but for some reason, the cause either wasn't present or you didn't include it in your stack trace.)\n"}
+{"text": "### Human: I was digging into the possibilities for Websphere MQ as a data source for spark-streaming becuase it is needed in one of our use case.\nI got to know thatMQTTis the protocol that supports the communication from MQ data structures but since I am a newbie to spark streaming I need some working examples for the same. \nDid anyone try to connect the MQ with spark streaming. Please devise the best way for doing so.### Assistant: So, I am posting here the working code for CustomMQReceiver which connects the Websphere MQ and reads data :public class CustomMQReciever extends Receiver { String host = null;\nint port = -1;\nString qm=null;\nString qn=null;\nString channel=null;\ntransient Gson gson=new Gson();\ntransient MQQueueConnection qCon= null;\n\nEnumeration enumeration =null;\n\npublic CustomMQReciever(String host , int port, String qm, String channel, String qn) {\n super(StorageLevel.MEMORY_ONLY_2());\n this.host = host;\n this.port = port;\n this.qm=qm;\n this.qn=qn;\n this.channel=channel;\n\n}\n\npublic void onStart() {\n // Start the thread that receives data over a connection\n new Thread() {\n @Override public void run() {\n try {\n initConnection();\n receive();\n }\n catch (JMSException ex)\n {\n ex.printStackTrace();\n }\n }\n }.start();\n}\npublic void onStop() {\n // There is nothing much to do as the thread calling receive()\n // is designed to stop by itself isStopped() returns false\n}\n\n /** Create a MQ connection and receive data until receiver is stopped */\nprivate void receive() {\n System.out.print(\"Started receiving messages from MQ\");\n\n try {\n\n JMSMessage receivedMessage= null;\n\n while (!isStopped() && enumeration.hasMoreElements() )\n {\n\n receivedMessage= (JMSMessage) enumeration.nextElement();\n String userInput = convertStreamToString(receivedMessage);\n //System.out.println(\"Received data :'\" + userInput + \"'\");\n store(userInput);\n }\n\n // Restart in an attempt to connect again when server is active again\n //restart(\"Trying to connect again\");\n\n stop(\"No More Messages To read !\");\n qCon.close();\n System.out.println(\"Queue Connection is Closed\");\n\n }\n catch(Exception e)\n {\n e.printStackTrace();\n restart(\"Trying to connect again\");\n }\n catch(Throwable t) {\n // restart if there is any other error\n restart(\"Error receiving data\", t);\n }\n }\n\n public void initConnection() throws JMSException\n{\n MQQueueConnectionFactory conFactory= new MQQueueConnectionFactory();\n conFactory.setHostName(host);\n conFactory.setPort(port);\n conFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);\n conFactory.setQueueManager(qm);\n conFactory.setChannel(channel);\n\n\n qCon= (MQQueueConnection) conFactory.createQueueConnection();\n MQQueueSession qSession=(MQQueueSession) qCon.createQueueSession(false, 1);\n MQQueue queue=(MQQueue) qSession.createQueue(qn);\n MQQueueBrowser browser = (MQQueueBrowser) qSession.createBrowser(queue);\n qCon.start();\n\n enumeration= browser.getEnumeration();\n }\n\n @Override\npublic StorageLevel storageLevel() {\n return StorageLevel.MEMORY_ONLY_2();\n}\n}\n"}
+{"text": "### Human: The application I am working on needs to communicate to an IBM MQ server in a remote location. We currently have a working system using active MQ which uses a broker, and a bridge to connect to this remote IBM MQ server and is working fine.Due to some new enhancement, we are now trying to achieve the same using IBM client jars instead of Active MQ.The problem I am facing is that I can connect to the remote server's inboundQ and send messages.But I am always receiving null from the remote servers outbound Queue. But I have no way to check if the messages are received at the remote location. But the same message if sending through the old ActiveMQ system will get a response from remote MQ server.Old Active MQ internally uses the bridge to connect to remote IBM MQ server which is configured exactly like the new code I am using.I have tried multiple codes from internet and stack overflow itself and always I am able to connect but not getting any responses.Also, I get no errors or exceptions while trying to send or receive from remote IBM MQ.I will paste a sample code which I am trying to get to work. I have changed some configuration values in the code.My doubts are the following.All I am doing for this is copying IBM MQ client jars into the application and using the code to send messages to remote MQ. I have not installed any other application. Will such a system work or should there always be some intermediate program like active MQ?The same code is able to send and receive from an IBM MQ server which I installed in our local network but fails to get a response from the remote server? This leads me to believe if I am missing anything in configuration ? should anything else be configured other than in code?I see no errors or exceptions. Always message is sent but the response is null. I have not seen the usage of any username-password or public-private key authentication. Is there any authentication used normally to check the source. ?I am using IBM MQ client 5.3 version which I know is old. But used that since they working active MQ setup uses the same and is working correctly. I have no way of knowing which version on IBM MQ server is present on the remote machine. Is there a problem if we use a different client MQ version than the version of server MQ version. ?Sample code which works for me in local environment ie is able to send and receive from an IBM MQ server I have installed in another machine in the local network. The same code will fetch null response when I am trying to use it with remote IBM MQ server.import javax.jms.*;\nimport javax.jms.JMSException;\nimport com.ibm.mq.jms.*;\nimport com.ibm.jms.JMSMessage;\nimport javax.jms.TextMessage;\n\npublic class SendReceive {\n private MQQueueConnectionFactory connectionFactory;\n private MQQueueConnection connection;\n\n private void runTest() {\n try {\n connect();\n connection.start();\n MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n MQQueue queue = (MQQueue) session.createQueue(\"INBOUND_QUEUE\"); /* values replaced with correct values in deployment server */\n MQQueue queue2 = (MQQueue) session.createQueue(\"OUTBOUND_QUEUE\"); /* values replaced with correct values in deployment server */\n MQQueueSender sender = (MQQueueSender) session.createSender(queue); \n\n MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue2);\n\n //TextMessage message = session.createTextMessage(\"yesyesyes\");\n String stt = \"Test Message\"; //\n\n TextMessage message = session.createTextMessage(stt);\n message.setJMSReplyTo(queue2);\n sender.send(message);\n System.out.println(\"Sent: \" + message);\n\n Message msg1 = receiver.receive(5000);\n if(msg1!=null){\n String responseMsg = ((TextMessage) msg1).getText();\n System.out.println(\"Received: \" + responseMsg);\n }else{\n System.out.println(\"Message received is null\");\n }\n }catch(Exception e){\n System.out.println(\"Exception caught in program : \" + e);\n e.printStackTrace();\n }\n }\n\n public boolean connect() {\n boolean connected = false;\n try {\n /* values below are replaced with correct values in deployment server */\n\n connectionFactory = new MQQueueConnectionFactory(); \n connectionFactory.setPort(1515);\n connectionFactory.setHostName(\"192.168.1.23\"); // \n connectionFactory.setQueueManager(\"QCCMGR\");\n connectionFactory.setChannel(\"QCHANNEL\"); \n connectionFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);\n\n connection = (MQQueueConnection) connectionFactory.createQueueConnection();\n connected = true;\n } catch (Exception e) {\n connected = false;\n }\n return connected;\n }\n\n public static void main(String[] args) {\n new SendReceive().runTest();\n }\n\n}### Assistant: MQ v5.3 was released November 29th 2002 and has been out of support since September 28th 2007 (almost 9 years). The version may not have anything to do with your issue but I would strongly suggest that you move to a supported version of the MQ client. Newer MQ client versions can connect to older MQ queue managers. You can download a java only install of MQ 8.0 or MQ 9.0 jar files at the links below:IBM MQ v8.0 ClientIBM MQ v9.0 ClientI read on some old threads that having the sender and receiver on the same session caused problems when a timeout was specified. Try adding another session for the receiver.private void runTest() {\n try {\n connect();\n connection.start();\n MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n MQQueueSession session2 = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n MQQueue queue = (MQQueue) session.createQueue(\"INBOUND_QUEUE\"); /* values replaced with correct values in deployment server */\n MQQueue queue2 = (MQQueue) session2.createQueue(\"OUTBOUND_QUEUE\"); /* values replaced with correct values in deployment server */\n MQQueueSender sender = (MQQueueSender) session.createSender(queue); \n\n MQQueueReceiver receiver = (MQQueueReceiver) session2.createReceiver(queue2);\n\n //TextMessage message = session.createTextMessage(\"yesyesyes\");\n String stt = \"Test Message\"; //\n\n TextMessage message = session.createTextMessage(stt);\n message.setJMSReplyTo(queue2);\n sender.send(message);\n System.out.println(\"Sent: \" + message);\n\n Message msg1 = receiver.receive(5000);\n if(msg1!=null){\n String responseMsg = ((TextMessage) msg1).getText();\n System.out.println(\"Received: \" + responseMsg);\n }else{\n System.out.println(\"Message received is null\");\n }\n }catch(Exception e){\n System.out.println(\"Exception caught in program : \" + e);\n e.printStackTrace();\n }\n }Try taking a JMS trace by adding the following to the execution of the java app:-DMQJMS_TRACE_LEVEL=base\n-DMQJMS_TRACE_DIR=/tracedirectoryex:java -DMQJMS_TRACE_LEVEL=base -DMQJMS_TRACE_DIR=/tracedirectory JavaAppThis should produce a file that I believe ends in.trcin the directory you specify.You can review this for errors that might help point you in the right direction.Suggestions:Try changing your program to force it to send a blank username:connection = (MQQueueConnection) connectionFactory.createQueueConnection(\"\", \"\");Try closing the sender aftersender.sendis calledsender.close();With out further information it is difficult to determine the cause. The more information you can gather the better.\n"}
+{"text": "### Human: can any one guide me on, to get connect with ibm websphere mq by using c#.net, reason was i am trying to push the message in to MQ, kindly can any give me suggestion to connect by using c#.net### Assistant: There is an IBM supplied dll (since v5.3 Fixpack8) on Windows called amqmdnet.dll, which is a .NET assembly providing an IBM supported model for MQSeries. (Reference) It is usually located inC:\\Program Files\\IBM\\WebSphere MQ\\bin\\amqmdnet.dllIf you need more direction, there are several examples on how to communicate with MQ from .NET on CodeProject:http://www.codeproject.com/Articles/12198/IBM-WebSphere-MQ-with-C-GUI-application-that-is-bohttp://www.codeproject.com/Articles/37807/How-to-Setup-a-Websphere-MQ-with-C-NET-GUI-to-Puthttp://www.codeproject.com/Articles/6212/C-and-WebSphere-MQ-formerly-MQSeries-Client-ServerAlso, there's this walkthrough that could be helpful:http://www.c-sharpcorner.com/UploadFile/pk_khuman/AquickstartCsharpWebsphereMQ07112006024017AM/AquickstartCsharpWebsphereMQ.aspx\n"}
+{"text": "### Human: WebSphere Application Server 8.0 is available in a free developer edition, is there also one available for WebSphere MQ?### Assistant: There is a developer edition of Websphere MQ 8 and 9 for Windows and Linux.You can grab it here:https://developer.ibm.com/messaging/mq-downloads/\n"}
+{"text": "### Human: I'm currently working on a project where I need to interface with an IBM system which communicates with the outside world through WebSphere MQ. I need to query the system in a \"request-response\" fashion using queues, and I will be doing this through a queue manager.However, I can't quite get my head around how this works in practical terms.Say I've got multiple instances of the same application which puts a message onto a request queue. The message gets aCorrelationIdandMessageIdupon leaving the application, and aReplyToQueueproperty gets set on each message to make sure that the queue manager knows which queue to put the response onto.However, how does the queue manager operate the response queue? There is no guarantee with regards to the timing of responses, so how is it that the correct response gets back to the application instance which issued the corresponding request?I keep thinking of message queues as a FIFO queue where messages must be picked one by one. However, this would mean that instance A could pick a response meant for instance B. Obviously, this can't be how it works.Then, when I look at the API (com.ibm.mq.MQQueue) I see that to pick a message I have the chance to provide theCorrelationIdandMessageIdof the request message. Does this mean that when I query the queue manager for a message (with these ID's set), the queue manager iterates through the messages in the queue and returns the matching message? This, on the other hand, would mean that we're not talking about a FIFO queue?### Assistant: It is common practice to use CorrelationId to relate request and response messages. It works this way:1) Let's assume there are two queues, a REQQ - request queue where messages are put asking another application, service application, to pick up and process and a RESPQ to which the service application puts replies.2) The requester application (let's call it as REQAPP) puts a request message (REQMSG) to request queue (REQQ). Before sending the message the REQAPP sets ReplyToQ property on the messages to RESPQ. When the request message is sent, the JMS provider updates the sent message with a unique MessageId. The requester application caches this unique MessageId for later use.3) On the other side of the world, the service application retrieves the REQMSG from REQQ, reads the MessageId and ReplyToQ property from that message, processes the request and prepares appropriate response message RESPMSG. It then sets the CorrelationId property of the RESPMSG to the MessageId read from the REQMSG and puts the reply to ReplyToQ.4) The requester application when reading replies, it uses the caches MessageId and sets selection criteria as below to read reply messageGET MESSAGE FROM RESPQ WHERE RESPMSG.CORRELATIONID==REQMSG.MESSAGEIDThis selection criteria makes sure that correct response messages is retrieved. The key here is the service application must set the CorrelationId on the response message to the MessageId of request message.Although Queue is FIFO type, MQ implementation provides message delivery on a Priority basis where messages with high priority are delivered first or FIFO basis where message on top of the queue is delivered first. Messages can also be retrieved using selection criteria as explained in above example.Hope this helped\n"}
+{"text": "### Human: Perhaps I am barking up the wrong tree - but I have a set of services (WebAPI and WCF) that use WebSphere MQ to interact with other systems.This works without issue - until I now need to find a way oflisteningfor messages on one of the queues.Is this even possible, or do I need to go down the windows Service route?### Assistant: You could write a Windows service that is continually calling MQ Get on the queue, and invokes a WCF service to process the message. Or you could write a trigger program (a console application) that MQ will launch for you when a message arrives, that invokes the WCF service.\n"}
+{"text": "### Human: What is the difference between Websphere Message Broker and Websphere MQ? Is there any equivalent terminology for the same in a weblogic environment?\nAlso, strictly speaking, which one of the two (WMB vs WMQ) is an implementation for JMS API?### Assistant: WebSphere MQ is a messaging engine that provides assured delivery of some message/payload. MQ provides a Queue Manager: a server application that hosts Queues (to hold messahes) and Channels & Listeners (to allow Queue Managers to communicate with each other). MQ provides an API interface that implements JMS. It also has a number of APIs native to MQ. As of WebSphere MQ version 7.0.1 it also provides a publish-subscribe engine. WebSphere MQ basically lets you put a message in one place and get that message somewhere else with the smallest chance of the message being lost.WebSphere Message Broker is a program that attempts to provide an any-transport-to-any-transport interface, and an any-language transformation engine. In terms of transports, it provides MQ, JMS (most providers), MQ-FTE, local files, SMTP, FTP/SFTP, HTTP/HTTPS, TCP/TCPSSL, JDBC and probably some other entry hooks I have forgotten. Once the message is in MEssage Broker, you can manipulate that message using ESQL (SQL-like language native to Message Broker), Java, PHP, XSTL. It also contains functionality for message routing, collecting, aggregation, sequencing etc. Message Broker basically allows you to move data from a number of formats (both physical and logical) and manipulate that data before putting it somewhere else, possibly in a different format.\n"}
+{"text": "### Human: JMS Topic and JMS Selector are quite different concept, yet they both can be used by a consumer to get only a subset of the messages.in a PubSub scenario, what are the pro\u2019s and con`s of filtering messages using:Option 1) Publishing everything in a single Topic and consumers uses JMS SelectorOption 2) Subscriber subscribe to one or multiple Topic.Exemple:I am Publishing Client Data Message and Subscriber might want to get only a particular type of client. A client types is defined in different attribute like \u2018ClientGroup\u2019 \u2018ClientSource\u2019 \u2018ClientOrgUnit\u2019 \u2018ClientSize\u2019 etcWhat should I do:1) Create a different Topic for each client typeOR2) On topic and Have each type in a JMS Property and let Subscriber use Selectors?Thank you### Assistant: In general, selection based on topic string should be faster. A side effect of selection on topic in a WebSphere MQ cluster is that messages are not distributed to network nodes that will not consume them. In WMQ V6 message selectors are implemented at the client so the application still gets every message but only sees the ones that match the selection criteria. In WMQ V7 the QMgr will perform the selection but the message must get to the QMgr for that to happen. So if every client is subscribed to the same topic then messages will flow to every QMgr where a client is connected. But if the clients subscribe at granular points in the topic tree, messages will only go to nodes where something has subscribed to them.Apart from distribution, the question of topic or property selection is greatly influenced by taxonomy. The design of the topic tree should provide granularity according to the logical data hierarchy but, unlike a file system, there are no \"soft links\" possible to overlay alternate structures within the tree. It is a simple hierarchy.In many cases there are data elements which if used in the topic tree would break the taxonomy and yet these are needed for selection. These are candidates for properties.Topic elements tend to be more categorical in nature. Items such as region, cost center, department number, branch number tend to fall into topic trees because they serve to partition data according to categorical business requirements.So as a general rule, use topics for those things by which you might summarize transactions. These generally follow the existing and natural taxonomies you already use to define your business. For example, department or cost center are two common elements. If you can easily imagine a report broken down by that value, it may be a topic element. \"Show me all transactions from branch 01234\" is an example. Use properties for things that are attributes of specific transactions rather than categories. Examples here would include color or price. Chances are \"show me all transactions for blue items\" sounds wrong because blue is not a categorical element and therefore is probably not a good candidate for the topic tree. (Unless you are in the paint business!)\n"}
+{"text": "### Human: I have an webapp that is expected to fetch and display data from an External App which is accessible only via messaging (JMS).So, if a user submits a request on a browser, the same HTTP request thread will have to interact with the Messaging system (MQ Series) such that the same request thread can display the data received from the Messaging System.Is there a pattern I can make use of here? I saw some vague references on the net that use \"Correlation ID\" in this way:Msg m = new TextMsg(\"findDataXYZ\");\nString cr_id = m.setCorrelationID(id);\n\nsendQueue.send(m).\n\n// now start listening to the Queue for a msg that bears that specific cr_id\n\nResponse r = receiverQueue.receive(cr_id);Is there something better out there? The other patterns I found expect the response to be received asynchronously.. which is not an option for me, since I have to send the response back on the same HTTP request.### Assistant: The request/reply messaging pattern is useful for your requirement. You typically use a CorrelationId to relate request & reply messages.While sending request message you set JMSReplyTo destination on the message. Typically a temporary queue is used as JMSReplyTo destination. When creating a consumer to receive response use a selector with JMSCorrelationId, something likecons = session.createConsumer(tempDestination,\"JMSCorrelationId=\"+requestMsg.JMSMessageId);At the other end, the application that is processing the request message must use the JMSReplyTo destination to send response. It must also use the MessageId of the request message and set it as CorrelationId of the response message.\n"}
+{"text": "### Human: I want to use JMS to connect to IBM MQ.\nHow do i specify the queuemanager, the channel and other properties ?### Assistant: Using JNDI for connectionFactory/destinations lookups, provide theInitialContextwith the following properties:java.naming.provider.url=:/\njava.naming.factory.initial=com.ibm.mq.jms.context.WMQInitialContextFactory\njava.naming.security.authentication=none\njava.naming.security.credentials=\njava.naming.security.principal=using WAS (Websphere Application Server) queues, the properties would be as follows:java.naming.provider.url=iiop://:\njava.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory\njava.naming.security.authentication=none\njava.naming.security.credentials=\njava.naming.security.principal=The rest would be as follows:Properties config = new Properties();\nconfig.load(new FileInputStream(\"connectionConfig.properties\"));// this file would contain the properties above\nInitialContext context = new InitialContext(config);\nConnectionFactory factory = (ConnectionFactory) context.lookup(\"ConnectionFactory\");// connection factory name\nDestination destination = (Destination) context.lookup(\"destination\");// queue/topic name\n"}
+{"text": "### Human: I am getting an WebSphere MQ Reason code 2195MQRC_UNEXPECTED_ERRORwhen I try to connect to the message flows deployed on the execution group. Can somebody please tell me what exactly does this reason code mean? Queue manager, broker , execution group.. everything is up and running and the ports are also open. I am not getting anything worthwhile on the net.\nPlease advise.### Assistant: The 2195 return code is a high-level exception that is hit when errors are not caught at lower levels in the code. Very often these are generated when some external dependency such as file access or OS resources do not behave as expected and the failure cascades into WMQ.Usually when these errors are thrown, WMQ will produce an FDC file in{WMQ install dir}/errorsto record the event. The FDC file tells which executable failed, the function that was executing during the failure, the environment, user ID and many other details. These can be used by IBM to diagnose the problem but are often useful for WMQ admins as well.As a general rule, for any WMQ error that you cannot easily diagnose, take a look in:{WMQ install dir}/qmgrs/{qmgr name}/errors/AMQERR01.LOG{WMQ install dir}/errors/AMQERR01.LOG{WMQ install dir}/errors/*.FDCWhen reporting an error, please post whether you found any error log entries or new FDC files in these locations and if so what the content of these was. This will make it easier for respondents to to provide answers that are specific and relevant. If you care to update your question with diagnostic info from theerrorsdirectories, I'll be happy to update this response in kind.\n"}
+{"text": "### Human: What is the algorithmic time complexity of applying JMS selectors when consuming messages from a queue, with respect to queue depthn? In particular, is it linear (O(n)) per read? Is it implementation-dependent (on the JMS provider), and does it depend on what fields are being requested?(if implementation dependent, I'm particularly interested in Websphere MQ and Solace's behaviour, but I welcome answers that deal with any particular JMS provider, especially if you have links to documentation describing the complexity!).Motivation: each message has two properties: aninvocationIDand abatchName. A batch consists of several invocations.\u00a0Clients wish to\u00a0consume messages in one of two ways; either byinvocationIDor bybatchName.\u00a0At the point that messages are produced, I don't know by which method they will be consumed.This can be implemented through selectors:invocationID=42OrbatchName=\"reconciliation\"...and I can speed one of these up by using the correlation ID instead of a custom property, but am concerned that the other will remain slow.### Assistant: According to the docs, the messages are searched sequentially. WMQ does however index theMessageIDandCorrelIDfields. The Infocenter describes the behavior as follows:Selecting messages from a queue requires WebSphere MQ to sequentially\n inspect each message on the queue. Messages are inspected until a\n message is found that matches the selection criteria or there are no\n more messages to examine. Therefore, messaging performance suffers if\n message selection is used on deep queues.To optimize message selection on deep queues when selection is based\n on JMSCorrelationID or JMSMessageID, use a selection string of the\n form JMSCorrelationID = ... or JMSMessageID = ... and reference only\n one property.This method offers a significant improvement in performance for\n selection on JMSCorrelationID and offers a marginal performance\n improvement for JMSMessageID.I would love to understand more about the requirement to multiplex queues. A complex selector is going to impact performance on anyone's implementation and the alternative of using multiple open handles with simpler selectors is no different to the app code than using multiple queues. For WMQ of course, dynamic queues or many permanently defined queues is no problem at all. Very often when I see this requirement, it comes from shops that have used certain other transports where performance takes a severe dive with many queues defined and there is an assumption that this is true on WMQ as well. In other cases the requirement has been met with Pub/Sub and durable subscriptions. I'm not suggesting there are no valid cases for this requirement, just wondering what is driving it.\n"}
+{"text": "### Human: I am testing WebSphere on local for development purposes and now i wanted to move to new PC. But i dont remember exactly how i get rid of that error in title. I know there are tons of posts about this error since introduction MQ 7.1 how to disabled security. I remember last time i did runmqsc.exe QM_name -> ALTER CHLAUTH(DISABLED). But its not working anymore?! What else i need to change so anyone can connect to queue?> DIS QMGR CHLAUTH\n> 2 : DIS QMGR CHLAUTH AMQ8408: Display Queue Manager details. \n> QMNAME(QueueManager1) CHLAUTH(DISABLED)Thanks.### Assistant: WebSphere MQ V7.1 introduced CHLAUTH rules which by default banned remote access by privileged users. To turn off CHLAUTH you are correct that you can issueALTER QMGR CHLAUTH(DISABLED)However, you could also very simply allow yourself access on a particular channel as described inCHLAUTH - Allow some privileged admins.IBM MQ V8 introduced Connection Authentication which default demands a password to authenticate a remote privileged user. To make this OPTIONAL (as it is for non-privileged users) you can issueALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS)\n CHCKCLNT(OPTIONAL)rather than turning it off completely withALTER QMGR CONNAUTH(' ')After either of these commands you'll need to issue the following command for the queue manager to be aware of your changes.REFRESH SECURITY TYPE(CONNAUTH)You mention that this is for development purposes which is fair enough, but remember to turn these features on so that you can make your queue manager secure when using it in production!Also, remember that the queue manager error log will provide you with details about why your application got the 2035, for example, \"Channel is Blocked\" for CHLAUTH and \"Missing password\" for CONNAUTH.\n"}
+{"text": "### Human: i am using MQ7 and trying to access a queue with JMS api's. Getting this error.\nHas anyone seen it before? How do i resolve this? TIAException in thread \"main\" com.ibm.msg.client.jms.DetailedJMSException: \n JMSFMQ6312: An exception occurred in the Java(tm) MQI. The Java(tm) MQI has thrown an exception describing the problem. See the linked exception for further information.Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. [3=mqjbnd]Caused by: java.lang.UnsatisfiedLinkError: no mqjbnd in java.library.path### Assistant: Probably a bit late but I had the same problem and found that this can be avoided if you use a different Connection Mode when connecting to a remote Queue. By default theMQConnectionFactoryusesWMQ_CM_BINDINGSas it's connection mode. If you change it toWMQ_CM_CLIENT(or whichever connection mode you like that doesn't require native libraries) you should be fine.@Test\npublic void testMQConnectionMode() throws JMSException {\n MQConnectionFactory cf = new MQConnectionFactory();\n assertThat(cf.getIntProperty(CommonConstants.WMQ_CONNECTION_MODE), is(equalTo(CommonConstants.WMQ_CM_BINDINGS)));\n cf.setIntProperty(CommonConstants.WMQ_CONNECTION_MODE, CommonConstants.WMQ_CM_CLIENT);\n assertThat(cf.getIntProperty(CommonConstants.WMQ_CONNECTION_MODE), is(equalTo(CommonConstants.WMQ_CM_CLIENT)));\n}\n"}
+{"text": "### Human: Hello has anyone ever used Camel with IBM's MQ. We are looking at possibly using the two products together but have no example of the two products working together.### Assistant: I have extensive use of IBM MQ's with camel. There is no issue using both together. I will paste a sample configuration from one of my spring context files leveraging a camel Jms Endpoint, A spring connection factory, and an IBM MQ definition.Camel Routefrom(\"someplace\")\n .to(\"cpaibmmq:queue:myQueueName\");Spring Context\n \n \n \n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n \n \n\n"}
+{"text": "### Human: For days our log has been full of this message2018-06-15 12:19:23 WARN [com.arjuna.ats.arjuna] (Periodic Recovery) Transaction 0:ffff0a983f1e:1f3aa2ff:5a09aa02:d1c08c has 1 heuristic participant(s)!\n2018-06-15 12:19:23 WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=46, bqual_length=36, tx_uid=0:ffff0a983f1e:1f3aa2ff:5a09aa02:d1c08c, node_name=acme_node, branch_uid=0:ffff0a983f1e:1f3aa2ff:5a09aa02:d1c08d, subordinatenodename=null, eis_name=unknown eis name >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@6569a57c >\n2018-06-15 12:19:23 WARN [com.arjuna.ats.arjuna] (Periodic Recovery) Transaction 0:ffff0a983f1e:1f3aa2ff:5a09aa02:d1c08c restored heuristic participant XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=46, bqual_length=36, tx_uid=0:ffff0a983f1e:1f3aa2ff:5a09aa02:d1c08c, node_name=acme_node, branch_uid=0:ffff0a983f1e:1f3aa2ff:5a09aa02:d1c08d, subordinatenodename=null, eis_name=unknown eis name >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@6569a57c >It is always the same Xid. Is there a way to solve this? We are considering gracefully shutting down the application and deleting the files in data/tx-object-store. Is this a good idea?That's with WildFly 11. We have XA transactions set up with Oracle 12c and IBM WebSphere MQ. We are doing XA transactions from a message driven bean to JDBC.### Assistant: I found the answer to the problem in2.4.1. Assumed completeof the transaction guide.If a failure occurs in the transaction environment after the transaction coordinator had told the XAResource to commit but before the transaction log has been updated to remove the participant, then recovery will attempt to replay the commit. In the case of a Serialized XAResource, the response from the XAResource will enable the participant to be removed from the log, which will eventually be deleted when all participants have been committed. However, if the XAResource is not recoverable then it is extremely unlikely that any XAResourceRecovery instance will be able to provide the recovery sub-system with a fresh XAResource to use in order to attempt recovery; in which case recovery will continually fail and the log entry will never be removed.There are two possible solutions to this problem:Rely on the relevant ExpiryScanner to eventually move the log elsewhere. Manual intervention will then be needed to ensure the log can be safely deleted. If a log entry is moved, suitable warning messages will be output.Set the com.arjuna.ats.jta.xaAssumeRecoveryComplete to true. This option is checked whenever a new XAResource instance cannot be located from any registered XAResourceRecovery instance. If false (the default), recovery assumes that there is a transient problem with the XAResourceRecovery instances (e.g., not all have been registered with the sub-system) and will attempt recovery periodically. If true then recovery assumes that a previous commit attempt succeeded and this instance can be removed from the log with no further recovery attempts. This option is global, so needs to be used with care since if used incorrectly XAResource instances may remain in an uncommitted state.\n"}
+{"text": "### Human: I wrote a Java program to connect to Websphere MQ to publish messages. I created a JNDI namespace, connection factory, destinations, and queue manager in Websphere MQ Explore. When I am running my program it is showingClassCastExceptionfor type casting fromstringtoConnectionFactory.Here is my code. Can anyone help resolve this problem.JNDIUtil.javapackage com.tradefinance.jms.util;\n\n//JMS classes\nimport javax.jms.JMSException;\nimport javax.jms.ConnectionFactory;\nimport javax.jms.Destination;\n\n//JNDI classes\nimport javax.naming.InitialContext;\nimport javax.naming.Context;\nimport javax.naming.NamingException;\n\n//Standard Java classes\nimport java.util.Hashtable;\nimport java.util.Properties;\n\n/**\n* \n* A wrapper class for JNDI calls\n*\n*/\npublic class JNDIUtil\n{\n private Context context;\n\n public JNDIUtil(String icf, String url) throws JMSException, NamingException\n {\n Hashtable environment = new Hashtable();\n\n environment.put(Context.INITIAL_CONTEXT_FACTORY, icf ); \n environment.put(Context.PROVIDER_URL, url);\n\n context= new InitialContext( environment );\n\n }\n\n /**\n * @param ObjName Object Name to be retrieved\n * @return Retrieved Object\n * @throws NamingException\n */\n private Object getObjectByName(String ObjName) throws NamingException\n {\n\n return context.lookup(ObjName);\n }\n\n /**\n * @param factoryName Factory Name\n * @return ConnectionFactory object\n * @throws NamingException\n */\n public ConnectionFactory getConnectionFactory(String factoryName) throws NamingException\n {\n return (ConnectionFactory) getObjectByName(factoryName);\n }\n\n /**\n * @param destinationName Destination Name\n * @return ConnectionFactory object\n * @throws NamingException\n */\n public Destination getDestination(String destinationName) throws NamingException\n {\n return (Destination) getObjectByName(destinationName);\n\n }\n}NewPublisher.javapackage com.tradefinance.jms.topics;\n\n//JMS classes\nimport javax.jms.JMSException;\nimport javax.jms.ConnectionFactory;\nimport javax.jms.Connection;\nimport javax.jms.Session;\nimport javax.jms.Destination;\nimport javax.jms.MessageProducer;\nimport javax.jms.TextMessage;\n\n//JNDI classes\nimport javax.naming.NamingException;\n\nimport com.tradefinance.jms.util.JNDIUtil;\n\n/**\n * A class to demonstrate how to a publish to a topic.\n */\npublic class NewsPublisher\n{\n\n public static String icf = \"com.sun.jndi.fscontext.RefFSContextFactory\";\n public static String url = \"file:/C:/JNDI-Directory/\";\n\n public static void main(String[] vars) throws JMSException, NamingException\n {\n\n ConnectionFactory factory = null;\n Connection connection = null;\n Session session = null;\n Destination destination= null; // a destination can be a topic or a queue\n MessageProducer producer= null; \n\n\n try\n { \n\n JNDIUtil jndiUtil= new JNDIUtil(icf,url);\n\n factory= jndiUtil.getConnectionFactory(\"TestQM1ConnectionFactory\");\n\n connection = factory.createConnection(); \n connection.start();\n\n // Indicate a non-transactional session \n boolean transacted = false;\n session = connection.createSession( transacted, Session.AUTO_ACKNOWLEDGE); \n\n destination = jndiUtil.getDestination(\"NewsTopic\");\n\n producer = session.createProducer(destination);\n\n TextMessage message = session.createTextMessage(\"No News is Good News!\");\n producer.send(message); \n\n System.out.println(\"NewsPublisher: Message Publication Completed\");\n\n }\n finally\n {\n // Always release resources\n\n if ( producer!= null )\n producer.close(); \n\n if ( session!= null )\n session.close();\n\n if ( connection!= null )\n connection.close();\n\n } \n } \n}Getting the error on these lines:return (ConnectionFactory) getObjectByName(factoryName); \nin JNDIUtil.java\n\nfactory= jndiUtil.getConnectionFactory(\"TestQM1ConnectionFactory\");\nin NewPublisher.java### Assistant: You are missing someJARsofMQ Clientto get this working. \nI had the same error, and after some further investigation, I ended up with this list of Jars in order to get this working:com.ibm.mq.jmqi.jarcom.ibm.mqjms.jardhbcore.jarfscontext.jarproviderutil.jarcom.ibm.mq.headers.jar\n"}
+{"text": "### Human: I'm thinking about system that will notify multiple consumers about events happening to a population of objects. Every subscriber should be able to subscribe to events happening to zero or more of the objects, multiple subscribers should be able to receive information about events happening to a single object.I think that some message queuing system will be appropriate in this case but I'm not sure how to handle the fact that I'll have millions of the objects - using separate topic for every of the objects does not sound good [or is it just fine?].Can you please suggest approach I should should take and maybe even some open source message queuing system that would be reasonable?Few more details:there will be thousands of subscribers [meaning not plenty of them],subscribers will subscribe to tens or hundreds of objects each,there will be ~5-20 million of the objects,events themselves dont have to carry any message. just information that that object was changed is enough,vast majority of objects will never be subscribed to,events occur at the maximum rate of few hundreds per second,ideally the server should run under linux, be able to integrate with the rest of the ecosystem via http long-poll [using node js? continuations under jetty?].Thanks in advance for your feedback and sorry for somewhat vague question!### Assistant: I can highly recommendRabbitMQ. I have used it in a couple of projects before and from my experience, I think it is very reliable and offers a wide range of configuraions. Basically, RabbitMQ is anopen-source( Mozilla Public License (MPL) ) message broker that implements theAdvanced Message Queuing Protocol (AMQP)standard.As documented on the RabbitMQ web-site:RabbitMQ can potentially run on any platform that Erlang supports, from embedded systems to multi-core clusters and cloud-based servers.... meaning that an operating system like Linux is supported.There is a library for node.js here:https://github.com/squaremo/rabbit.jsIt comes with an HTTP based API for management and monitoring of the RabbitMQ server - including a command-line tool and a browser-based user-interface as well - see:http://www.rabbitmq.com/management.html.In the projects I have been working with, I have communicated with RabbitMQ using C# and two different wrappers,EasyNetQandBurrow.NET. Both are excellent wrappers for RabbitMQ but I ended up being most fan of Burrow.NET as it is easier and more obvious to work with ( doesn't do a lot of magic under the hood ) and provides good flexibility to inject loggers, serializers, etc.I have never worked with the amount of amount of objects that you are going to work with - I have worked with thousands ( not millions ). However, no matter how many objects I have been playing around with, RabbitMQ has always worked really stable and has never been the source to errors in the system.So to sum up - RabbitMQ is simple to use and setup, supports AMQP, can be managed via HTTP and what I like the most - it's rock solid.\n"}
+{"text": "### Human: This is similar to the earlier questionException in thread \u201cmain\u201d java.lang.NoClassDefFoundError: com/ibm/mq/MQExceptionI am facing a similar issue in Linux. I have installed the following:MQSeriesRuntime-7.0.1-3.x86_64.rpmMQSeriesSDK-7.0.1-3.x86_64.rpmMQSeriesJava-7.0.1-3.x86_64.rpmMQSeriesServer-7.0.1-3.x86_64.rpmWhen I create an execution group , I get:java.lang.ClassNotFoundException: com.ibm.mq.MQExceptionI haveCLASSPATHset by using this line of code:export CLASSPATH=$CLASSPATH:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:/opt/mqm/java/lib/com.ibm.mq.jar:.Version of broker is 8.0.0.1 and that of MQ is 7.0.1.3 . Can you please suggest what is wrong? According to the previous answer, am I supposed to install the Client also?### Assistant: You need to review the WMQ Using Java manual for WMQ v7.0.1.*, as you are missing MQ JAR files.For MQ base Java (not MQ/JMS), you need at least 5 MQ JAR files:com.ibm.mq.jarconnector.jarcom.ibm.mq.jmqi.jarcom.ibm.mq.headers.jarcom.ibm.mq.commonservices.jar\n"}
+{"text": "### Human: I've used .NET quite extensively but I'm pretty new to WebSphere MQ. I need to create a .NET application that reads messages off the MQ. I keep seeing articles referencing either the IBM.XMS or amqmdnet libraries.IthinkI'm supposed to be using the IBM.XMS library but what exactly is the difference between these two?Thanks!### Assistant: IBM.XMS is the IBM's implementation of JMS specification in C#. You need to use IBM.XMS if you need JMS style of messaging in C# or any other language of .NET framework. On the other hand amqmdnet is the MQ's native API implementation, something similar to C MQI but it's in C# and is Object oriented. Use amqmdnet if you want MQ native style of messaging.HTH.\n"}
+{"text": "### Human: I'm looking for a solution to run IBM MQ Client under a Windows Docker container. I know that Docker Hub only provides Linux implementations of MQ, however, I do not need full MQ Server capability. Instead, I'm hoping there's a means to install the MQ Client and simply connect to a Channel and Queues defined on another (non-Docker) system. To approach this, I've done the following:Spun up a Windows Docker container running under a command prompt (For proof of concept)Copied in and expanded MQ Client9.0.0.8-IBM-MQC-Win64.zipSilently installed MQ Client (e.g.msiexec /i \"c:\\temp\\Windows\\MSI\\IBM MQ.msi\" /l*v c:\\temp\\install.log /q TRANSFORMS=\"1033.mst\" AGREETOLICENSE=\"yes\" ADDLOCAL=\"Client\").Note: The installation was successful and without errorEstablished required environment variables(MQServer, etc.) and updated paths (classpath, lib, include, etc).Pinged the MQ server system to verify connectivity.I attempted to put a message on a working, verified queue using,amqsputc.exe MYDOCKER.DS.Q. The immediate return code isMQCONNX ended with reason code 2195. Unfortunately,2195is pretty generic and there are no other logs available to review.I understand the differences between running MQ under a VM versus a container, however since I only need Client access, I was hoping MQ Client was lightweight enough to be usable.If MQ Client is not a viable direction, is there an MQ solution which might be doable via a Cloud connection? My legacy application is Windows-based and relies on MQ for job messaging.### Assistant: Instead of installing the Full client install usingmsiexec, I would recommend that you use the IBM MQ Redistributable client install. This is packaged as a simple zip file for windows which you can extract into any location you choose.You can find more information about the Redistributable client on the Knowledge Center pageRedistributable IBM MQ clients.You can download the IBM MQ Redistributable clients using the links below:IBM MQ 9.1 Redistributable client.IBM MQ 9.2 Redistributable client.Note:IBM MQ 8.0 is out of support as of April 30th 2020 and IBM MQ 9.0 is going out of support on September 30th 2021.The IBM Knowledge center pageLimitations and other considerations for redistributable clientsgives these requirements:Windows C runtime librariesYou might have these libraries on your machine already, but if you do not, you need to download and install the following Microsoft C/C++ runtime libraries:Microsoft Visual C++ Redistributable 2008Microsoft Visual C++ Redistributable 2012The download links for the redistributable downloads for each of these libraries can be found atThe latest supported Visual C++ downloads.\n"}
+{"text": "### Human: I am working with WebSphere MQ FTE. While reading a document I came across a sentence that the bridge agent connects to local queue manager through binding mode. What is meant by binding mode in WebSphere MQ?### Assistant: WebSphere MQ was originally created to be a local communication stack that resided on the same server as the applications that used it. In this mode, applications talk to it using Inter Process Communication (IPC). This is where two processes on the same server intercommunicate using shared memory, semaphores and other local communication.Eventually the MQ client was created and allowed applications to communicate with WebSphere MQ over the network. This meant that there were now two modes of communication with the queue manager. The term Client Mode naturally arose to refer to communications using the MQ client. The term Bindings Mode arose to differentiate client mode from native WMQ IPC connections.So when you read that an FTE agent uses bindings mode connections, that means that it runs on the same server as a queue manager and that it communicates with the queue manager using shared memory instead of over the network.Note that with WebSphere MQ File Transfer Edition the licensing refers to \"Client\" and \"Server\" bundles of the products. The Client package is the FTE agents without a copy of WebSphere MQ Server included. The Server package is the same FTE components bundled with a copy of WebSphere MQ Serverand with the ability to connect in bindings mode.\n"}
+{"text": "### Human: As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened,visit the help centerfor guidance.Closed10 years ago.We are facing a choice to use IBM MQ over SFTP for file transfer. I've heard advantages of such approach, but I've never see anyone actually using it for a large files.So main question: how well IMB MQ can handle transfer of large files (up to 100 MB)? Is it stable? It's from mainframe to UNIX server, if it does matter.Thanks a lot.### Assistant: I've used MQ with files up to 8GB in size, without incident. You have to allocate enough space for MQ to manage them, but it works.\n"}
+{"text": "### Human: All documemtation and information shows that we have to have an MQ Series client installed on the machine where we want to use it.Does anyone know of a DLL (or whatever) that allows us to include MQ Series support in a .net project thatdoes notrequire a local install?### Assistant: Updated with info on officialIBM MQ Redistributable Client.Excerpt:From IBM MQ Version 8.0.0, Fix Pack 4, native redistributable client\n runtime libraries are provided for Linux x86-64 and Windows 64-bit\n platforms to make it simple to distribute both applications and the\n required IBM MQ runtime libraries. A third package, which is not\n platform-specific, contains the runtime files that are required for\n the Java\u2122/JMS applications, including the IBM MQ resource adapter for\n JMS applications that are running under an application server.The redistributable client that is supplied with IBM MQ is also a\n non-installed and relocatable image. Maintenance of a redistributable,\n non-installed image, is achieved through replacement; that is, you\n download newer versions of the runtime components when they are\n shipped.A redistributable client implies distributing the required run time\n with an application both inside and outside of your environment.A relocatable client implies putting the files somewhere else other\n than a fixed default location. For example, instead of installing into\n /opt/ installing into /usr/local.A non-installed client implies that you are not required to lay down\n client files, and that these files can be copied as required.The IBM IPLA license agreement is extended for IBM MQ to enable you to\n download a number of additional runtime files fromFix Central.From IBM MQ Version 9.0.5, XMS .NET is shipped as\n part of the redistributable client. XMS .NET requires the IBM MQ .NET\n client (amqmdnet.dll). If unmanaged mode is to be used, then the IBM\n MQ C client libraries are also needed along with amqmdnet.dll.See also theRedistributable clients on Windowspage which explains how to generate packages for redistribution and notes that \"IBM support is only able to provide assistance with the full, unmodified set of files contained within the redistributable client packages.\" This page discusses approaches to distribute the libraries in software that does not need Admin privileges to install.You will need an IBM ID to download the redistributable MQ client from Fix Central but the download is free and when packaged per IBM's instructions is fully supported when connecting to a supported instance of MQ Server.The previous accepted answer of a wrapper over the Java libraries still works however the same caveat applies - if IBM support is required it needs to be IBM's Java client install. Fortunately, this too now comes in a more friendly single-jar package called allclient.jar which isdocumented here. IBM also now documents which jar files can be relocated from the MQ Server installation and still be eligible for full support. This is discussed on theWhat is installed for IBM MQ classes for JMSpage.\n"}
+{"text": "### Human: What are the conditions in whichJMSXDeliveryCountis increased in WebSphere MQ. I need all the scenarios under which it can happen.### Assistant: The JMSXDeliveryCount is incremented every time a message is re-delivered to a consumer. A message could be redelivered:1) A consumer using the Client Acknowledge mode received the message earlier did not call acknowledge() on that message.2) A consumer received the message in a transaction, did not call a commit or called a rollback.EDIT:If the JMS Client is unable to process the message due to some bad JMS headers, then such a message(known as poison message) will not be delivered to application and JMS client will internally rollback that message. In this case also JMSXDeliveryCount is incremented.In IBM MQ, have you set Backout Queue and Backout Threshold properties for the queue from which messages are being retrieved? JMS Client will put such bad messages to the backout queue once the Backout Threshold is reached. This is to avoid same message is retrieved by JMS client again and again thus blocking other good messages from being delivered to application.\n"}
+{"text": "### Human: I am getting the following exception while trying to make a connection with remote MQ from my Java client on my local machine:com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2400' ('MQRC_UNSUPPORTED_CIPHER_SUITE')This is with Java version 1.7, the Oralce JRE, cipher suite 'TLS_RSA_WITH_AES_256_CBC_SHA256' and the following Maven dependencies:\n com.ibm.mq\n allclient\n 9.0.0\n\n\n com.sun.messaging.mq\n fscontext\n 4.4.2\n### Assistant: UpdateUpdating each point provided before with more current information.IBM MQ 9.2 and higher now support TLS1.3. The TLS1.3 ciphersuites now use the standard names which match in both Oracle Java and IBM Java, the use of-Dcom.ibm.mq.cfg.useIBMCipherMappings=falseshould no longer be required of you are able to use a TLS1.3 ciphersuite.The signature algorithmSHA224withRSAis required to use the Oracle Cipher SuiteTLS_RSA_WITH_AES_256_CBC_SHA256. Oracle JRE 1.7.0_171 or later and 1.8.0_162 or later now come with unlimited strength policy files enabled by default and supportSHA224withRSA.TheJCE Unlimited Strength Jurisdiction Policy Filesrequired to use a SHA256 Cipher Suite are now included and enabled by default in the above versions or later.There are three things that impact this:If you want to use Oracle JRE you need to set-Dcom.ibm.mq.cfg.useIBMCipherMappings=false, this will allow IBM MQ to use the Oracle Cipher Suite names likeTLS_RSA_WITH_AES_256_CBC_SHA256The signature algorithm SHA224withRSA is not supported by Oracle JRE 1.7 and is required to use the Oracle Cipher SuiteTLS_RSA_WITH_AES_256_CBC_SHA256. Based on this you would need to go to Oracle JRE 1.8.You will need to obtain and install theJCE Unlimited Strength Jurisdiction Policy Filesto use a SHA256 Cipher Suite.The information above is covered in more detail in my answer to another post \"MQ Error on SSL enabled\".\n"}
+{"text": "### Human: According to the javadoc, if I call receive() on a javax.jms.MessageConsumer it will block indefinitely until a message is produced or until the message consumer is closed.I have a thread in which a receive() is being called. As part of the thread shutdown I am calling close(), but the consumer still blocks in receive() and so the thread will not shutdown. The gist of my code is:public String receiveMessage() {\n...\n...\n System.out.println(\"About to receive\")\n TextMessage message = (TextMessage) consumer.receive();\n System.out.println(\"No longer receiving\")\n...\n...\n}\n\npublic void stop() {\n try {\n if (consumer != null) {\n consumer.close();\n }\n } catch (JMSException ex) {\n throw new IllegalStateException(ex);\n }\n}In the debugger I can see close() being called, but the receive still blocks. If I use the receive() method with a timeout it will block until the timeout expires.Everything looks right to me, hopefully someone can tell me what I am doing wrong.### Assistant: I've sorted the problem, I wasn't doing a connection.start() anywhere. Once I put this in, the MessageConsumer.receive() stopped blocking when I closed it and everything worked as I had expected.Thanks for your suggestions.\n"}
+{"text": "### Human: 1.) From a .net client, how do I test if the client is connected to the server (i.e. can send and receive) Yes, I could send a message inside a try block and catch the ensuing exception but I'm hoping for a more elegant solution.2) How do I open, close, and re-open connections? In my attempts to resolve question 1 above I discovered that if I open a connection then call connection.Close() I am not able to obtain another connection from the connection factory (see code fragment below). I receive error message XMSCC0008I am using a very standard vanilla MQ configuration . Here is how my client connects:ISession session = MQAccess.GetSession(MQAccess.Connection);\nIDestination destination = session.CreateTopic(SubTopicName);\nConsumer = MQAccess.GetConsumer(session, destination);\nConsumer.MessageListener = new MessageListener(HandleMQSubEvent);\nMQAccess.Connection.Start();where MQAccess is a small utility class.Edited the question to add MQAccess code:public static class MQAccess\n{\n public static readonly MQConfigurationSectionHandler ConfigSettings;\n public static readonly IConnectionFactory ConnectionFactory;\n\n private static readonly IConnection connection;\n public static IConnection Connection\n {\n get { return connection; }\n }\n\n static MQAccess()\n {\n ConfigSettings = (MQConfigurationSectionHandler)\n ConfigurationManager.GetSection(\"mq-configuration\");\n\n XMSFactoryFactory factory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n ConnectionFactory = factory.CreateConnectionFactory();\n ConnectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, ConfigSettings.Hostname);\n ConnectionFactory.SetIntProperty(XMSC.WMQ_PORT, ConfigSettings.Port);\n ConnectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, ConfigSettings.Channel);\n\n if (ConfigSettings.QueueManager == string.Empty)\n {\n ConnectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"\");\n }\n else\n {\n ConnectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, ConfigSettings.QueueManager);\n }\n\n connection = GetConnection();\n }\n\n public static IConnection GetConnection()\n {\n return ConnectionFactory.CreateConnection();\n }\n\n public static ISession GetSession(IConnection connection)\n {\n return connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n }\n\n public static IMessageProducer GetProducer(ISession session, IDestination destination)\n {\n return session.CreateProducer(destination);\n }\n\n public static IMessageConsumer GetConsumer(ISession session, IDestination destination)\n {\n return session.CreateConsumer(destination);\n }\n\n public static void MQPub(string TopicURI, string message)\n {\n using (var session = GetSession(Connection))\n {\n using (var destination = session.CreateTopic(TopicURI))\n {\n using (var producer = GetProducer(session, destination))\n {\n producer.Send(session.CreateTextMessage(message));\n }\n }\n }\n }\n\n public static void MQPub(string TopicURI, IEnumerable messages)\n {\n using (var session = GetSession(Connection))\n {\n using (var destination = session.CreateTopic(TopicURI))\n {\n using (var producer = GetProducer(session, destination))\n {\n foreach (var message in messages)\n {\n producer.Send(session.CreateTextMessage(message));\n }\n }\n }\n }\n }\n}Edit: Renamed MQAccess class to MQClient. Made it an instance class per T Rob suggestion. Disconnect method still crashes with error msgs listed abovepublic class MQClient : IDisposable\n{\n public MQConfigurationSectionHandler ConfigSettings { get; private set; }\n public IConnectionFactory ConnectionFactory { get; private set; }\n\n public IConnection Connection { get; private set; }\n\n public IMessageConsumer Consumer { get; private set; }\n public IMessageProducer Producer { get; private set; }\n // Save sessions as fields for disposing and future subscription functionality\n private ISession ProducerSession;\n private ISession ConsumerSession;\n public string SubTopicName { get; private set; }\n public string PubTopicName { get; private set; }\n public bool IsConnected { get; private set; }\n public event Action ConnectionError;\n private Action IncomingMessageHandler;\n\n public MQClient(string subTopicName, string pubTopicName, Action incomingMessageHandler)\n {\n // Dont put connect logic in the constructor. If we lose the connection we may need to connect again.\n SubTopicName = subTopicName;\n PubTopicName = pubTopicName;\n IncomingMessageHandler = incomingMessageHandler;\n }\n\n public string Connect()\n {\n IsConnected = false;\n string errorMsg = string.Empty;\n\n ConfigSettings = (MQConfigurationSectionHandler)\n ConfigurationManager.GetSection(\"mq-configuration\");\n\n XMSFactoryFactory factory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n ConnectionFactory = factory.CreateConnectionFactory();\n ConnectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, ConfigSettings.Hostname);\n ConnectionFactory.SetIntProperty(XMSC.WMQ_PORT, ConfigSettings.Port);\n ConnectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, ConfigSettings.Channel);\n\n if (ConfigSettings.QueueManager == string.Empty)\n ConnectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"\");\n else\n ConnectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, ConfigSettings.QueueManager);\n\n Connection = ConnectionFactory.CreateConnection();\n\n\n if (!string.IsNullOrEmpty(PubTopicName))\n {\n ProducerSession = Connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n Producer = ProducerSession.CreateProducer(ProducerSession.CreateTopic(PubTopicName));\n }\n\n if (!string.IsNullOrEmpty(SubTopicName) && IncomingMessageHandler != null)\n {\n ConsumerSession = Connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n Consumer = ConsumerSession.CreateConsumer(ConsumerSession.CreateTopic(SubTopicName));\n Consumer.MessageListener = new MessageListener(IncomingMessageHandler);\n }\n\n try\n {\n Connection.Start();\n Connection.ExceptionListener = new ExceptionListener(ConnectionExceptionHandler);\n IsConnected = true;\n }\n catch (TypeInitializationException ex)\n {\n errorMsg = \"A TypeInitializationException error occured while attempting to connect to MQ. Check the Queue configuration in App.config. The error message is: \" + ex.Message; \n }\n catch (IllegalStateException ex)\n {\n errorMsg = \"An IllegalStateException error occured while attempting to connect to MQ. Check the Queue configuration in App.config. The error message is: \" + ex.Message; \n }\n\n return errorMsg;\n }\n\n public void Disconnect()\n {\n if (Producer != null)\n {\n Producer.Close();\n Producer.Dispose();\n Producer = null;\n }\n\n if (ProducerSession != null)\n {\n // Call Unsubscribe here if subscription is durable\n\n ProducerSession.Close();\n ProducerSession.Dispose();\n ProducerSession = null;\n }\n\n if (Connection != null)\n {\n Connection.Stop();\n\n //if (Connection.ExceptionListener != null)\n // Connection.ExceptionListener = null;\n\n // Per Shashi............\n //if (Consumer.MessageListener != null)\n // Consumer.MessageListener = null;\n\n Connection.Close();\n Connection.Dispose();\n Connection = null;\n }\n\n if (Consumer != null)\n {\n\n if (Consumer.MessageListener != null)\n Consumer.MessageListener = null;\n\n Consumer.Close();\n Consumer.Dispose();\n Consumer = null;\n }\n\n\n if (ConsumerSession != null)\n {\n // Call Unsubscribe here if subscription is durable\n ConsumerSession.Close();\n ConsumerSession.Dispose();\n ConsumerSession = null;\n }\n\n IsConnected = false;\n }\n\n\n public void Publish(string message)\n {\n Producer.Send(ProducerSession.CreateTextMessage(message));\n }\n\n\n public void Publish(string[] messages)\n {\n foreach (string msg in messages)\n Publish(msg);\n }\n\n public void ConnectionExceptionHandler(Exception ex)\n {\n Disconnect(); // Clean up\n\n if (ConnectionError != null)\n ConnectionError(ex);\n }\n\n #region IDisposable Members\n private bool disposed;\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n Disconnect();\n\n disposed = true;\n }\n }\n #endregion\n\n}### Assistant: The problem is here -->where MQAccess is a small utility class.The first part of the question asks how to tell if the connection is active. The XMS classes for WebSphere MQ are an implementation of the JMS specification for non-Java platforms. They follow the JMS spec fairly closely and the JMS spec does not have a method on the connection or session equivalent toisConnectedtherefore neither does XMS. However, all GET and PUT activity should occur within a try/catch block in order to catch the JMS exceptions. (From which youalwaysprint thelinkedException, right?) When a JMS exception is thrown the app either treats it as fatal and dies or else it closes all JMS objects except for the Connection Factory, waits a few seconds and then re-drives the connection sequence.UPDATE based on new info in the question:Thanks for posting the MQAccess class. This provides considerable insight into what's happening, although there still isn't any code showing where the connection is closed and reopened as per Part #2 of the question.However, the code shows that theMQAccessclass creates a private instance ofICONNECTION connectionas the class instance is constructed, which is then exposed publicly asMQAccess.GetConnection. TheMQAccessclass as currently posted has no public or private class method that would ever replace the connection handle held byconnectionso ifMQAccess.Connection.Close()is ever called, thatIConnectionobject instance within theMQAccessclass will forever after hold an invalid connection handle. Once the connection is closed, that instance ofMQAccessis effectively dead. You'd have to delete and reinstantiateMQAccessto get a new connection.TheMQAccessclass does expose the connection factory publicly so in theory it would be possible to callMQAccess.GetConnectionfrom outside the class and obtain a valid newIConnectionobject, even after closing the original one. However, that instance would exist outside the scope of theMQAccessclass and thus any subsequent calls toMQAccesswould refer to its defunct instance variableconnectionrather than the new connection instance created outside the class.If you need to close and recreate connections, you might consider managing that from inside ofMQAccess. A low-tech approach might be to write anMQAccess.Close()method for the connection which would close the existing connection then immediately callconnection = GetConnection();so that the privateconnectionvariable always holds a valid connection handle.If this doesn't resolve the problem, please post the code that is closing and recreating the connections.By the way, the non-transacted session over a network connection opens the possibility to lose or duplicate messages for any JMS provider, including WMQ. Was this what you intended? I've explained why this is in an other SO posthere.\n"}
+{"text": "### Human: What are the recommended guidelines for WebSphere MQ naming conventions for queue managers, queues (local, remote, transmit, dead letter queues...), channels etc. I found one at IBM'sdeveloperWorksbut looking to see if there is anything else comprehensive out there. Thanks.### Assistant: This sounds like a good topic for a newMission:Messagingcolumn but I'll write up the condensed version here. I'll preface my answer by noting that many of my recommendations are contrary to those you might find elsewhere. In some cases this is because the way MQ is commonly used have changed over the years. In other cases it is because the conventional wisdom never worked well to begin with. (Cluster channels namedTO.QMGRfor example.) In all cases, I prefer conventions which apply to the broadest number of situations. That means it is usually possible to find exceptions to these rules for specific cases but they are broadly applicable nonetheless.Some general rulesThe following apply to all object types.Use the dot character.as a separator.Authorization rules parse names using dot characters as separators. For example, the queue nameMY.EXAMPLE.QUEUE.NAMEwould match rules likeMY.*.*.*orMY.**but notMY.*because the dots signify name node separator characters. Do yourself a favor and use dots rather than underscores as your naming node separators consistently.Use machine-parsable names.When you have 5 queue managers and a few hundred objects, you can easily get by doing all your management manually with WMQ Explorer or runmqsc. However, there comes a point where consistency, reliability, repeatability and efficiency demand that you script up some of your routine operations or employ instrumentation to respond to network events. More than anything else this means eliminating ambiguity in names.For example, if you create a naming convention that channel names must look likeSRCQMGR.DESTQMGRthen it is possible for a script to read aRCVRorSDRchannel name and derive the names of the two queue managers it connects. However, what does the script do with a channel name likeGA.PAYROLL.OPS? Is it theGA.PAYROLLqueue manager connecting to theOPSqueue manager? Or is it theGAqueue manager connecting to thePAYROLL.OPSqueue manager? A human might be able to tell instantly based on context but scripts are notorious for doing what you tell them rather than what you intended. Similar situations arise when queue names have position-dependent qualifiers at both the beginning and the end of the name and a variable number of nodes.Stick with UPPERCASE names.This is for compatibility across all platforms, and in particular z/OS. Although it is true that more z/OS shops are using mixed case, it is also true that there are still a lot of systems out there that only accept UPPERCASE names. While it is easy to say \"this doesn't apply to me\" I have seen many cases where somebody had problems interfacing to a new business partner because of incompatible names. After all, the ability to interface to just about any platform out there is one of the main reasons for using WMQ in the first place.Don't include attributes of the object in the nameIn an SOA world, queues and topics are different types of destination and often are interchangeable. Something putting messages to what it thinks is a queue doesn't necessarily know (or care!) if they are actually going to a queue or a topic. A queue that has an application listening on it for messages may be fed by an administrative subscription that is actually roping in publications from one or more topics.What we really care about is the nature of the messages - what function do they perform - not whether we are connecting to a local queue or an alias queue. So adding qualifiers like.QA,.QL,.TPC(for topic) and so forth doesn't make sense. Similarly, adding.RCVRonto a channel name sucks up 5 useful characters that could have been better used describing the QMgr name. Worse, these practices bake the topology into the object names, making the system both less flexible and more brittle.Channel namesPoint-to-Point Channel namesUse names likeSRCQMGR.DESTQMGRforRCVR,RQSTR,SDR, andSVRchannels. This is biased toward languages that read left-to-right because the intention is to describe the data flowfroma QMgrtoanother QMgrCluster channelsUse names likeCLUSNAME.QMNAME. The old wisdom said to use names likeTO.QMNAMEbut if you ever implement overlapping clusters this causes the same channel to be used for multiple clusters. That's bad because you can then never perform maintenance on one cluster without impacting the other. UsingCLUSNAME.QMNAMEinsures that every QMgr has a dedicatedCLUSRCVRchannel for each cluster in which it participates.Client ChannelsThe exception to the \"don't include attributes of the object in the name\" is arguably theSVRCONNchannel. This is because channels are very much tied to the physical rather than the logical layer of the network. So putting the QMgr name in a SVRCONN channel name is generally OK. I don't object too strongly if people want to add.SVRCONNat the end, either.The thing to remember about client channels is that if you use a Client Channel Definition Table (CCDT) then the unique index into that table is the channel name. That means you cannot have the same channel name on multiple QMgrs and still use a CCDT. Since the CCDT is one way to configure the SSL/TLS channel details, this is often not appreciated to its fullest until the \"let's finally secure WMQ\" project comes along. By using unique channel names forSVRCONNchannels from the start, you can future-proof the network. Usually these names look likeAPP.QMNAMEor to make it obvious you aren't dealing with a cluster or point-to-point channel,APP.QMNAME.SVRCONNor similar.Queue manager namesNo dots in QMgr namesOne implication of the previous rules is that cluster and queue manager names must contain only one node and therefore should never contain a.character. This is because channel names are typically derived from the cluster and/or QMgr names. So in the example above, aRCVRchannel name likeGA_PAYROLL.OPSwould tell both humans and scripts that the channel in question connects a QMgr namedGA_PAYROLLto a QMgr namedOPS.Names of 9 chars or lessChannel names can be only 20 characters. Subtract one for the dot separator, divide by two and round down gets you to 9 characters max for queue managers. If there's a possibility that you may set up different channels for classes of service (for large vs small messages, for example, then drop back to 8 chars or less for QMgr names. This leads toQM1.QM2.A,QM1.QM2.B, etc.QMgr names reflect the physical layerIn a service-oriented world, we really care about destination names like queues and topics. We care much less about queue manager names because these are just life support for queues and topics. Client apps don't care so much aboutwhichQMgr the connect to, so long as they can send requests and receive replies. WMQ very conveniently fills in the reply-to QMgr name on outbound requests so it is rare that an application needs to know about it.On the other hand, the administrators need to know about the QMgr name. In the early days it was common to name QMgrs for the host server. Later it became the fashion to name them for the applications they hosted. Now in the SOA world, messaging is infrastructure and usually not associated with any single application so the pendulum has swung back. Give the QMgr a unique name that is meaningful to an administrator.Never reuse QMgr names!It is unfortunately very common to \"move\" a QMgr from one place to another or to have a primary and disaster recovery QMgr with the same name. This practice usually means some part of the application is dependent on the QMgr name and therefore it is \"easier\" to reuse the name. IBM introduced theQMIDas a way to address some of the problems introduced by reusing QMgr names. The typical use case is that a node gets rebuilt and the QMgr once there is also rebuilt from scratch. The cluster knows it is a new QMgr because theQMIDhas changed, but the name used for routing and other operations remains the same.Although this helped in that limited use case, it doesn't address the issues when both QMgrs with the same name are online at the same time. Nor does it address the problem that a reputable Certificate Authority won't issue multiple certs with the same Distinguished Name which forces reuse of the same certificate for multiple QMgrs.Remember that QMgrs are just life support for queues and topics and ideally will be anonymous to the applications using them. Pick a naming convention that allows you to spin up new QMgrs with unique names by the hundreds or thousands, if necessary, so that you don't have to reuse QMgr names.Other objectsUse intention-revealing namesOr to put it another way, name the object for what itdoesand not what itis. For example, if you were in the habit (as many people are) of including qualifiers like.QLfor local queues and.QAfor aliases, then any change in topology will impact the applications using those queues. Instead, name the queues for the functions they represent.Go left-to-right, most generic to most specificObject names, especially queues, should be constructed hierarchically beginning with the most generic qualifier and proceeding to the most specific qualifier. For example, many shops useAPP.FUNC.SUBFUNC.VERwhereAPPis the ID of the owning application, then one or more nodes with the function and subfunction. Many shops add a version qualifier on the end so that new versions of a service can migrate their clients on separate schedules rather than changing the service on the existing queue and making all clients change at the same time.The thing that reads the messages owns the queueIf I have a service endpoint represented by a queue then there is a many-to-one relationship between the things that might call the service to the thing that provides the service. The queue is associated with the service and the thing providing that service. Clients are more or less anonymous. Therefore, if any of the stakeholder applications can be said to \"own\" the queue, it is the service provider app that consumes messages form it.The thing that publishes the message owns the topic. Sort of.The relationship is not as straightforward with topics. Here it is the consumers of messages that are usually anonymous. In that sense if the topic name reflects any application, it is most likely the publisher. However, even publishers can be anonymous, or at least there may many of them and not all publishing at the same time. With topics it makes much more sense that the topic tree nodes are structured for the hierarchy of data or functionality they represent. These names tend to match the names of the publishing apps so sometimes the publisher \"owns\" the topic as much out of coincidence as anything else.Put positional qualifiers on the leftWhere names have variable numbers of qualifiers, put the positional ones on the left where scripts and automation can parse them. Some shops where both the beginningandending qualifiers are positional deal with this by using underscores for separators in the variable section of the name likeAPP.FUNC.SUBFUNC1_SUBFUNC2.VER. Scripts and authorizations then always see a fixed number of nodes in the name but this approach can be brittle if somebody forgets and makes a name with an extra node or two.Further readingThis sums up most of the general rules but some of the philosophy behind them has been captured in the Mission:Messaging column. In particular:Embracing cultural change in the WebSphere MQ communityMigration, failover, and scaling in a WebSphere MQ clusterThe articlePlanning for SSL on the WebSphere MQ networkdiscusses distinguished name standards as they apply to WMQ\n"}
+{"text": "### Human: MQMessage queueMessage = new MQMessage();\n queueMessage.WriteString(strInputMsg);\n queueMessage.Format = MQC.MQFMT_STRING;\n MQPutMessageOptions queuePutMessageOptions = new MQPutMessageOptions();\n Queue.Put(queueMessage, queuePutMessageOptions);Using C#, with the above code, when I input the message into the queue, the data length of the message is 3600.When I manually input the message into the queue by right clicking the queue and selecting Put Test Message option, the data length of the message is 1799.I am really confused why this is the case. The message in both cases is an xml string with declaration. In Notepad++, there are 1811 characters including the declaration. When I view the message in debugger before I input into the queue, the message is converted into xml without any line or return carriages.I created the xml string using://converts string message into xml by serializing it\n public string GetMessage(MyMessage messageInstance)\n{\n\n// Serialize the request\n XmlSerializer xsr = new XmlSerializer(typeof(MyMessage));\n MemoryStream memoryStream = new MemoryStream();\n XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);\n xsr.Serialize(xmlTextWriter, messageInstance);\n\n memoryStream = (MemoryStream)xmlTextWriter.BaseStream;\n string XmlizedString = new UTF8Encoding().GetString((memoryStream.ToArray());\n\n\n // Encode the xml\n Encoding utf = Encoding.UTF8;\n byte[] utfBytes = utf.GetBytes(XmlizedString);\n\n // Load the document (XmlResolver is set to null to ingore DTD)\n XmlDocument xmlDoc = new XmlDocument();\n xmlDoc.XmlResolver = null;\n xmlDoc.LoadXml(utf.GetString(utfBytes));\n return utf.GetString(utfBytes);Am I missing anything in my C# implementation that is adding extra characters?Thanks.### Assistant: As @Matten suggests one problem could be character encoding.The default value for theCharacterSetproperty is 1200 (UNICODE) andWriteStringconverts to the code page specified by CharacterSet.Code Page 1200 is UTF-16 little-endian so you are likely to get two bytes per character. It is certainly possible that \"Put Test Message\" uses some other encoding that uses one-byte per character for common characters.Assuming that the 3600 and 1799 lengths are counted in bytes, they could represent 1800 UTF-16LE characters and 1799 UTF-8 characters (or 1799 ASCII characters or 1799 EBCDIC characters...).That still leaves us with a one character difference in length. Perhaps WriteString includes a terminating NULL character in the string written?Are you sure you trust the count Notepad++ gives you? If Put Test Message placed 1799 characters into a message there were probably 1799 characters in the data you supplied to it.Edit:Assuming the encoding theory is correct, you could shorten the message by using a different encoding. How short an encoding would make a particular message would depend on the actual contents of the string.For example, you could use an ASCII encoding to get one byte per character.MQMessage queueMessage = new MQMessage();\nqueueMessage.CharacterSet = 437; // Set code page to ASCIIThat would shorten your message to 1800 bytesifall the characters in your xml string had an ASCII representation.An alternative would be to use UTF-8 encoding.MQMessage queueMessage = new MQMessage();\nqueueMessage.CharacterSet = 1208; // Set code page to UTF-8Using UTF-8 has the advantage that (unlike ASCII) all characters have a representation (for certain values of 'all'). The disadvantage is that some characters require two, three or even four bytes to represent them. The most common characters are encoded in one byte, then the next most common characters are encoded in two bytes and so on.In the best case a UTF-8 encoding would also give you 1800 bytes. In the worst case it would give you 7200 bytes but that seems very unlikely unless you are using something like Klingon!\n"}
+{"text": "### Human: I'm hoping someone can help me - I'm using JBoss 5.1 and MQ Series 7 in an EJB / JMS based application. I have several message driven beans in my application, each listening on an MQ Series message queue. When an error is encountered during the processing of a message, I need to be able to configure a 'retry delay', so that mq series waits some period of time before attempting to redeliver the message. I have combed through MQ Series documentation extensively, and have not yet found a way to accomplish this in MQ Series. I know that the JBoss default JMS provider has a way to do this, but I am currently limited to using MQ Series. Since I haven't been able to set a retry delay - when I have a message that fails, my application gets stuck in a tight loop of delivering the message and rolling back continuously. Can anyone help me understand if there is some config option in MQ Series that will allow me to wait X milliseconds before redelivering a failed message?### Assistant: This is likely to be an opportunity to craft a little infrastructure for such an issue.Since you can look at the JMSDeliveryCount when the message has entered the bean (before you process it -- consider commit scope) and you can see that it has had a couple of rollbacks already, send the message around to a staging queue but attach the destination queue name in the jms properties so you can use it later.A simple process can run on some interval to clear thestaging queue(every 5 minutes for example) and send the message on to arouting queue.Another process can sit on therouting queueand look at the jms properties (which added the destination queue name to) and send the message along to the orginal destination.It's a poor man's broker but it will acheive the goal. It is true that there is not much built in to really do what you want.\n"}
+{"text": "### Human: I'm writing a simple Java application using MQ classes for Java with Eclipse.Right now I'm able to browse a remote queue without removing the messages stored.Here is the code of the reading cycle:MQQueueManager QMgr = new MQQueueManager(qManager); //<-- qManager is a String with the QMgr name\n\nint openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE; \n\nMQQueue queue = QMgr.accessQueue(queueName, openOptions);\n\nMQMessage theMessage = new MQMessage();\nMQGetMessageOptions gmo = new MQGetMessageOptions();\n gmo.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;\n gmo.matchOptions=MQC.MQMO_NONE;\n gmo.waitInterval=5000;\n\nboolean thereAreMessages=true;\nwhile(thereAreMessages){\n try{\n //read the message \n queue.get(theMessage,gmo); \n //print the text \n String msgText = theMessage.readString(theMessage.getMessageLength());\n System.out.println(\"msg text: \"+msgText);\n\n // <--- Solution code Here\n\n //move cursor to the next message \n gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;\n\n }catch(MQException e){\n\n if(e.reasonCode == e.MQRC_NO_MSG_AVAILABLE) {\n System.out.println(\"no more message available or retrived\");\n }\n\n thereAreMessages=false;\n } catch (IOException e) {\n System.out.println(\"ERROR: \"+e.getMessage());\n }\n}Main question:After the read message line and before moving the cursor to the next message how can I remove the message from the queue?Secondary question:Eclispe is warning me that all the costants used for the options are deprecated; which are the correct ones to use?Solution:Here the solution I'm really looking for:// set te cursor to remove the message from the queue\ngmo.options = CMQC.MQGMO_MSG_UNDER_CURSOR;\nqueue.get(theMessage, gmo);these lines have to be inserted in the question codeI've found it here:http://www.velocityreviews.com/forums/t124676-mq-series-messages-browse-and-delete.html### Assistant: Solution:Here the solution I'm really looking for:// set te cursor to remove the message from the queue\ngmo.options = CMQC.MQGMO_MSG_UNDER_CURSOR;\nqueue.get(theMessage, gmo);these lines have to be inserted in the question codeI've found it here:http://www.velocityreviews.com/forums/t124676-mq-series-messages-browse-and-delete.html\n"}
+{"text": "### Human: I own the following findings in order to work againts WMQ Secure-Channel:DefinedSecure-Channelin the WMQ farmPublic/Private keysUnmanagedSecurity-ExitassemblyMy question is how to utilize these resources and interact with aSecure Channelusing the XMS API? (Using C#)This is what I've tried so far, but without success:private IConnectionFactory CreateConnectionFactory()\n{\n XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n\n IConnectionFactory connectionFactory = factoryFactory.CreateConnectionFactory();\n\n connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, _wmqHostName);\n connectionFactory.SetIntProperty(XMSC.WMQ_PORT, _wmqPort);\n connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, _wmqChannel);\n connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);\n connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, _wmqQueueManager);\n connectionFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, 0);\n connectionFactory.SetStringProperty(XMSC.WMQ_SECURITY_EXIT, \"MySecurityExitName\");\n\n return (connectionFactory);\n}I get the following error when calling it:CWSMQ0006E: An exception was received during the call to the method\n ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2195 . During\n execution of the specified method an exception was thrown by another\n component. See the linked exception for more information.UPDATE:I found the following Technote which describes my problem and itspossible(not tested) solution:https://www-304.ibm.com/support/docview.wss?uid=swg1IC82112### Assistant: Good that you found that Technote. Also make sure that...If doing mutual authentication (SVRCONN channel is set toSSLCAUTH(REQUIRED)) that the app's personal certificatehas a label matching the service account. Example, if the app is running asdotnetacctthe label of the personal cert in its keystore would beibmwebspheremqdotnetacct.Get the channel running without SSL or an exit first. Then do server-authenticated SSL, then mutually authenticated SSL, then add the exit back in. This isolates problems.Use the latest WMQ client. I do not mean the latest fix pack for v7.0 or v7.1 but the latest v7.5 (as of this writing) client. Download asSupportPac MQC75. Later clients are compatible with back-level QMgrs and they have more fixes/features.Install thefullclient and not just the classes or assemblies you think you need. This gets you all sorts of utilities such as client-side tracing.Use theamqssslcsample to test your channel and certificates. This is usually atC:\\Program Files (x86)\\IBM\\WebSphere MQ\\tools\\c\\Samples\\Bin\\amqssslc.exeand is one of the utilities supplied when installing the full client.Go to theWMQ SupportPacs pageand look forMH03 WebSphere MQ SSL Configuration CheckerandMO04 WebSphere MQ SSL Wizard. These can help with configuration and problem diagnosis.\n"}
+{"text": "### Human: I have a simple program to process messages from a queue.\nMy intention is to process all available messages in queue and still listen to queue for incoming messages.I have written the processing part inside a infinite loop as i want it to listen to queue always and process messages.Once after processing all messages again it tries to get a message(as it is inside a infinite loop) from the queue and thereis no messages it throws MQRC 2033 NO_MSG_AVAILABLE exception(infact it is correct) and my program exits.Can someone give an idea to continously listen to this queue and avoid this exception.### Assistant: When you execute theMQGETAPI call, there is an option to have the program wait for messages. You can specify a wait time (in milliseconds) or specify to wait forever. Just make sure that if you have the app wait for more than a few seconds, also specify 'Fail if Quiescing'. This allows the queue manager to be stopped cleanly. Without 'Fail if Quiescing' the administrator will need to issue a preemptive shutdown which can cause problems.There is a section specifically for this question in the Programmer's Guide in theWaiting for Messageschapter. Depending on the language you are writing in ,the actual value to specify is in theProgrammer's Reference, theUsing Javamanual or theUsing .Netmanual. Each of these will be visible in the navigation panel when you click the link above.\n"}
+{"text": "### Human: I had much difficulties implementing a Websphere MQ (WMQ) connector with Apache CAMEL that could handle MQ Confirmation of Delivery (CoD) reports without exceptions, neither side effects in the form of unwanted response datagrams. In the end I got it working the way I wanted, a much standard and common way if you are accustomed to writing native MQ clients. I document the method in a post to this same topic, but I find the solution bloated with intricacies and would very much appreciate any advice or example to make the implementation cleaner and more elegant.I understood that the problem takes its roots into the way MQ designed request-reply Message Exchange Pattern (MEP), versus the way JMS specifications did, versus CAMEL implementation of the Request-Reply MEP in its JMS Component. Three different philosophies!WMQ features a MessageType header (seeMQMD fieldsandconstants) that bears value 1 for request, 2 for reply, and 8 for datagram (one way MEP). In addition, the value 4 is used to mark Report messages in the form of CoD (Conf. of Delivery), PAN (Positive AckNowledge) and NAN (Negative AckNowledge), which - in term of the message flow - also make an additional Reply message. The CoD, PAN, and NAN acks can be requested for either Request messages, Replies or Datagrams using another header field named 'Report' in which flags for all report variants can be combined. Additional header fields 'ReplyToQ' and 'ReplyToQMgr' specify the Queue and Queue Manager on which Reports and Replies are expected by the original sender, and afixed 24 bytes'CorrelId' field - optional - can help correlate Reports and Replies to the original Datagram or Request mesage. To make it more complex, one can indeed send back Replies and Reports with the same original Message ID and no CorrelID, or provide the original Message ID in the CorrelId, or return the CorrelId value when already specified in the original Request or Datagram. IBM provides aJMS API over WMQ, allowing either to tunnel plain JMS exchanges over WMQ as transport (with help from an extra message header nameMQRFH2), or tomap native MQ messages onto JMS messagesand vice-versa.On the other hand, JMS specs provide an optional 'JMSReplyTo' header field and a 'JMSCorrelationID', but do leave the exact MEP semantics to client applications; namely stating in specs: \"A response may be optional; it is up to the client to decide.\"CAMEL features 'routes' in XML or Java DSL and a inner Exchange Object model with the purpose to supportEIP Patternsamongst which theRequest-Replypattern. CAMEL then assumes in itsJMS Componentthat if the JMSReplyTo field is set, this is necessarily a Request expecting a Reply, causing the Out part (or modified In part if Out is empty) of an Exchange to be returned to the queue defined in JMSReplyTo.I was willing to support native MQ Message exchanges with Confirmation of Delivery (CoD) reports through a remote Websphere Queue Manager, so that, in addition to transaction and persistence (i.e. no loss, no duplicates) one can also track when a message is consumed and raise alerts in case of delays.Inbound issue:By default, the Websphere Queue Manager generates CoD Reports when message consumption from the queue completes. Therefore,without any specific settings, a remote MQ client sending a datagram with the CoD flag (and the then compulsory ReplyToQ) will get a first reply as MQ Report back from the Queue Manager when the CAMEL endpoint consumes the message, followed by a second (unexpected) reply message explicitly returned by CAMEL and containing whatever is left in the Exchange object at the end of the CAMEL route, because CAMEL assumes a Request-Reply EIP given that the JMSReplyTo field is present (mapped from MQ ReplyToQ and ReplyToQMgr, both being required to support the CoD return flow).Outbound issues:Without specific settings, CAMEL assumes too by default a Request-reply EIP / MEP on the outbound connection. The CAMEL JMS/MQ endpoint will then wait for1response back. When the OUTbound message is JMS over MQ (hence with MQRFH2 header), this works fine. When forcing plain vanilla MQ, i.e. removing MQRFH2 header as below, I was unable to get the endpoint listener match the correlated incoming MQ Report, although traced values seem all correct (enforcing 24 char correlation IDs so that truncation of longer CorrelId values or null padding by MQ cannot geopardize the correlation filter). Has anyone been able to solve that issue?Details:Although IBM JMS API accepts passing specific JMS property values WMQ_MESSAGE_BODY={1|0} / WMQ_TARGET_CLIENT={1|0} to control the presence of the JMS header MQRFH2 in the generated messages, these options become inoperative through CAMEL. One must use theCamelJmsDestinationNameheader (as explained in CAMEL JMS doc) to supply an IBM queue URL for the destination featuring the option \"targetClient=1\" in order to get rid of the MQRFH2 header. But without this header, the CAMEL correlation on the CoD Report or MQ reply does fail.The solution to the above issue is indeed about building a specific CAMEL route to handle the CoD Reports returned by the remote party (as well as correlated MQ Replies). So CAMEL outbound messages must be enforced as \"InOnly\"ExchangePatternand thus not wait for any reply. But this will cause CAMEL to suppress too all ReplyTo fields. Then if a MQ CoD is requested on an outbound MQ datagram, a CAMEL exception ensues whose cause isMQException JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2027' ('MQRC_MISSING_REPLY_TO_Q').CAMEL documents an URI option 'disableReplyTo=true' to disable the reply-listening on exchange patterns yet keep the ReplyTo fields - apparently on both inbound and outbound exchanges. But this option does not work (as observed, I may be wrong) on outbound JMS exchanges and one must use the much less intuitive 'preserveMessageQos' option instead.Elegant solutions to these issues are welcome.### Assistant: The best I have been able to get is documented below, illustrated as a Spring XML application context that itself hosts the CAMEL context and routes. It works with the IBM native MQ JCA-compliant resource adapter v7.5, CAMEL 2.15, Spring core 4.2. I can deploy it to both Glassfish and Weblogic servers.Of course a java DSL is used in a real implementation given the numerous variables. This example based on the CAMEL XML DSL is self-contained and easy to test.We start with Spring & Camel declarations:\nThe CAMEL context follows with 2 routes: MQ to JMS and JMS to MQ, here chained to form a bridge to ease testing.\n\n Weird: when using the native MQ Resource adapter the only way to get (e.g.) 3 listeners is to enforce 3 connections (with 3 Camel:from statements in sequence) with max 1 session each, otherwise an MQ error ensues:MQJCA1018: Only one session per connection is allowed. However, if you use MQ client jars instead, then the concurentConsumers option in CAMEL JMS does work fine. \n \n The disable disableReplyTo option above ensures that CAMEL will not produce a reply before we can test the MQ message type to be 1=Request(-reply) or 8=datagram (one way!). That test and reply construction is not illustrated here.Then we enforce the EIP to InOnly on the next posting to plain JMS to be consistent with the Inbound MQ mode.\n \n \n Next comes the jms-to-MQ route:\n \n \n \n \n Now comes the request flag for the MQ CoD report to be returned by remote destination. We also enforce the MQ message to be of Datagram type (value 8).2048\n 64\n 8The ReplyTo queue can be specified either via theReplyTouri option, else as a header as below.Next we do useCamelJmsDestinationNameheader to enforce suppressing of the JMS MQ message headerMQRFH2(using targetClient MQ URL option value 1). In other words, we want to send a plain vanilla MQ binary message (i.e. Only the MQMD message descriptor followed by the payload).TEST.REPLYTOQ\n queue://MYQMGR/TEST.Q2?targetClient=1More MQMD fields may be controlled throughreserved JMS propertiesas illustrated below. Seerestrictionsin IBM doc.MQSTR \n _PLACEHOLDER_24_CHARS_ID_The destination queue in the URI is overwritten by theCamelJmsDestinationNameabove, hence the queue name in the URI becomes a placeholder.The URI optionpreserveMessageQosis the one that - as observed - allows sending a message with the ReplyTo data being set (to get the MQ CoD Report), yet prevent CAMEL to instantiate a Reply message listener by enforcing the InOnly MEP.\n \nThe following must be adjusted to your context. It provides the queue factories for both a native JMS provider and Websphere MQ (via the native IBM WMQ JCA Resource Adapter). We use here JNDI lookups on administrative objects.\n\n\n\n\n\n\n \n\n\n\n \n\n\nAlternatively, if you are using the MQ client jars instead of the Resource Adapter, you will declare the connection factory beans like (in place of JNDI lookups as above):\n \n \n \n \n \n \n\n\n\n \n \n \nComments and improvements welcome.\n"}
+{"text": "### Human: I have Spring Boot application which listen IBM MQ Queue via@JmsListenerannotation as below from component class. The MQ properties (hostname, channel, port, etc) are set fromyamlfile.@JmsListener(destination = \"\")\n public void receiveMessage(BytesMessage msg) { \n //snippet to read msg\n }The MQ dependencies are added in gradle build as below,compile(\"com.ibm.mq:mq-jms-spring-boot-starter:0.0.2\") { \n exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'\n }This works fine and listening the message as long as I run the application on local with Tomcat container. But if I package this as EAR and deploy to Wesbphere8.5 server, it throws below exception and listener is not reading the message from queue. I confirmed that all the run-time dependencies are packaged in EAR. Tried with different versions of MQ dependencies but no luck.2018-07-10 15:21:16,531 ERROR DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'QueueName' -\n retrying using FixedBackOff{interval=5000, currentAttempts=34,\n maxAttempts=unlimited}. Cause: JMSFMQ6312: An exception occurred in\n the Java(tm) MQI.; nested exception is com.ibm.mq.jmqi.JmqiException:\n CC=2;RC=2195;AMQ9546: Error return code received.\n [1=java.lang.reflect.InvocationTargetException[null],3=NativeConstructorAccessorImpl.newInstance0]Need help to fix this issue.### Assistant: I faced a similar issue like this. This happens because of missing configurations on IBM MQ Connection with your JMS Application. In My case, I got an authorization related exception but I set the correct user credentials for the IBM mq. when I checked the IBM mq site, the userName is different and that is not which I configured in my spring application.#IBM MQ JMS Configuration\nibm.mq.queueManager={QUEUE_MANAGER}\nibm.mq.channel={CHANNEL_NAME}\nibm.mq.connName={HOST_NAME(HOST_PORT)}\nibm.mq.user={USER_NAME}\nibm.mq.password={PASSWORD}Then I added the below property to Use compatibility mode when authenticating with a queue manager.\nHere we override the authentication mode. This should not normally be needed withcurrent maintenance levels of MQ V8 or V9, but some earlier levels sometimes got get it wrong and then this flag can be set to \"false\"ibm.mq.user-authentication-m-q-c-s-p=falsePlease Referthis pagefor more details\n"}
+{"text": "### Human: We communicate with the third party using IBM MQ in request/reply fashion. We send them request and they give us reply. \nCurrent we both have a simple java based native IBM MQ application.\nWe are planning to rewrite our code using spring jms.\nBut we are not getting any response back within given time when spring jms is used. We are using JMSTemplate to send or receive messages.\nI am sharing my code snippet. Am I doing anything wrong here? Any other properties should I set here?// Request Part (we are sending request)\n\n String request // this is the request string\n byte[] reqData = request.getBytes(); // converting it into byte array to send\n\n TextMessage txtMsg = session.createTextMessage(String.valueOf(reqData));\n\n Destination replyToQName = jmsTemplate.getDestinationResolver().resolveDestinationName(session, responseQueueName, false);\n\n txtMsg.setJMSReplyTo(replyToQName);\n\n Destination requestQ = jmsTemplate.getDestinationResolver().resolveDestinationName(session, requestQueueName, false);\n\n ((JmsDestination) requestQ).setBooleanProperty( WMQConstants.WMQ_MQMD_WRITE_ENABLED, true );\n\n ((MQQueue) requestQ).setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ); // setting this because third party application is native websphere mq java application \n\n jmsTemplate.convertAndSend(requestQ, txtMsg);\n\n // saved msgId of request for late use\n String messageId = txtMsg.getJMSMessageID();\n\n\n // Response fetching part\n\n Destination responseQ = jmsTemplate.getDestinationResolver().resolveDestinationName(session, responseQueueName, false);\n\n ((JmsDestination) responseQ).setBooleanProperty(WMQConstants.WMQ_MQMD_READ_ENABLED, true);\n\n ((JmsDestination) responseQ).setObjectProperty( WMQConstants.JMS_IBM_MQMD_CORRELID, msgIdText);\n\n jmsTemplate.setReceiveTimeout(30000L);\n\n String filter = \"JMSCorrelationID='\" + messageId + \"'\"; // to match request message's messageId with response message's correlationId\n\n TextMessage respMsg = (TextMessage) jmsTemplate.receiveSelected(responseQ, filter);Below is my connectionFactory code:MQConnectionFactory factory = new MQQueueConnectionFactory();\n factory.setHostName(\"hostname\");\n factory.setPort(1420);\n factory.setQueueManager(\"QM1\");\n factory.setChannel(\"TEST.CHANNEL\");\n factory.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);### Assistant: The main issue here is that basic diagnostics have not been performed, or if they have then the results not presented in the question. I don't know Spring but I do know basic MQ debugging. I also lived in Missouri, the \"Show Me\" state, long enough to adopt the state motto as my own. Show me how all the assumptions were verified. As an MQ Admin I'd work with the developer to confirm all the assumptions by visual inspection. Here's how I'd approach it:Inspect the outbound messageStop the outbound channelPUT a request messageGET(ENABLE) the XMitQ and browse the messagea) Does the message appear?b) Does the message have the right format and values?c) Are the Reply-To fields correctly populated?d) Does the message expire and if so is the expiry sufficiently long?Inspect the return messageStop the applicationRestart the outbound channelBrowse the reply-to queuea) Does a message arrive?b) Is it correctly formatted and populated?SummaryIn the end there are only two likely scenarios where this can go wrong and both are easy to check.First, it is possible the new program is not putting any message at all. This is actually quite common when refactoring code to use a new framework. Trying to debug without positively verifying a message gets PUT (and explicitly stating in the question how this was done and the result) is making an awfully big assumption. Don't assume. Verify a message is produced and tell us the details when asking so we can eliminate that as a root cause.Second, working backward from the application taking the requests, it doesn't care which app sends the message if they are the same. Assuming the requestor app is actually PUTting a message, it can't be the same as the old one since it gets a different reaction from the remote server app. Compare messages for the same transaction from the old and the new app versions. Print them out in hex and compare byte for byte if necessary.After performing this kind of differential diagnosis it would be possible narrow the focus and get to root cause. The list of things to check if no message is produced is quite different from the list of items to check if a message is actually produced. It might be possible to resolve this without doing basic diagnostics but that would be the exception. So my non-answer answer is: start by doing the basic diagnostics.\n"}
+{"text": "### Human: So I've spent the past few days trying to solve this that seems to have been forgotten since none of the two PECL extensions available (SAM and mqseries) have been updated for a long time. I've tried both and mqseries seems to get me the furthest at this point since SAM refuses to get me a connection, even though MQ works perfectly from the command line. I've successfully created a connection to my QueueManager and it's during the next step (MQOPEN) that I fail miserably:$mqcno = array(\n 'Version' => MQSERIES_MQCNO_VERSION_2,\n 'Options' => MQSERIES_MQCNO_STANDARD_BINDING,\n 'MQCD' => array('ChannelName' => '[channel]',\n 'ConnectionName' => '[ipnumber]([port])',\n 'TransportType' => MQSERIES_MQXPT_TCP)\n );\n\nmqseries_connx('MQED', $mqcno, $conn, $comp_code,$reason);\nif ($comp_code !== MQSERIES_MQCC_OK) {\n printf(\"Connx CompCode:%d Reason:%d Text:%s \\n\", $comp_code, $reason, $reason);\n exit;\n}\n\n$mqods = array('ObjectName'=>'MYPUTQUEUE', 'ObjectType'=>MQOT_Q, 'ObjectQMgrName'=>'MYQUEUEMANAGER');\nmqseries_open($conn, $mqods, \n MQSERIES_MQOO_FAIL_IF_QUIESCING | MQSERIES_MQOO_OUTPUT,\n $obj, $comp_code,$reason);THis results in $reason being populated with 2044, which translates to MQRC_OD_ERROR, or in English: 'On the MQOPEN or MQPUT1 call, the object descriptor MQOD is not valid'.So the question is, what's wrong with my MQOD?Update #1: At this point this is not resolved. I rebuilt the project from the ground up to resolve any issues at build time. I am still stuck on MQOPEN returning 2044. The samples still run flawlessly from CLI, so this is definitely tied to the installation of the PECL extension. If there's anyone out there who has successfully installed and are running PHP against MQ in a fairly recent 64-bit PHP5 environment please let me know...Update #2: MQPUT1 works flawlessly with the problem that I can't receive my response. At this point, it's just MQOPEN that doesn't work. Question is; what is causing MQOPEN to return 2044 when MQPUT1 works, which I understand includes MQOPEN?### Assistant: The MQOD in the cmqch file looks like this:/****************************************************************/\n /* MQOD Structure -- Object Descriptor */\n /****************************************************************/\n\n\n typedef struct tagMQOD MQOD;\n typedef MQOD MQPOINTER PMQOD;\n typedef PMQOD MQPOINTER PPMQOD;\n\n struct tagMQOD {\n MQCHAR4 StrucId; /* Structure identifier */\n MQLONG Version; /* Structure version number */\n MQLONG ObjectType; /* Object type */\n MQCHAR48 ObjectName; /* Object name */\n MQCHAR48 ObjectQMgrName; /* Object queue manager name */\n MQCHAR48 DynamicQName; /* Dynamic queue name */\n MQCHAR12 AlternateUserId; /* Alternate user identifier */\n /* Ver:1 */\n MQLONG RecsPresent; /* Number of object records\n present */\n MQLONG KnownDestCount; /* Number of local queues opened\n successfully */\n MQLONG UnknownDestCount; /* Number of remote queues opened\n successfully */\n MQLONG InvalidDestCount; /* Number of queues that failed to\n open */\n MQLONG ObjectRecOffset; /* Offset of first object record\n from start of MQOD */\n MQLONG ResponseRecOffset; /* Offset of first response record\n from start of MQOD */\n MQPTR ObjectRecPtr; /* Address of first object record */\n MQPTR ResponseRecPtr; /* Address of first response\n record */\n /* Ver:2 */\n MQBYTE40 AlternateSecurityId; /* Alternate security identifier */\n MQCHAR48 ResolvedQName; /* Resolved queue name */\n MQCHAR48 ResolvedQMgrName; /* Resolved queue manager name */\n /* Ver:3 */\n MQCHARV ObjectString; /* Object long name */\n MQCHARV SelectionString; /* Message Selector */\n MQCHARV ResObjectString; /* Resolved long object name*/\n MQLONG ResolvedType; /* Alias queue resolved object type */\n /* Ver:4 */\n };\n\n #define MQOD_DEFAULT {MQOD_STRUC_ID_ARRAY},\\\n MQOD_VERSION_1,\\\n MQOT_Q,\\\n {\"\"},\\\n {\"\"},\\\n {\"AMQ.*\"},\\\n {\"\"},\\\n 0,\\\n 0,\\\n 0,\\\n 0,\\\n 0,\\\n 0,\\\n NULL,\\\n NULL,\\\n {MQSID_NONE_ARRAY},\\\n {\"\"},\\\n {\"\"},\\\n {MQCHARV_DEFAULT},\\\n {MQCHARV_DEFAULT},\\\n {MQCHARV_DEFAULT},\\\n MQOT_NONEI'm wondering if the module fills in the defaults and is letting you override then with the hash. If so, is 'DeviceName' really the right key? I would think it would match the WMQ field name or constant.Update: Perthe exampleat the link provided, the hash key does indeed match the field name from the cmqc.h.Update #2 respond to comment: Object types as defined in cmqc.h are:/* Object Types */\n #define MQOT_NONE 0\n #define MQOT_Q 1\n #define MQOT_NAMELIST 2\n #define MQOT_PROCESS 3\n #define MQOT_STORAGE_CLASS 4\n #define MQOT_Q_MGR 5\n #define MQOT_CHANNEL 6\n #define MQOT_AUTH_INFO 7\n #define MQOT_TOPIC 8\n #define MQOT_CF_STRUC 10\n #define MQOT_LISTENER 11\n #define MQOT_SERVICE 12\n #define MQOT_RESERVED_1 999My understanding of the PHP, Perl and most other similar efforts is that they are a very thin wrapper over the C API. The Perl one simply generates most of the code directly from the cmqc.h and other C include files and therefore all the field names and defaults exactly match those include files. This module appears to have taken a similar approach and I would expect to use the defined names and field defaults where needed.I'm thinking something like:$mqods = array(\n 'StrucID'=>'OD ',\n 'Version'=>1.\n 'ObjectType'=>1,\n 'ObjectName'=>'MYPUTQUEUE', \n 'ObjectQMgrName'=>'MYQUEUEMANAGER'\n 'DynamicQName'='',\n 'AlternateUserId'='',\n 'RecsPresent'=>0,\n 'KnownDestCount'=>0,\n 'UnknownDestCount'=>0,\n 'InvalidDestCount'=>0,\n 'ObjectRecOffset'=>0,\n 'ResponseRecOffset'=>0,\n 'ObjectRecPtr'=>NULL,\n 'ResponseRecPtr'=>NULL\n);Update #3 respond to additional comments:The Q Mgr will accept any version of the MQOD but will fall back to that level of functionality. If you use v1 you can test out that it works. If you want to use later versions of the MQOD then you will need to add the additional fields to the hash.The 2009 is \"Connection Broken.\" Essentially the QMgr didn't like something and terminated your connection. Usually the meaningful error messages for that return code are in/var/mqm/qmgrs//errors/AMQEER01.LOG.\n"}
+{"text": "### Human: Is there a WebSphere MQ .NET API I can download ?\nI am basically trying to write a C# app that listens for messages in an MQ queue.### Assistant: MQ, since v5.3 fixpack 8 on Windows, includes amqmdnet.dll, a .NET assembly that provides managed-code programming model for MQSeries. It's supported by IBM.IBM Calls it the \"MQ Classes for .NET\"If you have MQ, you probably have this assembly.C:\\Program Files\\IBM\\WebSphere MQ\\bin\\amqmdnet.dllReference\n"}
+{"text": "### Human: Hi does anyone know how to create a message listener using IBM MQ? I know how to do it using the JMS spec but I am not sure how to do it for IBM MQ. Any links or pointers are greatly appreciated.### Assistant: Although there is a WMQ Java API as noted by the previous responders, WMQ supports JMS as well so here are some resources to get you started there.Take a look at this article:IBM WebSphere Developer Technical Journal: Running a standalone Java application on WebSphere MQ V6.0Also, if you have installed the full WMQ client and not just grabbed the jars then you will have lots of sample code installed. By default, these will live in C:\\Program Files\\IBM\\WebSphere MQ\\tools\\jms or /opt/mqm/samp depending on your platform.If you need the WMQ Client install media, get ithere. Note that this is the WMQ v7 client and not the v6 client. It is compatible with the v6 QMgr but since v6 is end-of-life as of September 2011 you should be doing new development on the v7 client and, if possible, a v7 QMgr. There are a lot of functional and performance enhancements available if both sides are v7.You can get the product manualhereif you need it.Finally, please be sure when you get a JMS exception to print the linked exception. This is not a WMQ thing, rather it's a JMS thing. Sun provided a multi-level data structure for JMS exceptions and the really interesting parts are often in the nested level. This is not a big deal and can be implemented in a few lines:try {\n .\n . code that might throw a JMSException\n .\n} catch (JMSException je) {\n System.err.println(\"caught \"+je);\n Exception e = je.getLinkedException();\n if (e != null) {\n System.err.println(\"linked exception: \"+e);\n } else {\n System.err.println(\"No linked exception found.\");\n }\n}This helps to determine the difference between a JMS error versus a transport error. For example a JMS security error might be a WMQ 2035, or it might be the JSSE configuration, or the app might not have access to something in the file system. Only one of these is worth spending a lot of time digging through the WMQ error logs for and only by printing the linked exception will you be able to tell if it's that one.\n"}
+{"text": "### Human: I receive a message from a WebSPhere MQ queue. I try to process and if i receive some exceptions i want to rollback the message to the MQ Queue.I have no problems in doing the same. What happens to the message? Does it go to the bottom of the queue?If i try and pull a message from the queue would i receive the same message that i rolledback?What is the behaviour likely to be? I want to know this behaviour typically in a high volume Queue scenario?Appreciate any inputs.Thanks,\nManglu### Assistant: If you are doing queue operations within the scope of a transaction, and a rollback occurs, then after the transaction resolves the queue and message will appear just as it did before the transaction began. In other words no changes at all.In a high volume scenario, though, it is typical to have multiple transactional readers and writers on a single queue, and they do not lock the entire queue for each de-queue or enqueue.These readers and writers will insert items into the queue, or dequeue items from the queue transactionally, while your doomed transaction is resolving. In that case, other queue items may appear or disappear (or both).If after rollback of the original transaction, you again dequeue from the queue, youmayget the original message, but you may not. In a high-volume, high-concurrency scenario, it is possible that another reader will have pulled the message before your code can do so.\n"}
+{"text": "### Human: I need to write a .Net connector to WebSphere MQ queues so I've installed a trial version of IBM WebSphere MQ on my Windows 7 machine. I initially setup some dummy queues in MQ Explorer to play with the setup process and I was able to connect to those queue managers and create queues. I deleted those dummy queues and followed the first set of instructionsfrom Lesson 1.1 from IBM herewhere I created some queues from the command lineI failedto run Lesson 1.2because of security issues, and I now cannot connect to any queue managers in MQ Explorer. when I try to connect I get the error messageAn unexpected error (2063) has occurred. (AMQ4999)I am local admin on my machine.I've added myself to the mqm group that was createdI've run the MQ Explorer both with and without the 'Run as Administrator' optionI've uninstalled MQ and re-installed itI've rebooted several timesI've also noticed that when I create a queue manager in MQ Explorer, the last part fails withAMQ8135: Not authorized.(see output below)Is there something obvious that I am missing?Is there some way that I can work out what the problem is myself - the log files don't seem to give me any idea where to look****************************************\n* Command: \"C:\\Program Files (x86)\\IBM\\WebSphere MQ\\bin\\crtmqm\" -sa QM1\n****************************************\nThere are 90 days left in the trial period for this copy of WebSphere MQ.\nWebSphere MQ queue manager created.\nDirectory 'C:\\Program Files (x86)\\IBM\\WebSphere MQ\\qmgrs\\QM1' created.\nThe queue manager is associated with installation 'Installation2'.\nCreating or replacing default objects for queue manager 'QM1'.\nDefault objects statistics : 74 created. 0 replaced. 0 failed.\nCompleting setup.\nSetup completed.\nexitvalue = 0\n****************************************\n* Command: \"C:\\Program Files (x86)\\IBM\\WebSphere MQ\\bin\\strmqm\" QM1\n****************************************\nThere are 90 days left in the trial period for this copy of WebSphere MQ.\nWebSphere MQ queue manager 'QM1' starting.\nThe queue manager is associated with installation 'Installation2'.\n5 log records accessed on queue manager 'QM1' during the log replay phase.\nLog replay for queue manager 'QM1' complete.\nTransaction manager state recovered for queue manager 'QM1'.\nWebSphere MQ queue manager 'QM1' started using V7.1.0.0.\nexitvalue = 0\n****************************************\n* Command: \"C:\\Program Files (x86)\\IBM\\WebSphere MQ\\bin\\runmqsc\" QM1\n* Input: DEFINE LISTENER('LISTENER.TCP') TRPTYPE(TCP) PORT(1414) CONTROL(QMGR)\n****************************************\n5724-H72 (C) Copyright IBM Corp. 1994, 2011. ALL RIGHTS RESERVED.\nStarting MQSC for queue manager QM1.\nAMQ8135: Not authorized.\nNo MQSC commands read.\nNo commands have a syntax error.\nAll valid MQSC commands were processed.\nexitvalue = 20### Assistant: If you have a recent trial version of WMQ then you are working with a v7.1 QMgr. As of v7.1 WMQ will allow only non-privileged remote connections. In order to connect with an administrator account, it will be necessary to either disable the restrictions or, better yet, to define a new channel for the administrative connection and authenticate it.With Windows the biggest issue is that WMQ authenticates domain IDs and must look up their groups. One very common problem when running WMQ in a corporate environment is that it attempts to lookup an ID or group and does not have the domain rights to do so.Domain accounts, even those with local admin rights, often fail because they don't have access to inquire in the domain SAM to do group lookups. There's a whole section in the Infocenterheredescribing the requirements for Windows accounts.One workaround for thisfor dev environments onlyis to create a local administrator's account, then log on with that and create the QMgr. Or make sure that the default accountMUSR_MQADMINhas local admin rightsand login rights. Again,, you must actually log in with the account to make this work because that way there is never a requirement to look up an account in Active Directory because it all hits the local SAM database. Again, this is just for development! In Production you'd want to use a real domain account and grant it the correct access rights to do SAM lookups but NOT make it a local admin, as described in the Infocenter section linked above.Assuming that you have succeeded in creating the QMgr, next create a new channel and authorize it to accept yourlocalconnections using the admin account:runmqsc\n* Define the channel, anyone connecting runs as MUSR_MQADMIN\nDEFINE CHL('DOTNET.SVRCONN') CHLTYPE(SVRCONN) MCAUSER('MUSR_MQADMIN@hostname')\n\n* Override default block-list - channel now allows ANYBODY\nSET CHLAUTH('DOTNET.SVRCONN') TYPE(BLOCKUSER) USERLIST('nobody')\n\n* Block access from ALL IP addresses\nSET CHLAUTH('DOTNET.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS) WARN(NO) ACTION(ADD)\n\n* Allow access from local host only\nSET CHLAUTH('DOTNET.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('127.0.0.1') USERSRC(CHANNEL) ACTION(ADD) \n\nENDNow you have a channel that will accept local connections ONLY, map these to an administrative account and then override the security that prevents administrative accounts from connecting remotely. Using the admin account means that no queue or QMgr authorizations are required and the account being a local admin means that there are no domain lookup issues. TheMCAUSER('MUSR_MQADMIN)converts every remote ID to the local admin ID so that WMQ doesn't need to look up the remote IDs. The mapping rule restricts connections to the local host only. Anyone who can connect to the channel will have local admin on the box with the ability to remotely execute OS code so if you wanted to accept connections from other users, authenticating them with certificates would be recommended.\n"}
+{"text": "### Human: I'm writing a .NET Windows Forms application that will post a message to a Websphere MQ queue and then poll a different queue for a response. If a response is returned, the application will partially process the response in real time. But the response needs to stay in the queue so that a daily batch job, which also reads from the response queue, can do the rest of the processing.I've gotten as far as reading the message. What I haven't been able to figure out is how to read it without removing it.Here's what I've got so far. I'm an MQ newbie, so any suggestions will be appreciated. And feel free to respond in C#.Public Function GetMessage(ByVal msgID As String) As MQMessage\n Dim q = ConnectToResponseQueue()\n Dim msg As New MQMessage()\n Dim getOpts As New MQGetMessageOptions()\n Dim runThru = Now.AddMilliseconds(CInt(ConfigurationManager.AppSettings(\"responseTimeoutMS\")))\n System.Threading.Thread.Sleep(1000) 'Wait for one second before checking for the first response'\n While True\n Try\n q.Get(msg, getOpts)\n Return msg\n Catch ex As MQException When ex.Reason = MQC.MQRC_NO_MSG_AVAILABLE\n If Now > runThru Then Throw ex\n System.Threading.Thread.Sleep(3000)\n Finally\n q.Close()\n End Try\n End While\n Return Nothing 'Should never reach here'\nEnd FunctionNOTE:I haven't verified that my code actually removes the message. But that's how I understand MQ to work, and that appears to be what's happening. Please correct me if that's not the default behavior.### Assistant: You need to open the queue with MQOO_BROWSE option. Then on your first read you do a GET using the MQGMO_BROWSE_FIRST option. Finally, your subsequent GET's should use the MQGMO_BROWSE_NEXT option.Note: MQOO is MQ open options and MQGMO is MQ Get Message Options.\n"}
+{"text": "### Human: hi I am new to Spring JMS and websphere MQ. Can Any one give me step by step processs or example how to receive message from websphere MQ and be able to print that message in console\nthanks u very much for your help### Assistant: Here is a working sample using Spring MDP/Activation Spec for websphere MQmdp-listener.xml\n\n\n\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \nweb.xml\n contextConfigLocation\n /WEB-INF/context/mdp-listener.xml\n \n\n\n org.springframework.web.context.ContextLoaderListener\nSpringMdppackage com.rohid.samples;\n\n import javax.jms.JMSException;\n import javax.jms.Message;\n import javax.jms.MessageListener;\n import javax.jms.TextMessage;\n\n public class SpringMdp implements MessageListener {\n\n public void onMessage(Message message) {\n try {\n if(message instanceof TextMessage) {\n System.out.println(this + \" : \" + ((TextMessage) message).getText());\n }\n\n } catch (JMSException ex){\n throw new RuntimeException(ex);\n }\n }\n }'\n"}
+{"text": "### Human: I have an instance of WebSphere 6 and an instance of WebSphere 7. Each has a WebSphere MQ messaging provider, a queue connection factory and a queue configured in a similar way. All user ID fields are left empty and Authentication aliases left at \"none\".In WAS6 it works fine.In WAS7 I get an error:JMSWMQ2013: The security authentication was not valid that was supplied for QueueManager 'MYQMNGR' with connection mode 'Client' and host name '10.11.22.33(51001)'.; nested exception is com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2013: The security authentication was not valid that was supplied for QueueManager 'MYQMNGR' with connection mode 'Client' and host name '10.11.22.33(51001)'. Please check if the supplied username and password are correct on the QueueManager you are connecting to; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').What may be different in the way WAS7 connects to MQ compared to WAS6 if no user ID is supplied?I don't have any visibility or access to that MQ (version 7), it doesn't require user ID when accessing from WAS 6 so I need to get WAS7 to work the same.### Assistant: In WAS 6 if you left the user ID in the administration panel blank, a blank was passed to WMQ. WMQ will run the channel even if it cannot determine the remote user and in that case the channel runs with the authority of the Message Channel Agent (MCA), which is always administrative. Hence, in V6, it works.As of V7, the WMQ client will try a little harder to determine what ID to pass if you leave it blank in the WAS admin panel and will obtain the JVM ID and pass that on theCONNECTcall. This is the source of the 2035.The right way to fix this is that the WMQ administrator should place a low-privileged ID in the SVRCONN channel's MCAUSER field. The ID should be authorized to whatever queues the Java EE server needs but not to the command queue and various other administrative queues. This will resolve the problem that WAS 7 is sending an unrecognized IDandit prevents remote clients of any type from gaining admin access on that channel.The alternative is to go to the WAS admin panel for the WMQ connection and set the user ID tomqm. (This works if if WMQ runs on a distributed non-Windows system. If WMQ is running on Windows, z/OS or something else, substitute the platform equivalent ID here.) Although this will get WAS up and running, it does not address the fact that the QMgr exposes administrative access.Please see the WMQ Hardening presentation and lab athttp://t-rob.net/linksfor a more comprehensive explanation of how to identify and remediate the underlying security exposure at the QMgr.\n"}
+{"text": "### Human: I am trying to make an common abstract interface over the messaging infrastructure in our company. The design goal is to 2 fold. 1 is to hide the complexity of programming from the developers (i know its not very complex but still simplify it further) and 2 is to make the developers independent of the vendor specific messaging infrastructure (i.e. it can be MQSeries or EMS or MSMQ).The very common option is using the WCF layer over the messaging infrastructure. Use the MQSeries Custom channel for WCF or use EMS custom channle for WCF. But both are ruled out due to lack of proper version of MQSeries and EMS.Can someone please suggest what are the possible solutions to this problem. One which i can think of the to have a custom wrapper like JMS. Has anyone ever tried something similar before. Any help would be fantastic.by the way, i am trying to create this wrapper in C# 3.5.Regards### Assistant: There'sNMS, which is a .NET implementation of the JMS protocol. It comes with a provider which works with ActiveMQ as the underlying message broker.It might also be worth checking out some of the excellent open source Service Bus implementations for .NET which provide further useful messaging abstractions:NServiceBus,MassTransitandRhino Service Buscome to mind.\n"}
+{"text": "### Human: I have WebSphere MQ and WebSphere Message Broker installed on Linux and when I executemqsicreateexecutiongroupI get an error saying:BIP1046E: Unable to connect with the queue manager (Could not connect to queue manager 'NSPZPAI1' (MQ reason code 2538)).When I search for this reason code I understand that it is ahost not available error.Can somebody please tell me how to resolve this error?When I run arunmqlsrcommand I always end up in a hang. Can somebody tell me how to start a listener?### Assistant: Don't start the listener by hand or script. If you have a modern queue manager, define a listener object like so:DEF LISTENER(LISTENER.1414) TRPTYPE(TCP) +\n CONTROL(QMGR) PORT(1414) +\n REPLACE\n\nSTART LISTENER(LISTENER.1414)The attributeCONTROL(QMGR)tells the QMgr to start the listener automatically when the QMgr is started and to kill the listener when the QMgr is shut down. This ensures that the listener will always be started when the QMgr comes up, even if the QMgr is started manually instead of from the usual boot script. Because the listener is a child process of the QMgr it willalwayscome down with the QMgr so you don't need to worry about orphaned listeners preventing connections after a QMgr restart.Once the listener is defined, you can also useSTART LISTENERorSTOP LISTENERMQSC commands to manually start and stop it independently of the QMgr. In the example above, I've manually started the listener rather than reboot the QMgr. Either would work but theSTARTcommand is less intrusive.\n"}
+{"text": "### Human: I am using Spring JMS to connect to a Websphere MQ server. I implemented the SessionAwareListener interface to create a custom listener, reusing old code for the business logic.While testing, the listener throws a StringIndexOutOfBoundsException, which I fail to catch. However, I see in the log the following printed about 32 times, then the DMLC stops.WARN - Execution of JMS message listener failedIs there a way to control how often the DMLC will retry a message, and how to handle uncaught exceptions?### Assistant: You can always check the JMSDeliveryCount. If it is more than the number you consider as maximum then just don't process the message and return.You can alsoconfigure your Websphereto move the bad message to the exception destination after some attempts.\n"}
+{"text": "### Human: The JMS 2.0 specification saysTheJMSMessageIDheader field contains a value that uniquely\n identifies each message sent by a provider....and...The exact scope of uniqueness is provider defined. It should at least\n cover all messages for a specific installation of a provider where an\n installation is some connected set of message routers.The specification does not explicitly state that theJMSMessageIDreturned from the publish API call must match the one present in the message when it is consumed. The discussion in the spec about moving theJMSMessageIDto theJMSCorrelationIDwhen replying to a request implies that the two would be the same. If the message ID was changed between publication and consumption, this style of request/reply would fail.Certainly in the unified domain model of JMS 1.1 and now 2.0, it would not make sense for the behavior of theJMSMessageIDto change depending on whether the destination is a queue or a topic. Under the unified model, one would expect all destinations to act alike in this regard.Also, if \"provider\" as used in the first paragraph refers to the thing that is sending messages, then a publication that fanned out to 10 identical messages, with identicalJMSMessageIDvalues, would meet the spec since uniqueness is measured at the sending side.Unfortunately, the specification liberally switches between using the term \"provider\" to describe the thing sending messages versus using it to describe the vendor of the JMS transport. This is evident in the two quoted passages above. This ambiguity doesn't help matters any.At least one implementation (IBM's MQ) takes the approach that a publication fanning out to 10 messages has created 10 unique, new messages, and therefore each of these has a uniqueJMSMessageIDvalue. This is arguably consistent with the second quoted passage which requires uniqueness scoped to the provider, where \"provider\" appears to refer to the vendor implementation andnotthe thing sending messages.It is my belief that when a published message fans out to multiple subscribers the correct behavior would be that theJMSMessageIDwould be preserved in each instance of the message so that replies can be correlated as expected. In other words, I believe IBM's implementation to be non-compliant. Since the specification is ambiguous on the matter, I'm looking for an authoritative source which either states outright or strongly implies the behavior as intended by the spec, one way or the other. Depending on the response, I'll either stand down, or else raise the issue with IBM as a compliance defect.### Assistant: The term \"provider\" here is simply a reference to the specific messaging product being used, and covers both client-side and server-side components. To avoid confusion, I'll use the word JMS product vendor here.The purpose of the JMS specification is to define a Java API implemented by that messaging product. It uses loose terms like \"provider\" because the JMS spec does not define how the product is architected and is trying to avoid suggesting how the implementation should be shared between client-side and server-side components, or even whether there is a server (or cluster of servers) at all. You'll notice the spec never (well, almost never) says \"the server does this\" or \"the server does that\".The sentence about the \"exact scope of uniqueness\" is there to make it easy for the JMS product vendor to implement the code that generatesJMSMessageIDvalues. It's saying that the code that generatesJMSMessageIDvalues doesn't need to worry about ensuring that the values generated are unique across the entire universe. It's sufficient to ensure that they are unique to that particular product installation.You say that \"The specification does not explicitly state that theJMSMessageIDreturned from the publish API call must match the one present in the message when it is consumed.\"I think this is stated in Section 4.4.11 \"How message header values are set\". This states that theJMSMessageIDis set by the \"JMS provider send method\". The same section goes on to say that \"Message header fields that are defined as being set by the 'JMS provider send method' will be available on the sending client as well as on the receiving client.\"This means that after the call to send() or publish() has returned, the sending application can use the methodgetJMSMessageID()to find the message ID that was assigned to that message. When this message is received, the receiving application can use the same method, and get the same value.Each message sent to a topic is delivered to every subscriber on that topic. These subscribers will receive a separate copy of the same message, with the same body, properties and headers, includingJMSMessageIDvalue.Feel free to argue; the JMS spec is not free of ambiguities.\n"}
+{"text": "### Human: Closed.This question is seeking recommendations for books, tools, software libraries, and more. It does not meetStack Overflow guidelines. It is not currently accepting answers.We don\u2019t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.Closed5 years ago.Improve this questionI'm seeing downloads for 7.0.1.8 off the IBM website but at the same time I see 7.1.0.1 around. I do not see the download for the client of 7.1.0.1 though...### Assistant: The WMQ clients are available asSupportPacs. You can download one of the following:WMQ V7.0 Client == SupportPac MQC7 -Withdrawn no longer supportedWMQ V7.1 Client ==SupportPac MQC71WMQ V7.5 Client ==SupportPac MQC75IBM MQ V8.0 Client ==SupportPac MQC8IBM MQ V9.0 Client ==SupportPac MQC9Be sure to use the Knowledge Center for the version of client you are using!WMQ V7.0.1 Knowledge CenterWMQ V7.1 Knowledge CenterWMQ V7.5 Knowledge CenterWMQ V8.0 Knowledge CenterWMQ V9.0 Knowledge Center\n"}
+{"text": "### Human: We have a Java application that sends JMS message via IBM WebSphere MQ. The consumer application requires the message content type to be set to \"application/json\". How can I go about doing it?I've checked through a few references and it seems I can set extra header via method \"setStringProperty(headerKey, headerName)\", E.g.Message jmsMsg = session.createTextMessage(msgStr);\njmsMsg.setStringProperty(\"Content-Type\", \"application/json\");The problem then is \"Content-Type\" is not a valid property key since it contains the \"-\" character.Is this something that can be done in code? Or is it actually configured in the queue settings?### Assistant: The property name \"Content-Type\" has a '-' character. According to JMS specifications a property name can contain any character for which the JavaCharacter.isJavaIdentifierPartmethod returns atrue. For '-' characterisJavaIdentifierPartmethod returnsfalse. Hence thesetStringProperty(\"Content-Type\", \"application/json\")method call fails with the following exception.com.ibm.msg.client.jms.DetailedMessageFormatException: JMSCC0049: The property name 'Content-Type' is not a valid Java(tm) identifier.\nThe supplied property name does not conform to the allowed format described in the JMS specification.\nCheck the characters used in the property name and modify as necessary.If it's possible to change the receiving application, you could opt for\"Content_Type\"(Use an underscore) as property name instead of\"Content-Type\".\n"}
+{"text": "### Human: I need to listen to multiple queues (exists in same Queue Manager). I have the working spring boot application code for listening to single queue. But is there any way I can connect to multiple queues from the single spring boot application?Also is there anyway if I can switch listeners from one queue to another queue at runtime?I have the code to read from single queue which is as follows:public class ConnectionConfiguration {\n\n private static final Logger logger = LogManager.getLogger(ConnectionConfiguration.class);\n\n @Value(\"${LDR_LOCAL_MQ_READ_FACTORYNAME}\")\n String connectionFactory;\n\n @Value(\"${LDR_LOCAL_MQ_QUEUENAME}\")\n String localQueue;\n\n @Value(\"${jmsConcurrency}\")\n String concurrency;\n\n @Value(\"${servers.mq.host}\")\n private String host;\n\n @Value(\"${servers.mq.port}\")\n private Integer port;\n\n @Value(\"${servers.mq.queue-manager}\")\n private String queueManager;\n\n @Value(\"${servers.mq.channel}\")\n private String channel;\n\n @Value(\"${servers.mq.queue}\")\n private String queue;\n\n @Value(\"${servers.mq.timeout}\")\n private long timeout;\n\n @Bean\n public ConnectionFactory connectionFactory() {\n\n JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();\n jndiObjectFactoryBean.setResourceRef(true);\n jndiObjectFactoryBean.setJndiName(connectionFactory);\n try {\n jndiObjectFactoryBean.afterPropertiesSet();\n } catch (IllegalArgumentException e) {\n logger.error(e.getMessage(), e);\n e.printStackTrace();\n } catch (NamingException e) {\n logger.error(e.getMessage(), e);\n e.printStackTrace();\n }\n return (ConnectionFactory) jndiObjectFactoryBean.getObject();\n }\n\n @Bean\n public MQQueueConnectionFactory mqQueueConnectionFactory() {\n MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n try {\n mqQueueConnectionFactory.setHostName(host);\n mqQueueConnectionFactory.setQueueManager(queueManager);\n mqQueueConnectionFactory.setPort(port);\n mqQueueConnectionFactory.setChannel(channel);\n mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n mqQueueConnectionFactory.setCCSID(1208);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return mqQueueConnectionFactory;\n }\n\n @Bean\n public SimpleMessageListenerContainer queueContainer(MQQueueConnectionFactory mqQueueConnectionFactory) {\n\n SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();\n container.setConnectionFactory(mqQueueConnectionFactory);\n container.setDestinationName(queue);\n container.setMessageListener(getListenerWrapper());\n container.start();\n return container;\n }\n\n @Bean\n public MQListener getListenerWrapper() {\n return new MQListener();\n }\n\n @Bean\n public JmsTemplate getJmsTemplate() {\n try {\n return new JmsTemplate(mqQueueConnectionFactory());\n } catch (Exception exp) {\n logger.error(exp.getMessage(), exp);\n }\n return null;\n }\n\n}### Assistant: Just add a listener container bean for each queue.To change the queue, callstop(), thenshutdown(), change the destination, theninitialize(), thenstart().\n"}
+{"text": "### Human: I'm using theIBM.XMS libto talk to WebSphereMQ.When receiving messages using the synchronous method, eg:using (var scope = new TransactionScope(TransactionScopeOption.Required, transactionOptions))\n{\n message = consumer.Receive(1000);\n\n if (message != null)\n {\n //Do work here\n scope.Complete();\n }\n}But if I want to use the asynchronous method:consumer.MessageListener = delegate(IMessage msg)\n{\n //Do work here\n //But where do I put TransactionScope?\n};I can't work out how to wrap theMessageListenercallback within aTransactionScope.Does anyone know how to do this?### Assistant: A message listener a.k.a Asynchronous Consumer can't be used in aTransactionScopeas the message listener runs on a different thread than the thread that created theTransactionScope. You can only use the synchronous Receive/Send inside aTransactionScope.Thislinksays \"The XA transactions are not supported in asynchronous consumers.\"\n"}
+{"text": "### Human: I have a requirement that I need to process JMS Messages (via MDB) in a way that Messages belonging to a certain group (a group ID is set) are consumed by the same bean instance. The behaviour I require in this is that Messages with the same group ID are processed sequentially (though message ordering is irrelevant), and tying them to the same MDB-instance should provide that.The messages do not carry any kind of sequence number (as it is irrelevant) and we do not know what the first or last message in a group is (there could theoratically \"never\" be a last message in a group). We want them to be delivered as soon as the consumer is able to receive them.ActiveMQ provides this exact feature (http://activemq.apache.org/message-groups.html) by simply setting JMSXGroupID. We are bound to WebSphere MQ, though. All I've found out so far is that it is possible to collect Messages of the same group in the queue and using a MessageSelector to receive a \"Last Message in Group\" Message as described inhttp://www.ibm.com/developerworks/websphere/library/techarticles/0602_currie/0602_currie.html. We would prefer a cleaner way though (like in ActiveMQ). Does anyone know how to achieve that behaviour in WebSphere?Thanks!### Assistant: Generally you use MessageSelectors in IBM product implementations of JMS (both WebSphere MQ and SIBus implementations). These are the equivalent of a filter that would scan the header of an HTTP or SOAP message for web-based protocols.Though it may not be what you want, it actually is a clean and well thought through design.However, if you do not want to use MessageSelectors, you will probably have to build your own and \"process\" a message with a fronting MDB that scans the headers, and then forwards the message to an appropriate queue, where only the MDB that cares about the grouped messages will process them (sort of a gateway/message selector pattern).If you are using the \"pure\" JMS API's, then you can ask the Session object to create a MessageConsumer with the specified selector string (value in the header) you want to filter on (again you have to set this yourself).//assume we have created a JMS Connection and Session object already.\n//and looked up the Queue we want already.\nMessageConsumer consumerWithSelector = session.createConsumer(queue, groupId);This is all the pure JMS API's give you. Anything else is purely up to the implementer of the messaging technology, which is then proprietary to their implementation and not portable code.\n"}
+{"text": "### Human: While browsing the messages in MQ explorer, it only displays the first 1000 characters. We are not able to see the complete message. Is there any freeware available that can be used to view the complete message ?### Assistant: Before switching to something else, have you tried adjusting the WMQ Explorer settings?First, get to the Preferences dialog:Then select the Messages panel and adjust the value:The reason that WMQ Explorer has these defaults set is to prevent an apparent \"hang\" if there were, for example, 3500 messages of size 64k. Given these defaults, Explorer will download no more than 500 of them and only the first 10k bytes of each. Given the defaults, Explorer can browse a deep queue with large messages and still return in a predictable amount of time.The same issues hold true for any other browser tool since the bottleneck is the network and not the tool.That said, if you want to look at other desktop client tools,SupportPac MO71is quite popular.\n"}
+{"text": "### Human: I am using a JMS client. The queue is a IBM MQ. When I write data on the queue, it is added with the RFH header. How can I strip the RFH header. I cannot use IBM MQ apis.### Assistant: Another way is using the queue URI attributes (http://www.ibm.com/support/knowledgecenter/api/content/nl/en-us/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q032240_.htm#q032240___q032240_4).\nThe attributetargetClientcontrols whether to use RFH or native format.Queue queue = queueSession.createQueue(\"queue:///\" + queueName + \"?targetClient=1\");\n"}
+{"text": "### Human: I made a java app that uses JMS to send messages to an MQ Queue. I set the message id and correlation id with the setJMSMessageId() and setJMSCorrelationId(). The messageId seems to be overwritten when the sending ends. I googled a bit, and seems that the server overwrites the messageId even when you send it.The requirement for this app is that both messageId and correlationId have the same value when sent and when received. Isn't there anything I can do about this?Note: I am using JDK 1.6, and a WAS 8.5 to deploy the app. This WAS communicates with a MQ Queue Manager.### Assistant: Message ids are reserved for the messaging system to set. You can read it and, e.g., log or even persist it, but nothing else. Esp., it's not supposed to be set by an application! The setter is there only when bridging between two messaging systems, i.e. when you receive a message from one messaging system X and forward it to a different messaging system Y. Then Y needs to be able to set the message id of that message object, even though Y has not created it, i.e. even though it's not Y's own implementation. There are several methods for this use case and it's causing a lot of confusion; it's best to just ignore them.OTOH, correlation ids are for your application to use. A very common pattern is arequest-responsepair of messages, and this is the second source of confusion:An original sender A sends a message to a destination D with the reply-to header field set to a destination D' where A expects to receive the replies. The message id is set by the messaging system when A calls one of the varioussendmethods, and A stores this message id.Then B receives the message, handles the business logic, and replies to D'. It also sets the correlation id to the message id of the message it just received. The reply message also gets a new message id from the messaging system, but that is irrelevant for this pattern.Finally A receives the reply message from D', reads the correlation id, and uses that to look up the message id it has stored in step 1.There are a lot of other message exchange patterns, like one-request-many-replies or unsolicited messages, and the proper use of correlation ids is essential; but request-reply is by far the most common. That's why it's even suggested in the JavaDoc. Otherwisemessage ids have nothing to do with correlation ids. This is confusing for beginners. I even found it preferable to correlate messages with business keys instead of message ids.Coming back to your question: as you set the correlation id before you send the message, and the message id is set by the messaging system when you send the message, there is no way in the JMS-API to make both values the same value.\n"}
+{"text": "### Human: We have an application which needs to communicate with a Multi-Instance QueueManager. Both (instances) are running on the default port and have unique addresses.serverA.internal.company.addressserverB.internal.company.addressWe use the following code to establish the ConnectionFactory:MQQueueConnectionFactory connectionFactory = new MQQueueConnectionFactory();\nconnectionFactory.setTransportType(1);\nconnectionFactory.setPort(1414);\nconnectionFactory.setChannel(\"CLIENTCONNECTION\");\nconnectionFactory.setQueueManager(\"queue.manager.name.here\");\nconnectionFactory.setHostName(\"serverA.internal.company.address\");How can we specify both addresses so that failover is achieved without writing our own retry logic?### Assistant: using the following:connectionFactory.setConnectionNameList(\"serverA.internal.company.address(1414),\"\n + \"serverB.internal.company.address(1414)\")instead ofconnectionFactory.setHostName(\"serverA.internal.company.address\");\nconnectionFactory.setPort(1414);did the trick for us.\n"}
+{"text": "### Human: I addedcom.ibm.mqjmsmaven dependency in my pom.xml:\n com.ibm\n com.ibm.mqjms\n 5.3.07\nAnd it's giving me:The following artifacts could not be resolved: com.ibm:com.ibm.mqjms:jar:5.3.07, com.ibm:com.ibm.mq:jar:5.3.07, javax.naming:jndi:jar:1.2.1, javax.resource:connector:jar:1.0, javax.transaction:jta:jar:1.0.1B, javax.jms:jms:jar:1.1: Could not find artifact com.ibm:com.ibm.mqjms:jar:5.3.07 in central (http://repo.maven.apache.org/maven2)Any idea how can I fix it?### Assistant: Below JARs are proprietary - hence they will not resolve through a public Maven repository like Maven Central. These JARs need to be obtained from the WebSphere MQ installation directory and manually deployed to our local Maven repository.:\n com.ibm\n com.ibm.mqjms\n ${webSphereMQVersion}\n\n\n com.ibm\n com.ibm.mq.jmqi\n ${webSphereMQVersion}\n\n\n com.ibm\n com.ibm.disthub2.dhbcore\n ${webSphereMQVersion}\n\n"}
+{"text": "### Human: I am using IBM MQ Classes for JMS (IBM MQ Version 8.0.0.4) with auto-reconnection configured. According to the docs, reconnection happens implicitly. I would like to issue a simple log statement in the event of reconnection. For that reason, I need to somehow get informed, when that happens.In the IBM docs on pageApplication RecoveryI stumbled over section \"Detecting failover\" where it says:Reconnection aware:Register an MQCBT_EVENT_HANDLER event handler with\n the queue manager. The event handler is posted with MQRC_RECONNECTING\n when the client starts to try to reconnect to the server, and\n MQRC_RECONNECTED after a successful reconnection. You can then run a\n routine to reestablish a predictable state so that the client\n application is able to continue processing.Unfortunately, I did not find a code example for Java/JMS that demonstrates how and where to register such an event handler. I don't know if that is even supported in my case. Could anyone provide me to the right direction or even provide a code sample? Thank you very much.Question Update from February 5, 2020:Added the following code example created by myself, after having received Sashi's initial answer from January 27, 2020.public static void main(String[] args) {\n Connection connection = null;\n Session session = null;\n Object destination = null;\n MessageProducer producer = null;\n\n try {\n JmsFactoryFactory jmsFactoryFactory = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\n JmsConnectionFactory cf = jmsFactoryFactory.createConnectionFactory();\n\n cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, HOST);\n cf.setIntProperty(WMQConstants.WMQ_PORT, PORT);\n cf.setStringProperty(WMQConstants.WMQ_CHANNEL, CHANNEL);\n cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\n cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, QM_NAME);\n cf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_OPTIONS, WMQConstants.WMQ_CLIENT_RECONNECT);\n cf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_TIMEOUT, RECONNECT_TIMEOUT);\n\n connection = cf.createConnection();\n connection.setExceptionListener(new MQExceptionListener());\n session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n destination = session.createQueue(QUEUE);\n producer = session.createProducer((Destination)destination);\n connection.start();\n } catch (JMSException ex) {\n LOGGER.error(ex.toString());\n }\n}\n\npublic class MQExceptionListener implements ExceptionListener {\n public void onException(JMSException e) {\n System.out.println(e);\n if(e.getLinkedException() != null)\n System.out.println(e.getLinkedException());\n }\n}This is what I get in the logs:ERROR [Main.main:57] (main) com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager '' with connection mode 'Client' and host name '()'.\nCheck the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.\nERROR [Main.main:61] (main) Inner exceptions:\nERROR [Main.main:65] (main) com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').\nERROR [Main.main:65] (main) com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host '()' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9204: Connection to host '/:' rejected. [1=java.net.ConnectException[Connection refused: connect],3=/:,4=TCP,5=Socket.connect]],3=(),5=RemoteTCPConnection.bindAndConnectSocket]\nERROR [Main.main:65] (main) com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host '/:' rejected. [1=java.net.ConnectException[Connection refused: connect],3=/:,4=TCP,5=Socket.connect]\nERROR [Main.main:65] (main) java.net.ConnectException: Connection refused: connectQuestion Update from February 11, 2020:I've added this additions based on feedback received by Sashi on February 5, 2020.I have tried to build a minimal application that connects to an IBM MQ instance. Here's the code:Application.javapublic class Application {\n private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);\n\n public static void main(String[] args) {\n new Application().run();\n }\n\n private void run() {\n MQWriter writer = new MQWriter();\n int i = 1;\n while (true) {\n String message = \"Hello Testing \" + i;\n LOGGER.info(\"Sending message {} to MQ server...\", message);\n writer.write(message);\n i++;\n try {\n Thread.sleep(1000);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n }\n}MQConnectionDetails.javapublic class MQConnectionDetails {\n public static final String HOST = \"XXX.XXX.XXX.XXX\";\n public static final int PORT = 1414;\n public static final String QM_NAME = \"QM1\";\n public static final String CHANNEL = \"DEV.APP.SVRCONN\";\n public static final String QUEUE = \"DEV.QUEUE.1\";\n public static final int RECONNECT_TIMEOUT = 60; // 1 minute\n}MQWriter.javapublic class MQWriter {\n\n private static final Logger LOGGER = LoggerFactory.getLogger(MQWriter.class);\n\n private Connection connection = null;\n private Session session = null;\n private Object destination = null;\n private MessageProducer producer = null;\n\n public MQWriter() {\n try {\n JmsFactoryFactory jff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\n JmsConnectionFactory jcf = jff.createConnectionFactory();\n jcf.setStringProperty(WMQConstants.WMQ_HOST_NAME, MQConnectionDetails.HOST);\n jcf.setIntProperty(WMQConstants.WMQ_PORT, MQConnectionDetails.PORT);\n jcf.setStringProperty(WMQConstants.WMQ_CHANNEL, MQConnectionDetails.CHANNEL);\n jcf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\n jcf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, MQConnectionDetails.QM_NAME);\n jcf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_OPTIONS, WMQConstants.WMQ_CLIENT_RECONNECT);\n jcf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_TIMEOUT, MQConnectionDetails.RECONNECT_TIMEOUT);\n\n LOGGER.info(\"Initializing connection to write queue {} on {}:{}...\",\n MQConnectionDetails.QUEUE,\n MQConnectionDetails.HOST,\n MQConnectionDetails.PORT);\n connection = jcf.createConnection();\n connection.setExceptionListener(new MQExceptionListener());\n session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n destination = session.createQueue(MQConnectionDetails.QUEUE);\n producer = session.createProducer((Destination)destination);\n connection.start();\n } catch (JMSException ex) {\n LOGGER.error(\"Error initializing connection to write queue\", ex);\n }\n }\n\n public void write(String message) {\n try {\n TextMessage textMessage = session.createTextMessage(message);\n producer.send(textMessage);\n } catch (Exception ex) {\n LOGGER.error(\"Error sending message to write queue\", ex);\n }\n }\n}MQExceptionListener.javapublic class MQExceptionListener implements ExceptionListener {\n private static final Logger LOGGER = LoggerFactory.getLogger(MQExceptionListener.class);\n\n public void onException(JMSException ex) {\n LOGGER.error(\"=====\");\n LOGGER.error(ex.toString());\n if (ex.getLinkedException() != null) {\n LOGGER.error(ex.getLinkedException().toString());\n }\n LOGGER.error(\"=====\");\n }\n}The test scenario I ran is like this:Make sure, IBM MQ is available on TCP port 1414 (IBM MQ Docker container running on Amazon EC2).Run the application above (Application.java) and make sure it sends messages to the queue.Change firewall config on Amazon EC2 security groups by changing port from 1414 to 1415, which makes IBM MQ unavailable to the client.This is what I've observed:Only after 90 seconds of inactivity, the client started throwing exceptions. I do not understand, because my RECONNECT_TIMEOUT was set to 60 seconds, so 30 seconds off here.MQExceptionListener is invoked only once (the first time).There are no reason codes 2544(MQRC_RECONNECTING) only 2009(MQRC_CONNECTION_BROKEN) is present. Why is that?Here is a summary of the exceptions that got thrown:Exceptions on console:2020-02-11 09:50:16,155 INFO [Application.run:21] (main) Sending message Hello Testing 13 to MQ server...\n2020-02-11 09:50:17,285 INFO [Application.run:21] (main) Sending message Hello Testing 14 to MQ server...\n2020-02-11 09:50:18,413 INFO [Application.run:21] (main) Sending message Hello Testing 15 to MQ server...\n2020-02-11 09:50:19,555 INFO [Application.run:21] (main) Sending message Hello Testing 16 to MQ server...\n2020-02-11 09:51:45,966 ERROR [MQExceptionListener.onException:14] (JMSCCThreadPoolWorker-6) =====\n2020-02-11 09:51:45,966 ERROR [MQExceptionListener.onException:15] (JMSCCThreadPoolWorker-6) com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ1107: A problem with this connection has occurred.\nAn error has occurred with the IBM MQ JMS connection.\nUse the linked exception to determine the cause of this error.\n2020-02-11 09:51:45,966 ERROR [MQExceptionListener.onException:17] (JMSCCThreadPoolWorker-6) com.ibm.mq.MQException: MQ delivered an asynchronous event with completion code '2', and reason '2009'.\n2020-02-11 09:51:45,966 ERROR [MQExceptionListener.onException:19] (JMSCCThreadPoolWorker-6) =====\n2020-02-11 09:51:45,967 ERROR [MQWriter.write:52] (main) Error sending message to write queue\ncom.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2007: Failed to send a message to destination 'DEV.QUEUE.1'.\nJMS attempted to perform an MQPUT or MQPUT1; however IBM MQ reported an error.\nUse the linked exception to determine the cause of this error.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1288)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1245)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:76)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.sendInternal(WMQMessageProducer.java:906)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$ProducerShadow.send(WMQMessageProducer.java:566)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.send(WMQMessageProducer.java:1428)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.sendMessage(JmsMessageProducerImpl.java:855)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.synchronousSendInternal(JmsMessageProducerImpl.java:2055)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.sendInternal(JmsMessageProducerImpl.java:1993)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.send(JmsMessageProducerImpl.java:1486)\n at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:293)\n at org.example.MQWriter.write(MQWriter.java:50)\n at org.example.Application.run(Application.java:22)\n at org.example.Application.main(Application.java:13)\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)\n ... 14 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009\n at com.ibm.mq.jmqi.remote.api.RemoteHconn$ReconnectionState.recordFailure(RemoteHconn.java:4931)\n at com.ibm.mq.jmqi.remote.api.RemoteHconn.setReconnectionFailureInner(RemoteHconn.java:2650)\n at com.ibm.mq.jmqi.remote.api.RemoteParentHconn.setReconnectionFailure(RemoteParentHconn.java:152)\n at com.ibm.mq.jmqi.remote.impl.RemoteReconnectThread.bestHconn(RemoteReconnectThread.java:265)\n at com.ibm.mq.jmqi.remote.impl.RemoteReconnectThread.run(RemoteReconnectThread.java:115)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:319)\n at com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:99)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:343)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:312)\n at com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1227)\n2020-02-11 09:51:46,969 INFO [Application.run:21] (main) Sending message Hello Testing 17 to MQ server...\n2020-02-11 09:51:46,972 ERROR [MQWriter.write:52] (main) Error sending message to write queue\ncom.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2007: Failed to send a message to destination 'DEV.QUEUE.1'.\nJMS attempted to perform an MQPUT or MQPUT1; however IBM MQ reported an error.\nUse the linked exception to determine the cause of this error.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1288)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1245)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:76)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.sendInternal(WMQMessageProducer.java:906)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$ProducerShadow.send(WMQMessageProducer.java:566)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.send(WMQMessageProducer.java:1428)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.sendMessage(JmsMessageProducerImpl.java:855)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.synchronousSendInternal(JmsMessageProducerImpl.java:2055)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.sendInternal(JmsMessageProducerImpl.java:1993)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.send(JmsMessageProducerImpl.java:1486)\n at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:293)\n at org.example.MQWriter.write(MQWriter.java:50)\n at org.example.Application.run(Application.java:22)\n at org.example.Application.main(Application.java:13)\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)\n ... 14 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009\n at com.ibm.mq.jmqi.remote.api.RemoteHconn$ReconnectionState.recordFailure(RemoteHconn.java:4931)\n at com.ibm.mq.jmqi.remote.api.RemoteHconn.setReconnectionFailureInner(RemoteHconn.java:2650)\n at com.ibm.mq.jmqi.remote.api.RemoteParentHconn.setReconnectionFailure(RemoteParentHconn.java:152)\n at com.ibm.mq.jmqi.remote.impl.RemoteReconnectThread.bestHconn(RemoteReconnectThread.java:265)\n at com.ibm.mq.jmqi.remote.impl.RemoteReconnectThread.run(RemoteReconnectThread.java:115)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:319)\n at com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:99)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:343)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:312)\n at com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1227)Question Update from February 12, 2020Added this sample and findings based on JoshMc's answer from February 11, 2020. My comments on this sample:I am now using the MQ* classes and set reconnect options as suggested.Reconnect is still not happening thoughMQWriter2.javapublic class MQWriter2 {\n\n private static final Logger LOGGER = LoggerFactory.getLogger(MQWriter2.class);\n\n private Connection connection = null;\n private Session session = null;\n private Queue destination = null;\n private MessageProducer producer = null;\n\n public MQWriter2() {\n try {\n MQConnectionFactory factory = new MQConnectionFactory();\n factory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n factory.setConnectionNameList(\"XXX.XXX.XXX.XXX(1414)\");\n factory.setQueueManager(MQConnectionDetails.QM_NAME);\n factory.setChannel(MQConnectionDetails.CHANNEL);\n factory.setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT);\n factory.setClientReconnectTimeout(MQConnectionDetails.RECONNECT_TIMEOUT);\n\n LOGGER.info(\"Initializing connection to write queue {} on {}:{}...\",\n MQConnectionDetails.QUEUE,\n MQConnectionDetails.HOST,\n MQConnectionDetails.PORT);\n connection = factory.createConnection();\n connection.setExceptionListener(new MQExceptionListener());\n session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n destination = session.createQueue(MQConnectionDetails.QUEUE);\n producer = session.createProducer(destination);\n connection.start();\n } catch (JMSException ex) {\n LOGGER.error(\"Error initializing connection to write queue\", ex);\n }\n }\n\n public void write(String message) {\n try {\n TextMessage textMessage = session.createTextMessage(message);\n producer.send(textMessage);\n } catch (Exception ex) {\n LOGGER.error(\"Error sending message to write queue\", ex);\n }\n }\n}Console Output2020-02-12 08:39:11,628 INFO [MQWriter2.:29] (main) Initializing connection to write queue DEV.QUEUE.1 on 54.161.121.207:1414...\n2020-02-12 08:39:14,552 INFO [Application.run:19] (main) Sending message Hello Testing 1 to MQ server...\n2020-02-12 08:39:15,710 INFO [Application.run:19] (main) Sending message Hello Testing 2 to MQ server...\n2020-02-12 08:39:16,841 INFO [Application.run:19] (main) Sending message Hello Testing 3 to MQ server...\n...\n2020-02-12 08:39:41,973 INFO [Application.run:19] (main) Sending message Hello Testing 25 to MQ server...\n2020-02-12 08:41:27,314 ERROR [MQExceptionListener.onException:14] (JMSCCThreadPoolWorker-10) =====\n2020-02-12 08:41:27,314 ERROR [MQExceptionListener.onException:15] (JMSCCThreadPoolWorker-10) com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ1107: A problem with this connection has occurred.\nAn error has occurred with the IBM MQ JMS connection.\nUse the linked exception to determine the cause of this error.\n2020-02-12 08:41:27,314 ERROR [MQWriter2.write:49] (main) Error sending message to write queue\ncom.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2007: Failed to send a message to destination 'DEV.QUEUE.1'.\nJMS attempted to perform an MQPUT or MQPUT1; however IBM MQ reported an error.\nUse the linked exception to determine the cause of this error.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1288)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1245)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:76)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.sendInternal(WMQMessageProducer.java:906)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$ProducerShadow.send(WMQMessageProducer.java:566)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.send(WMQMessageProducer.java:1428)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.sendMessage(JmsMessageProducerImpl.java:855)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.synchronousSendInternal(JmsMessageProducerImpl.java:2055)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.sendInternal(JmsMessageProducerImpl.java:1993)\n at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.send(JmsMessageProducerImpl.java:1486)\n at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:293)\n at org.example.MQWriter2.write(MQWriter2.java:47)\n at org.example.Application.run(Application.java:20)\n at org.example.Application.main(Application.java:11)\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)\n ... 14 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009\n at com.ibm.mq.jmqi.remote.api.RemoteHconn$ReconnectionState.recordFailure(RemoteHconn.java:4931)\n at com.ibm.mq.jmqi.remote.api.RemoteHconn.setReconnectionFailureInner(RemoteHconn.java:2650)\n at com.ibm.mq.jmqi.remote.api.RemoteParentHconn.setReconnectionFailure(RemoteParentHconn.java:152)\n at com.ibm.mq.jmqi.remote.impl.RemoteReconnectThread.bestHconn(RemoteReconnectThread.java:265)\n at com.ibm.mq.jmqi.remote.impl.RemoteReconnectThread.run(RemoteReconnectThread.java:115)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:319)\n at com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:99)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:343)\n at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:312)\n at com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1227)### Assistant: You can set an ExceptionListener on connection object after creating a connection. The onException method of the ExceptionListener gets invoked when reconnection attempts are made. Here is an example:ExceptionListener exceptionListener = new ExceptionListener(){\n @Override\n public void onException(JMSException e) {\n System.out.println(e);\n if(e.getLinkedException() != null)\n System.out.println(e.getLinkedException());\n }\n };\n MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();\n connection.setExceptionListener(exceptionListener);\n"}
+{"text": "### Human: My .NET code can connect and put a message to a remote queue successfuly. However, the same code does not work with local queue. It throws 2085 error. What different setting should be set in code to make that work with local queue?Here is my code:Hashtable queueProperties = new Hashtable();\nqueueProperties[MQC.HOST_NAME_PROPERTY] = \"10.x.x.x\";\nqueueProperties[MQC.PORT_PROPERTY] = 1451;\nqueueProperties[MQC.CHANNEL_PROPERTY] = \"TST1.TRADE.CHANNEL\";\n\ntry\n{\n // Attempt the connection\n queueManager = new MQQueueManager(\"MYQUEUEMANAGER\", queueProperties);\n strReturn = \"Connected Successfully\";\n}\ncatch (MQException mexc)\n{\n // TODO: Setup other exception handling\n throw new Exception(mexc.Message\n + \" ReasonCode: \" + mexc.ReasonCode\n + \"\\n\" + GetReason(mexc.ReasonCode), mexc);\n}Here, the code is internally using the IIS user id (application pool user) to connect with MQ because this code is run as part of WCF service.### Assistant: If you run themqrcutility you can find out what the error code translates to:$mqrc 2085\n\n 2085 0x00000825 MQRC_UNKNOWN_OBJECT_NAMEThis means the queue name you are attempting to open does not exist on the queue manager you are connected to.I noted that the source you posted does not include any code related to opening the queue. You should check that the queue name you are attempting to open does in fact exist on the queue manager you are connecting to.\n"}
+{"text": "### Human: Can I use just WebSphere's jar files with standard JMS to send messages to a WebSphere MQ server, or do I need to download their WebSphere MQ Client?### Assistant: Youcanuse just the jar files for both JMS and the native Java MQ API but the question is whether you really want to. The full client install includes sample programs in source and object form, utilities, tracing and more. When you open a trouble ticket with IBM they may ask for information that you would use these tools to gather. If you do not have the full install you may not be able to provide the requested diagnostic information. For this reason, IBM supports the full client installation. If you are just trying to learn JMS and writing a toy application this is probably OK. If the application is going into Production and you may want to get support on it someday, install the client.The WMQ client install is free and available asSupportPac MQC7. It is a good is a to develop on the V7 client since it is compatible with the V6 QMgr. This saves you some testing when V6 goes out of service in September 2012.Note that the JMS Thin Client referred to in another responseis described in the Infocenter as\"a Java service integration bus JMS client designed to run as an embeddable client in Java SE applications under the IBM\u00ae, Sun and HP Java run-time environments (JREs). The client supports no transaction and local transaction models.\" As noted there it is an SI Bus client not an MQ client, has limited platform support and lacks even single-phase commit. The actual WMQ client is specific to WebSphere MQ, has broad platform support and provides single-phase commit transactionality.UPDATE:As of April 24th 2012, there is no longer a charge for the Extended Transactional Client for any version of WMQ on any platform. I've removed the portion of the answer that explained the previous license terms.\n"}
+{"text": "### Human: What is RFHUTIL. What are the uses of it?### Assistant: From theSupportPac IH03page:It allows test messages to be captured\n and stored in files, and then used to\n drive WBI Message Broker Version 7\n applications. Output messages can also\n be read and displayed in a variety of\n formats. The formats include two types\n of XML as well as matched against a\n COBOL copybook. The data can be in\n EBCDIC or ASCII. An RFH2 header can be\n added to the message before the\n message is sent.WebSphere MQ messages can contain a Rules and Formatting Header or RFH for short. The RFHUtil (and it's client-based companion RFHUtilc) allow for a wide variety of message manipulation with and without these headers. Because the headers are used extensively by WebSphere Message Broker and for v6 Pub/Sub the utility provides a convenient way to perform ad-hoc testing of message flows, publications and subscriptions. It also allows the loading and unloading of queues to files or files to queues, for example to perform regression testing against a known workload.\n"}
+{"text": "### Human: I have an error popping up after upgrading to IBM MQ 8.0 from 7.5 reason being -In MQ 8.0, a new function is introduced that requires MQ administrators using remote access to supply the userid and password. When the userid and password are not supplied or the password is incorrectError: 2035 Code : 2\nThe queue manager is configured to require a user ID and password, but none was supplied.The problem is described better in thislink.\nThere are three scenarios that are talked about. My solution would fall in Scenario A) MQ samples: Provide the user and password to the MQ client applicationI'm trying to read from the MQ using a program. Is there a way I can pass the username and password as part of the command line parameters rather than inputting it when prompted. Because this exe is invoked by my program.$ amqsputc qName qMgr### Assistant: IBM provides a client-side channel security exit calledmqccredto perform this task. The full documentation is at the link provided but in general it requires the following:Specify the exit in a CCDT file.Configure the exit by placing ID and password in an ini fileExecute therunmqccredcommand against the ini file to obfuscate the passwords.Make sure the ini file is set so that world- and group-read are disabled.Note that Java/JMS programs can easily be modified and the exit is intended mainly for programs using the native C API or that are compiled on top of that.\n"}
+{"text": "### Human: I am \"very\" new to IBM Websphere Mq, I'll try to give as much details as possible.I've got Websphere MQ 7.1 installed on Windows server 2003 running on Vmware Workstation. The Host is running Windows 7 with Websphere MQ Client and my ASP.NET application. (My application is supposed to connect to Windows server 2003 Websphere's Queue manager via SVRCONN channel, the Websphere client installed on the host is used just for testing purpose, connecting WMQ Client to WMQ Server results in an AMQ4036 access not authorized error, which leads to conclusion server configuration needed!)Both System can ping each other and are on the same local network. (did I also mentioned that port 1415 is opened and TCP listener is running on the server virtual machine?)ASP.NET code segment :queueManager = new MQQueueManager(queueManagerName, queueProperties);with queueManagerName matching the server's queue manager and queueProperties as following:queueProperties[MQC.HOST_NAME_PROPERTY] = \"192.168.203.128\";\n\nqueueProperties[MQC.PORT_PROPERTY] = 1415;\n\nqueueProperties[MQC.CHANNEL_PROPERTY] = \"QM_TEST.SVRCONN\";\n\nqueueProperties[MQC.USER_ID_PROPERTY] = \"\";\n\nqueueProperties[MQC.PASSWORD_PROPERTY] = \"\";when compiling I get the MQRC_NOT_AUTHORIZED exception and this following logs in AMQERR01.log on server side (NOTE: The IBM WMQ is installed in french language, the logs are generated in french, but I think you'll manage to understand the error.)3/04/2013 21:32:25 - Process(1120.3) User(MUSR_MQADMIN) Program(amqzmur0.exe)\n Host(HATRIXX-82HDFHA) Installation(Installation1)\n VRMF(7.1.0.2) QMgr(QM_TEST)\n\nAMQ6287: WebSphere MQ VC:\\Program Files\\IBM\\WebSphere MQ (Installation1).\n\nEXPLICATION :\nInformations syst\u00e8me WebSphere MQ : \nProduit :- Windows Server 2003, Build 3790: SP1 (MQ Windows 32-bit) \nVersion :- C:\\Program Files\\IBM\\WebSphere MQ (Installation1) \nInformations h\u00f4te :- 7.1.0.2 (p710-002-121029)\nACTION :\nAucun(e). \n-------------------------------------------------------------------------------\n13/04/2013 21:32:25 - Process(2128.11) User(MUSR_MQADMIN) Program(amqzlaa0.exe)\n Host(HATRIXX-82HDFHA) Installation(Installation1)\n VRMF(7.1.0.2) QMgr(QM_TEST)\n\nAMQ8075: L'autorisation a \u00e9chou\u00e9 car il est impossible d'obtenir le SID de\nl'entit\u00e9 'hatrix'.\n\nEXPLICATION :\nLe gestionnaire des droits d'acc\u00e8s aux objets n'a pas pu obtenir le SID de\nl'entit\u00e9 sp\u00e9cifi\u00e9e. Cet incident peut \u00eatre d\u00fb \u00e0 l'absence de la machine locale\ndu domaine (l'entit\u00e9 ne peut donc pas \u00eatre localis\u00e9e) ou \u00e0 l'inexistence de\nl'entit\u00e9.\nACTION :\nV\u00e9rifiez que l'entit\u00e9 est valide et que tous les contr\u00f4leurs de domaine requis\nsont disponibles. Il peut \u00eatre n\u00e9cessaire de cr\u00e9er l'entit\u00e9 sur la machine\nlocale. \n----- amqzfubn.c : 2227 -------------------------------------------------------\n13/04/2013 21:32:25 - Process(2524.7) User(MUSR_MQADMIN) Program(amqrmppa.exe)\n Host(HATRIXX-82HDFHA) Installation(Installation1)\n VRMF(7.1.0.2) QMgr(QM_TEST)\n\nAMQ9245: Impossible d'extraire des d\u00e9tails de compte pour l'ID utilisateur de\ncanal MCA.\n\nEXPLICATION :\nWebSphere MQ n'a pas pu extraire des d\u00e9tails de compte pour l'ID utilisateur de\ncanal MCA Hatrix. Il s'agit de l'ID utilisateur MCA pour le canal\nQM_TEST.SVRCONN sur le gestionnaire de files d'attente QM_TEST. Il peut avoir\n\u00e9t\u00e9 d\u00e9fini dans la d\u00e9finition de canal ou fourni par un exit de canal ou un\nclient.\nACTION :\nV\u00e9rifiez que l'ID utilisateur est correct et qu'il est d\u00e9fini dans le syst\u00e8me\nlocal Windows, le domaine local ou un domaine de confiance. Dans le cas d'un ID\nutilisateur de domaine, assurez-vous que que tous les contr\u00f4leurs de domaines\nn\u00e9cessaires sont disponibles. \n----- cmqxrsrv.c : 1778 -------------------------------------------------------\n13/04/2013 21:32:25 - Process(2128.11) User(MUSR_MQADMIN) Program(amqzlaa0.exe)\n Host(HATRIXX-82HDFHA) Installation(Installation1)\n VRMF(7.1.0.2) QMgr(QM_TEST)\n\nAMQ8073: Echec de l'autorisation. Le SID ((None)) n'a pas pu \u00eatre corr\u00e9l\u00e9.\n\nEXPLICATION :\nLe gestionnaire de droits d'acc\u00e8s aux objets n'a pas pu faire correspondre le\nSID sp\u00e9cifi\u00e9 \u00e0 des informations connues d'entit\u00e9 et de domaine.\nACTION :\nAssurez-vous que l'application fournit un SID reconnu sur ce syst\u00e8me, que tous\nles contr\u00f4leurs de domaines n\u00e9cessaires sont disponibles et que les r\u00e8gles de\ns\u00e9curit\u00e9 sont correctement d\u00e9finies. \n----- amqzfubn.c : 4351 -------------------------------------------------------DISPLAY CHLAUTH(QM_TEST.SVRCONN) command returns:CHLAUTH(QM_TEST.SVRCONN) TYPE(USERMAP)\n DESCR( ) CUSTOM( )\n ADDRESS(*) CLNTUSER(HATRIX)\n MCAUSER( ) USERSRC(CHANNEL)\n WARN(NO) ALTDATE(2013-04-13)\n ALTTIME(13.53.03)\nAMQ8878: Affichage des d\u00e9tails relatifs \u00e0 l'enregistrement d'authentification de\n canal.\n CHLAUTH(QM_TEST.SVRCONN) TYPE(USERMAP)\n DESCR( ) CUSTOM( )\n ADDRESS(*) CLNTUSER(MQM)\n MCAUSER( ) USERSRC(CHANNEL)\n WARN(NO) ALTDATE(2013-04-13)\n ALTTIME(13.57.59)\nAMQ8878: Affichage des d\u00e9tails relatifs \u00e0 l'enregistrement d'authentification de\n canal.\n CHLAUTH(QM_TEST.SVRCONN) TYPE(ADDRESSMAP)\n DESCR( ) CUSTOM( )\n ADDRESS(*) MCAUSER(ADMINISTRATEUR)\n USERSRC(MAP) WARN(NO)\n ALTDATE(2013-04-13) ALTTIME(01.53.52)(note that i have added couple rules, and USERID Hatrix does not exist, i have included it in a SET CHLAUTH command for testing purpose)I thought it has to do with MCAuser so I gave it a try with the MCAuser set to \"Administrateur\" (which is the admin's name on WMQ) and connecting with:queueProperties[MQC.USER_ID_PROPERTY] = \"Administrateur\";Still gives me the same error but with different server side log output:13/04/2013 21:41:18 - Process(1120.3) User(MUSR_MQADMIN) Program(amqzmur0.exe)\n Host(HATRIXX-82HDFHA) Installation(Installation1)\n VRMF(7.1.0.2) QMgr(QM_TEST)\n\nAMQ6287: WebSphere MQ VC:\\Program Files\\IBM\\WebSphere MQ (Installation1).\n\nEXPLICATION :\nInformations syst\u00e8me WebSphere MQ : \nProduit :- Windows Server 2003, Build 3790: SP1 (MQ Windows 32-bit) \nVersion :- C:\\Program Files\\IBM\\WebSphere MQ (Installation1) \nInformations h\u00f4te :- 7.1.0.2 (p710-002-121029)\nACTION :\nAucun(e). \n-------------------------------------------------------------------------------\n13/04/2013 21:41:18 - Process(2524.8) User(MUSR_MQADMIN) Program(amqrmppa.exe)\n Host(HATRIXX-82HDFHA) Installation(Installation1)\n VRMF(7.1.0.2) QMgr(QM_TEST)\n\nAMQ9776: La canal a \u00e9t\u00e9 bloqu\u00e9 par l'ID utilisateur.\n\nEXPLICATION :\nLe canal entrant 'QM_TEST.SVRCONN' a \u00e9t\u00e9 bloqu\u00e9 \u00e0 partir de l'adresse\n'192.168.203.1' parce que les valeurs actives du canal \u00e9taient mapp\u00e9es sur un\nID utilisateur qui devrai t \u00eatre bloqu\u00e9. Les valeurs actives du canal \u00e9taient\n**'MCAUSER(Administrateur) CLNTUSER(Hatrix)'.**\nACTION :\nPrenez contact avec l'administrateur syst\u00e8me qui examinera les enregistrements\nd'authentification de canal pour s'assurer que les param\u00e8tres corrects ont \u00e9t\u00e9\nconfigur\u00e9s. Le commutateur ALTER QMGR CHLAUTH permet de contr\u00f4ler si les\nenregistrements d'authentification de canal sont utilis\u00e9s. La commande DISPLAY\nCHLAUTH peut \u00eatre utilis\u00e9e pour interroger les enregistrements\nd'authentification de canal. \n----- cmqxrmsa.c : 1004 -------------------------------------------------------\n13/04/2013 21:41:18 - Process(2524.8) User(MUSR_MQADMIN) Program(amqrmppa.exe)\n Host(HATRIXX-82HDFHA) Installation(Installation1)\n VRMF(7.1.0.2) QMgr(QM_TEST)\n\nAMQ9999: Le canal 'QM_TEST.SVRCONN' vers l'h\u00f4te 'FAIROUZ (192.168.203.1)' s'est\ntermin\u00e9 anormalement.\n\nEXPLICATION :\nLe programme du canl s'ex\u00e9cutant sous l'ID processus 2524(488) pour le canal\n'QM_TEST.SVRCONN' a pris fin anormalement. Le canal est 'FAIROUZ\n(192.168.203.1)'. Dans certains cas, son nom ne peut pas \u00eatre d\u00e9termin\u00e9 et il\nest repr\u00e9sent\u00e9 par '????'.\nACTION :\nExaminez les messages d'erreur pr\u00e9c\u00e9dents du programme de canal dans les\njournaux des erreurs afin de d\u00e9terminer la cause de l'incident. Notez que ce\nmessage peut \u00eatre totalement exclus ou supprim\u00e9 en r\u00e9glant les attributs\n\"ExcludeMessage\" ou \"SuppressMessage\" sous la strophe \"QMErrorLog\" dans le\nfichier qm.ini. D'autres informations figurent dans le guide d'administration\ndu syst\u00e8me. \n----- amqrmrsa.c : 925 --------------------------------------------------------What I couldn't understand is, what's the use of USERID and PASSWORD in the queuemanager properties in ASP.NET where the USERID identified in WMQ is \"Hatrix\" (which is the windows 7 account's name).Do I have to create a new USERID \"Hatrix\" in WMQ in order to make my code works? (i couldn't figured out how )Thanks in advance,MqDebug.### Assistant: First issue is that the QMgrmustbe able to resolve the ID passed to it. That means the ID either is defined locally or in a domain to which the QMgr has access. Normally, permissions are granted on the group and if so then it too must be resolved by the receiving QMgr.Now comes the question of what, exactly, does the QMgr resolve? When you have a connection from a Windows machine to a QMgr on a Windows machine then the ID that is passed by the channel is the Windows SID which is a Universally Unique Identifier (UUID)and not the text string. Similarly, the group resolves to a Windows SID.So, for example, you may have an ID called ADMINISTRATEUR defined locally on two Windows boxes and it still fails. The errors will say that the ID presented wasADMINISTRATEURand that the ID is not authorized and you can clearly see in thedspmqautcommands thatADMINISTRATEURisauthorized. Except what is happening is thatADMINISTRATEURon one host has its unique UUID and the account of the same name on the other host has a different UUID and Windows is looking at the UUID and not the text string.When you have the same ID defined in multiple places, the QMgr must be able to differentiate between them. When it cannot, strange and unusual things occur.For example, let's say you define a channel withMCAUSER('hatrix')and then runsetmqaut -p hatrix. Let's further stipulate that thehatrixID is not defined locally but rather is defined in bothDOMAINAandDOMAINBand that when the command is run, theDOMAINAdomain server is first in the search path.Thesetmqautcommand resolves the namehatrixto a UUID defined inDOMAINA.Later due to normal activity in the network,DOMAINBrises to the first spot in the domain search path. Now when theMCAUSER('hatrix')attempts to connect, the stringhatrixresolves inDOMAINBwhich is adifferentUUID than the one thesetmqautcommand resolved. The channel which was connecting normally suddenly throws a 2035 error.The answer to this problem is to qualify both thesetmqautcommand and theMCAUSERvalue with the desired domain. For example,setmqaut -p hatrix@DOMAINAand thenMCAUSER('hatrix@DOMAINA')will work regardless of whetherDOMAINAorDOMAINBare first in the search path, or even ifhatrixis defined locally on the WMQ host server. (Assuming thathatrixis indeed defined inDOMAINAof course.As a rule, you generally do not want to use the -p option onsetmqautcommands. The only exception is Windows hosts, and then only when the ID is qualified with a domain or server name as shown above.Finally, leaving the channel'sMCAUSERblank is what allows your Windows ID to flow to the MCA and be used for authorization checks. What you need to realize is that there is no authentication going on. Yes, it's true that the Windows client will send its Windows SID. However if you run a Linux VM on your Windows box and connect with that, there is no SID to pass and so the Windows QMgr falls back to resolving the string value of the ID. That means anyone can connect to that channel as any ID just by asserting the desired ID from a non-Windows client.So, strongly authenticate administrative connections with certificates. For low-privileged connections, use CHLAUTH rules or an exit to set theMCAUSERrather than letting it flow through, and then usesetmqautto make sure thatMCAUSERis not administrative. That means never grant+seton the QMgr and+crton queues to non-admins and avoid+setid, +setallwherever possible.For lots more WMQ Security content, please go tot-rob.net.\n"}
+{"text": "### Human: When I connect WebSphere MQ using C# without installing MQ server and client, I get the exceptionThe type initializer for 'IBM.WMQ.MQQueueManager' threw an exception. I add the reference of two MQ dlls,amqmdnet.dllandamqmdxcs.dllfrom MQ server, but it doesn't work. How can I connect to MQ without installing MQ server or client? Thank you!### Assistant: I don't recommend using MQ client libraries without installing them. Installation ensures that all the required binaries are installed and registered with GAC. Adding reference to amqmdxcs is not required. Just a reference to amqmdnet is enough.So it's better to install MQ client and run your application.\n"}
+{"text": "### Human: I have an MDB in WebSphere 6. The MessageListener is linked to a Tibco EMS queue. In the MDB I'm trying to write to a WebSphere MQ queue. I get the following error:WMSG0042I: MDB Listener LoanIQ Payments Inbound started successfully for JMSDestination jms/eid/payments\nWTRN0063E: An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred.\nWTRN0086I: XAException encountered during prepare phase for transaction 00000131...0001. Local resources follow.\nWTRN0089I: XATransactionWrapper@ 3fbe3fbe XAResource: com.ibm.ejs.jms.JMSManagedSession$JMSXAResource@3fb83fb8 enlisted: true mcWrapper.hashCode()1038237154: Vote: commit.\nWTRN0089I: LocalTransactionWrapper@:4e2e4e2e LocalTransaction:com.ibm.ejs.jms.JMSManagedSession$JMS LocalTransaction@4e5a4e5a enlisted:true registeredForSynctruemcWrapper.hashcode()1032076676: Vote: none.The QueueConnectionFactory instance is acom.ibm.ejs.jms.JMSQueueConnectionFactoryHandle. Could I get an XAConnection from this? Do I need to? I'd prefer to stay with vanilla JMS if possible.The MDB implementation is akin to:public void onMessage(Message message) {\n // ^^ incoming message delivered from EMS queue via WAS MessageListener\n TextMessage textMessage = (TextMessage) message;\n QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup(factoryName);\n Queue queue = (Queue) context.lookup(queueName);\n QueueConnection connection = factory.createQueueConnection();\n connection.start();\n QueueSession session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);\n QueueSender sender = session.createSender(queue);\n TextMessage message = session.createTextMessage(\"some new payload\");\n sender.send(message);\n // ^^ outgoing message sent to WebSphere MQ queue\n}### Assistant: Looking at the error, you have one XA resource and one JCA LocalTransactionWTRN0089I: XATransactionWrapper@ 3fbe3fbe XAResource: com.ibm.ejs.jms.JMSManagedSession$JMSXAResource@3fb83fb8 enlisted: true mcWrapper.hashCode()1038237154: Vote: commit.andWTRN0089I: LocalTransactionWrapper@:4e2e4e2e LocalTransaction:com.ibm.ejs.jms.JMSManagedSession$JMS LocalTransaction@4e5a4e5a enlisted:true registeredForSynctruemcWrapper.hashcode()1032076676: Vote: none.Sounds like you either haven't set the ConnectionFactory to XA enabled, see:http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/umj_pjcfm.html(scroll down to \"XA Enabled\") or the Tibco EMS connection isn't XA capable. If it's the latter, and there is no suitable XA driver, then you could look at Last-Participant support in the WAS infocentre, that might do what you need - i.e. WAS would prepare the WMQ XA transaction, locally commit the Tibco, then commit WMQ if the Tibco commit worked (or rollback otherwise). If the Tibco connection is XA capable, then WAS has full XA support for WMQ built in, so there's no reason not to use a two-phase transaction for the whole operation.RegardingThe QueueConnectionFactory instance is a com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle. Could I get an XAConnection from this? Do I need to? I'd prefer to stay with vanilla JMS if possible.You shouldn't do this, just keep to plain JMS. As a general point of style it's better to cast to a ConnectionFactory (not QueueConnectionFactory) too, and then remain with cross-domain objects (Connection, Session, MessageProducer).\n"}
+{"text": "### Human: I read thisarticleAnd still didn't understand the notion of how topics works in MQ.\nIn JMS I know that you can publish a message on a Topic, and in order to receive a message from it you first need to subscribe to it (using the subscription name at the receive phase).How it is work in MQ? I want to write a simple scenario of (as in JMS):1. Publish to a topic2. Receive from a Topic - that will fail (i'm not subscribed yet)3. Subscribe4. Receive - nothing to receive since I subscribed after the publish5. Publish6. Receive - successfulA sample code (.NET) would be helpfulGuy### Assistant: Have you looked at the included sample code? In a default installation it resides at:C:\\Program Files\\IBM\\WebSphere MQ\\tools\\dotnet\\samplesTheMQPubSubSample.csprogram illustrates both durable and non-durable subscriptions for managed and unmanaged code. In each case it first subscribes, then publishes but you can easily modify it to your use case of publish/subscribe/receive/publish/receive as described in the question. (You won't be able to receive from a topic to which you have not yet subscribed, though.)Here's one of the sections from the sample code:// Managed/nondurable\n string topicName = DEFAULT_TOPIC_STRING;\n string topicObject = null;\n int openOptionsForGet = MQC.MQSO_CREATE | MQC.MQSO_FAIL_IF_QUIESCING | MQC.MQSO_MANAGED | MQC.MQSO_NON_DURABLE;\n int destType = MQC.MQOT_TOPIC;\n\n try\n { \n destForGet = mqQMgr.AccessTopic(topicName, topicObject, MQC.MQTOPIC_OPEN_AS_SUBSCRIPTION, openOptionsForGet);\n\n messageForPut = new MQMessage();\n messageForPut.WriteString(DEFAULT_MESSAGE_DATA);\n\n mqQMgr.Put(destType, topicObject, null, topicName, messageForPut);\n\n messageForGet = new MQMessage();\n\n destForGet.Get(messageForGet);\n\n string messageDataFromGet = messageForGet.ReadLine();\n\n if(!DEFAULT_MESSAGE_DATA.Equals(messageDataFromGet))\n Console.WriteLine(\"Incorrect Message Received.\");\n\n destForGet.Close();\n }\n catch(MQException mqE)\n {\n Console.WriteLine(\"MQException caught. \" + mqE.ToString());\n }Your question references JMS as an example. Please be aware that you have the option of using IBM XMS - Extensible Message Service Client for .Net. XMS implements the JMS API over .Net with WMQ, WMB or WAS as the transport so you can use JMS code with very little modification. TheMessage Service Client for .Net 2.0.0manualdescribes the offering:Message Service Client for .NETMessage Service Client for .NET provides an application programming Interface (API) called XMS that has the same set of interfaces as the Java Message Service (JMS) API. Message Service Client for .NET contains a fully managed implementation of XMS, which can be used by any .NET compliant language.\nXMS supports:point-to-point style messagingpublish/subscribe style messagingSynchronous message deliveryAsynchronous message deliveryAn XMS application can exchange messages with the following types of application:An XMS applicationA WebSphere MQ JMS applicationA native WebSphere MQ applicationA JMS application that is using the WebSphere default messaging providerAn XMS application can connect to, and use the resources of, any of the following messaging servers:A WebSphere MQ queue manager - The application can connect in either bindings or client mode.A WebSphere service integration bus - The application can use a direct TCP/IP connection, or it can use HTTP over TCP/IP.A broker of WebSphere Event Broker or WebSphere Message Broker - Messages are transported between the application and the broker using WebSphere MQ Real-Time Transport and, depending on the configuration, messages can be delivered to the application using WebSphere MQ Multicast Transport.By connecting to a WebSphere MQ queue manager, an XMS application can use WebSphere MQ Enterprise Transport to communicate with a broker of WebSphere Event Broker or WebSphere Message Broker. Alternatively, an XMS application can use a WebSphere MQ Publish/Subscribe broker.If you wish to explore further, the sample XMS code resides in subdirectories below the native .Net samples referred to earlier. The samples are described in theUsing the XMS Sample Applicationssection of the manual.The .Net support is integrated into WMQ as of v7. If you are lacking the samples then your WMQ client installation is back-level or incompletely installed. The latest v7.0 WMQ Client for Windows is downloadable asSupportPac MQC7.The XMS support is delivered asSupportPac IA9H.\n"}
+{"text": "### Human: I wrote an application that connected to local queue manager using this function call:MQQueueManager mqQMgr = new MQQueueManager(\"QM_QueueManagerName\");Now I need to connect to remote queue manager on another computer.I can successfully connect to remote queue manager using MQ Explorer from my development PC usingQM_ComputerNameas queue manager name,S_ComputerNameas channel and ComputerName as connection name. So it is accessible from my desktop.However, when I try to connect via .Net I getMQRC_Q_MGR_NAME_ERRORno matter what I try.I tried specifyingMQEnvironment.Hostname = \"ComputerName\";\nMQEnvironment.Channel = \"S_ComputerName \";\n\nand then calling\n\nmqQMgr = new MQQueueManager(\"QM_ComputerName\");\n\nI also tried calling \n\nmqQMgr = new MQQueueManager(\"QM_ComputerName\", \"S_ComputerName\", \"ComputerName\");I get error in both cases.Anyone can advise?### Assistant: This is how I got it to work:MQQueueManager mqQMgr=null;\n\n Hashtable props = new Hashtable();\n\nprops.Add(MQC.HOST_NAME_PROPERTY, \"HostNameOrIP\");\n\n props.Add(MQC.CHANNEL_PROPERTY, \"ChannelName\");\n\n props.Add(MQC.PORT_PROPERTY, 1414); // port number\n\n props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n\n MQQueue mqQueue = null;\n\n try\n\n {\n\n mqQMgr = new MQQueueManager(\"QueueManagerName\", props);\n\n mqQueue = mqQMgr.AccessQueue(\n QueueName,\n MQC.MQOO_OUTPUT // open queue for output\n + MQC.MQOO_FAIL_IF_QUIESCING); // but not if MQM stopping\n }\n\n catch (MQException mqe1)\n\n {\n\n }\n"}
+{"text": "### Human: Ok, I want to check if I can run some OS or MQSC commands in MQ server remotely. As long as I know, this could be done withSYSTEM.ADMIN.SVRCONN. In order to do that, I add a remote Queue Manager to my WebSphere MQ client. I put Queue Manager name on the server with proper IP, but when I useSYSTEM.ADMIN.SVRCONNas channel name, I have got:Channel name not recognized (AMQ4871)error.Also, if I have a channel name like MY.CHANNEL.NAME and it is a server-connection channel withmqmas itsMCAUSER, can I run some commands (MQSC or OS) through this channel on the server?Thanks.Edit1I am using WebSphere MQ v.7.0By \"I add a remote Queue Manager to my WebSphere MQ client\" I meant I added a remote queue manager to MQ Explorer.Edit2I want to explain my question more precisely in this edit. I want to connect to a remote Qmanager via MQ Explorer. I know Qmanager name and its IP ofcourse. Also, the remote Qmanager has bothSYSTEM.ADMIN.SVRCONNandSYSTEM.AUTO.SVRCONNchannel available. When I checkCHLAUTHfor these channels, I've got:AMQ8878: Display channel authentication record details.\n CHLAUTH(SYSTEM.ADMIN.SVRCONN) TYPE(ADDRESSMAP)\n ADDRESS(*) USERSRC(CHANNEL)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(SYSTEM.*) TYPE(ADDRESSMAP)\n ADDRESS(*) USERSRC(NOACCESS)\ndis chl(SYSTEM.ADMIN.SVRCONN) MCAUSER\n 5 : dis chl(SYSTEM.ADMIN.SVRCONN) MCAUSER\nAMQ8147: WebSphere MQ object SYSTEM.ADMIN.SVRCONN not found.\ndis chl(SYSTEM.AUTO.SVRCONN) MCAUSER\n 6 : dis chl(SYSTEM.AUTO.SVRCONN) MCAUSER\nAMQ8414: Display Channel details.\n CHANNEL(SYSTEM.AUTO.SVRCONN) CHLTYPE(SVRCONN)\n MCAUSER( )As you can see here, I should be able to connect via these two channels and run some commands. But when I chooseSYSTEM.ADMIN.SVRCONNas channel name in remote configuration I get :Channel name not recognized (AMQ4871)and when I chooseSYSTEM.AUTO.SVRCONNas channel name, I get:You are not authorized to perform this operation (AMQ4036).Any idea?### Assistant: when I use SYSTEM.ADMIN.SVRCONN as channel name, I have got: Channel\n name not recognized (AMQ4871) error.Did you define the channel on the remote queue manager?if I have a channel name like MY.CHANNEL.NAME and it is a\n server-connection channel with mqm as its MCAUSER, can I run some\n commands (MQSC or OS) through this channel on the server?Sure. And so can anyone else. You should read up on MQ security and not expose your queue manager to hackers.\n"}
+{"text": "### Human: I'm currently developing an application which needs to connect a MQ Queue in order to have the queue saving message information inside another service. Once it's done, the service returns a result message through the MQ Queue and it is returned to me.I'm sending a string message that contains a XML message similar to the following one:\n\nDEMANDA CONTRATACI\u00d3N\nIt appears that MQ is not decoding properly the \"\u00d3\" character and \"subtipo\" field is being saved as \"DEMANDA CONTRATACI\u251c\u00f4N\".I'm encoding the message in \"UTF-8\" and I've been told that the CCSID I'm using to send the message is 850 instead of 1208 (the one belonging to UTF-8).To run the MQ manager, I'm using\"pymqi\" Python library in Client Mode. This is the MQManager class I use to send messages to the queue and get the response:class MQManager:\n def __init__(self):\n self.queue_manager = config.queue_manager\n self.channel = config.channel\n self.port = config.port\n self.host = config.host\n self.conn_info = config.conn_info\n self.queue_request_name = config.queue_request_name\n self.queue_response_name = config.queue_response_name\n\n cd = pymqi.CD()\n cd.ChannelName = self.channel\n cd.ConnectionName = self.conn_info\n cd.ChannelType = pymqi.CMQC.MQCHT_CLNTCONN\n cd.TransportType = pymqi.CMQC.MQXPT_TCP\n\n self.qmgr = pymqi.QueueManager(None)\n self.qmgr.connect_with_options(self.queue_manager, opts=pymqi.CMQC.MQCNO_HANDLE_SHARE_NO_BLOCK, cd=cd)\n\n def send_message(self, str_xml_message):\n # set message descriptor\n request_md = pymqi.MD()\n request_md.ReplyToQ = self.queue_response_name\n request_md.Format = pymqi.CMQC.MQFMT_STRING\n\n queue_request = pymqi.Queue(self.qmgr, self.queue_request_name)\n queue_request.put(str_xml_message.encode(\"UTF-8\"), request_md)\n queue_request.close()\n\n # Set up message descriptor for get.\n response_md = pymqi.MD()\n response_md['CorrelId'] = request_md['MsgId']\n\n gmo = pymqi.GMO()\n gmo.Options = pymqi.CMQC.MQGMO_WAIT | pymqi.CMQC.MQGMO_FAIL_IF_QUIESCING\n gmo.WaitInterval = 5000 # 5 seconds\n\n queue_response = pymqi.Queue(self.qmgr, self.queue_response_name)\n message = queue_response.get_no_rfh2(None, response_md, gmo)\n queue_response.close()\n\n return str(message)\n\n\n def close(self):\n self.qmgr.disconnect()I wonder how can I define the MQ Manager's CCSID value and hopefully solve the codepage mismatch.Thank you!### Assistant: In your code you create a default message descriptor for the message you send in this line of code:request_md = pymqi.MD()By default pymqi (like the underlying IBM MQ C libraries) will set the message descriptorCodedCharSetIdto the valueCMQC.MQCCSI_Q_MGR.This can be seen in thesource:['CodedCharSetId', CMQC.MQCCSI_Q_MGR, MQLONG_TYPE],The IBM MQ v9.0 KC pageReference > Developing applications reference > MQI applications reference > Data types used in the MQI > MQMD - Message descriptor > Fields for MQMD > CodedCharSetId (MQLONG)describes how the client handles this:For client applications, MQCCSI_Q_MGR is filled in, based on the locale of the client rather than the one on the queue manager.The IBM MQ Troubleshooting documentWhat CCSID is used by default for WebSphere MQ client messagesexplains this in a slightly different way:A MQ client sets the MQCCSI_Q_MGR value based on the environment in which the client application is running.Based on the850CCSID I would guess you are running on a Windows OS that is not in the United States (which commonly uses CCSID 437).You have a few options to override this:You can programmatically override the pymqi MQMD default value like this:request_md.CodedCharSetId = 1208Set the env variableMQCCSIDto the value you want (in your case 1208). This must be set before you connect to mq. This is documented in the IBM MQ v9.0 KC pageDeveloping applications > Developing MQI applications with IBM MQ > Writing client procedural applications > Using the MQI in a client application > Choosing client or server CCSID.The example below is for Windows:SET MQCCSID=1208In themqclient.iniyou can set theCCSID=numberunder theCHANNELSstanza. This is documented in the IBM MQ v9.0 KC pageConfiguring > Configuring connections between the server and client > Configuring a client using a configuration file > CHANNELS stanza of the client configuration file. For example:CHANNELS:\n CCSID=1208\n"}
+{"text": "### Human: When I go to my WebSphere MQ explorer, and connect to a remote queue manager and go to--> Advanced --> Listeners, I do not see any listeners defined. But I am able to create a remote JMS client, connect to this queue manager by using a channel connection and publish a message to a topic.So what is the purpose of listeners? In my case, things are working fine without listeners.### Assistant: WebSphere MQ listeners are what accepts remote connections and start inbound channels. Modern queue managers will almost always have listeners defined but it is also possible to specify a default port for the QMgr to listen on without actually defining a listener. This is unusual, though. For older versions of MQ it was common to useinetdto start channels. This method doesn't use a listener.So rest assured thatsomethingon your QMgr is listening for connections. Since you are not seeing it there are three likely possibilities:The listener name starts withSYSTEM.and your Explorer view is set to filter SYSTEM objects.The default port has been specified in theqm.inifileYou have a really old QMgr usinginetdBy the way, go get a new version of WMQ Explorer. Since you have anAdvanced --> Listenersyou must have an old version. Download fromSupportPac MS0T.\n"}
+{"text": "### Human: I am new to mqseries and I started with IBM WebSphere MQ curses. There are examples withMQ_APPLEandMQ_ORANGEqueue managers. I have no problem with sending messages to local or remote queue with MQ Explorer, but I wanted to send such message from code: Python or Java. I tried Python pymqi library with code like this:import pymqi\n\nqmgr = pymqi.QueueManager(None)\nqmgr.connect('QM_APPLE')\n\nputq = pymqi.Queue(qmgr, 'Q1')\nputq.put('Hello from Python!')but I receive error:Traceback (most recent call last):\n File \"mq_put.py\", line 4, in \n qmgr.connect('QM_APPLE')\n File \"c:\\Python26\\lib\\site-packages\\pymqi.py\", line 758, in connect\n raise MQMIError(rv[1], rv[2])\npymqi.MQMIError: MQI Error. Comp: 2, Reason 2540: FAILED: MQRC_UNKNOWN_CHANNEL_NAMEThere isQM_APPLEqueue manager withQ1local queue.What is wrong with my code?### Assistant: Based on the error it appears that you are attempting to connect to a remote queue manager, but you are using the local queue manager bindings method to connect. I say this because the error is stating that the mqi client doesn't know which channel to connect to. Can you please clarify if you are using a local queue manager or a remote queue manager? I have pasted the code below to connect to a remote queue manager using a channel.import pymqi\n\nqueue_manager = \"QUEUE_MANAGER_NAME\"\nchannel = \"SVRCONN.1\"\nhost = \"host.domain.com\"\nport = \"1434\"\nconn_info = \"%s(%s)\" % (host, port)\n\nqmgr = pymqi.QueueManager(None)\nqmgr.connectTCPClient(queue_manager, pymqi.cd(), channel, conn_info)\n"}
+{"text": "### Human: I can use the Java MQ Api to put and get messages.\nI can also disable gets and put on a queue.During a migration project, we'll have an App running in parallell. Old and New. Old and New will have their own separate queues. I regulary have messages from a client going to Old. Occasionally want the msgs to flow to New instead.wondering if MQ supports a gate/switch concept. where via API I can point a queue to go only to New, or only to Old, for a short time.Trying to avoid going to message based routing via WMB since I dont have to do that today. THe parallel mode is only for a few months.### Assistant: You do not mention the version of MQ or whether there are message affinities or dependence on preserving theMQMD.MsgID. These are critical in devising a solution to this problem. I'll try to describe enough options so that at least one will be viable whatever version you are at.Pub/SubThe easiest thing to do is to have the messages arrive on an alias over a topic. Any message that arrives is published immediately on that topic. Then it is a simple matter to generate administrative subscriptions to direct messages to the queues on which the apps needing the messages are listening. This is entirely a configuration change and requires no external components, processes or code. It is available from v7.1 of MQ and higher, which is to say any of the currently supported versions of MQ.The down side is that IBM MQ will change theMQMD.MsgIDfrom the time the message is received on the topic to the time it is published on the application's input queue. This breaks the app's ability to use theMQMD.MsgIDof the incoming message as a correlation ID when replying. If the requesting app pre-loads the correlation ID or doesn't rely on a correlation ID, this is not an issue.AliasingBut for apps where this is an issue, it gets a bit harder. You can alias over a queue and have inbound messages land on the alias. When you need to switch from one queue to another, you change the alias. There are a couple issues with this. The first is that it is never possible to deliver the message stream to more than one of the applications. In a parallel processing test it is often desirable to do exactly that and then compare summary or detail reports.The second problem is more operational in nature. It isn't possible to change the alias while it is open. If the messages arrive over aRCVR,RQSTRor `CLUSRCVR channel, no problem. Stop the channe, switch the alias and restart the channel. In a series of MQSC script commands this can be done faster than it can be typed. However, if the applications putting the messages are connected in bindings mode or via client directly to the alias, they must all be stopped in order to change the alias.That said, aliasing works on all versions of MQ out of the box.Physical copyOne solution that's been around for quite some time is to use theQprogram (SupportPac MA01) to direct the messages. In this scenario, the queue on which messages land is a local queue. TheQprogram is either triggered or set to constantly listen on the queue. When a message arrives,Qthen copies it to one or both of the destination queues.Switching the behavior ifQis triggered involves pre-defining 2 or 3 processes where each defines a different behavior - move new messages toQUEUEA, toQUEUEBor to both. Changing the queue'sPROCESSattribute to point to a different process results in an instantaneous change of the behavior.Alternatively, if Q is configured to listen on the queue forever then changing the behavior involves use of three different scripts to execute it where one causes messages to be copied toQUEUEA, another toQUEUEBand another to both queues. Changing the behavior involves killing the script and starting a different one.TheQprogram works with all versions of MQ, regardless of whether it is triggered or scripted.Downsides to this approach include the obvious - more moving parts. You have to trigger the queue or else make a transactional program act like a daemon. Not hard but if you are betting the business on it then perhaps some monitoring is in order to make sure the input queue doesn't start building.RecommendationOf all these methods, Ireallylike the Pub/Sub version. It is extremely reliable, has the least moving parts, and if anything breaks it's under IBM support. When you need to change something, you can do that with minimal impact to the running applications. If at all possible, use that.\n"}
+{"text": "### Human: I am trying to connect to a MQ connection factory defined in Websphere app Server 7.0.But I couldnt find a right connectionfactory interface for the MQ to define in Spring.However when I tried to hardcode the connection details in the spring config file, I am able to connect to the Queue Manager.What is the right interface/format to use in Spring beans to load the MQ connection factory defined in Websphere appl server?Working Code\n \n 127.0.0.1\n \n \n 1414\n \n \n MYQM\n \n \n 1\n \nNot Working Code\n \n \n \n \nwhere WASQM is the MQ connection factory defined in WebsphereError with the Non working codeorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mqConnectionFactory' defined in ServletContext resource [/WEB-INF/config/config-mq.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: [com.ibm.mq.jms.MQQueueConnectionFactoryFactory] is not an interface\nat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)\nat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)\nat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)\nat org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)\nat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\nat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)\nat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)\nCaused by: java.lang.IllegalArgumentException: [com.ibm.mq.jms.MQQueueConnectionFactoryFactory] is not an interfaceI need help in replacing the not working code with a right code.\nSpring - 3.0.5\nIBM MQ and Web App Servers - 7.0### Assistant: Right way to do isCreate the resource in Queue Connection Factory in Websphere App Server (not in Connection Factory)Use javax.jms.QueueConnectionFactory as the connection factory in spring config\n \n \n \n \nThispagegave me the hint.\n"}
+{"text": "### Human: I am trying to connect to IBM Websphere MQ Server from IBM Websphere Application Server.I am getting the following error:MQJMS2013: invalid security authentication supplied for MQQueueManagerWhat I understand is, this is because of invalid security credentials by WAS while connecting to MQ Manager.I have tried different combination of providing the MQ admin password e.g.Provide J2C authentication to MQ Connection Factory.Provide MQ admin username and password to Queues.Providing Blank username.Combination of all three above.Also, as mentioned in some of the posts, I have tried theTransport Typeas'Binding'as well as'Client'forQueueConnectionFactory.Please suggest.### Assistant: One problem is that the MQJMS2013 may have nothing to do with the QMgr. It could be config file permission problems, LDAP credentials doing JNDI lookups, problems with a keystore, etc.One way to determine whether this really is a WMQ authorization exception is to enable authorization events on the QMgr and recreate the error. If it is a WMQ auth problem, the event message will land in SYSTEM.ADMIN.QMGR.EVENT queue. It will contain the ID of the user, the object the call failed on, the API call that failed and all of the options used on the call. If you useSupportPac MO71then it will format the event message for you. If you use WMQ Explorer then you can installSupportPac MS0Pto format the event messages.If you do not get an event message then the connection is not reaching WMQ! In that case, nothing you do with accounts, groups, setmqaut and other WMQ-specific configuration will help and I'd suggestenabling tracing.In bindings mode, the ID presentedmustmatch the ID the JVM runs as. In client mode another way to diagnose is to set the channel's MCAUSER to a known good value. The channel's MCAUSER overrides any ID passed in by the app server and should always be set to a low-privileged account. For diagnostics, set it TEMPORARILY to 'mqm' and if the connection works that isolates the problem to being WMQ auth issues.\n"}
+{"text": "### Human: I'm trying to send a message to a java server over a Websphere MQ which uses JMS as the transport protocol. I can happily drop messages on the MQ using the IBM supplied libraries, but the server rejects them. I'm assuming (hopefully correctly) that this is because I'm missing various JMS specific headers/properties on the MQ message.I have ensured the payloads for the messages are the same by inspecting the queue (they are both map messages if that helps), but don't want to fully implement theJMS Websphere MQ protocoljust to get this to work.I'm wondering if anyone has managed to get this to work, and if so what's the minimum amount of information you need to specify in the JMS header? Are there any alternatives to doing this directly on the MQ (I've seen some about using java interop, but this is something I think would be overkill).Any help would be greatly appreciated!### Assistant: Can you paste the Java code you are using to read the message. Is that code assuming that the message is a \"MapMessage\". Normally something put into a Queue from a non-java client will appear as either a TextMessage or a BytesMessage.The WebsphereMQ JMS api is normally fine with reading those messages without the JMS headers as long as you read as a TextMessage / BytesMessage as put.In my server code, my content is normally put to the queue as bytes, and so appears as a BytesMessage, but just in case i get a message that was manually put on the queue, i catch the classcastexception, and test to see if it is in fact a TextMessage.\n"}
+{"text": "### Human: In IBM MQ, I have a requirement where I can get many types of xml from the queue. The xml messages will be conformed to already specified xsd (there are say, 5 xsd - which means I can get 5 different xml). When I get the message from queue, I would like to know the type of xml (if its xsd1 or xsd2 or so on)The reason why I would want to know is, I am using a JaxB interface with SAX implementation, for which I need to give the java object corresponding to the xml as parameter. So I have to know which xsd the input and is and assign the parameter correspondingly.The options I have is to set a property in the header to the message, but the party who is dropping the message into MQ is not ready.What other options do I have? Can I get the file name (of xml) from the mq and find the xsd based on the name of the file? Or do I have to do I sax parsing and identify the root tag and derive the xsd type? Any other better option anybody has in mind?### Assistant: Think of MQ like the Post Office. When you get a letter, the post office doesn't mess with anything on the inside (the payload) and if it changes the outside, it only changes routing information. If you want to sort incoming mail to different recipients, whoever is sending it has to put the data against which the sort criteria operate on the outside of the envelope. If that doesn't work, you must open the envelope and look for the recipient name, department, or whatever on the papers inside.Your MQ messageisthat envelope. The sort criteria can be different queue names, a property of the message, a property of the message header, or something in the payload. But unless the sender explicitly sets the destination queue name based on the selection criteria, or sets the message or header property, your only option is to inspect the payload and figure it out.If you have to inspect the payload, this is a perfect scenario for IBM Integration Broker. But you can also write an application to perform this function. Very often this is performed by a Dispatch app which gets the message, figures out where it goes, then puts it onto another queue andCOMMITs theGETandPUToperations. But if the dispatch app must parse the XML to determine the correct queue, the message has to be parsed twice - once by the dispatcher, once by the receiving app.\n"}
+{"text": "### Human: I have a scenario where about 10 different messages will need to be enqueued and then dequeued / processed. One subscriber will need all 10 messages, but another will only need 8 of the 10 messages. I am trying to understand what the best way is to setup this type of architecture. Do you create a queue for each message type so the subscriber(s) can just subscribe to the relevant queues or do you dump them all to the same queue and ignore the messages that are not relevant to that subscriber? I want to ensure the solution is flexible / scalable, etc.Process:10 different xml messages will be enqueued to an IBM WebSphere MQ server.We will use .Net (Most likely WCF since WebSphere MQ 7.1 has added in WCF support)We will dequeue the messages and load them into another backend DB (Most likely SQL Server).Solution needs to scale well because we will be processing a very large number of messages and this could grow (Probably 40-50,000 / hr). At least large amount for us.As always greatly appreciate the info.--S### Assistant: Creating queues is relatively 'cheap' from a resource perspective, plus yes, it's better to use a queue for each specific purpose, so it's probably better in this case to separate them by target client if possible. Using a queue to pull messages selectively based on some criteria (correlation ID or some other thing) is usually a bad idea. The best performing scenario in messaging is the most straightforward one: simply pull messages from the queue as they arrive, rather than peeking and receiving selectively.As to scaling, I can't speak for Websphere MQ or other IBM products, but 40-50K messages per hour isn't particularly hard for MSMQ on Windows Server to handle, so I'd assume IBM can do that as well. Usually the bottleneck isn't the queuing platform itself but rather the process of dequeuing and processing individual messages.\n"}
+{"text": "### Human: I have configured two servers by side, one Active MQ and one WebSphere MQ 8.0, in order to communicate each other I've configured an Apache Camel in the middle, which receives messages from Active MQ and send them to WebSphere. Right now Camel is able to receive messages from Active MQ server, but when it tries to send them to the WebSphere MQ it throws the error:Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2540;AMQ9204: Connection to host '10.0.0.122(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2540;AMQ9520: Channel not defined remotely. [3=channel.test]],3=10.0.0.122(1414),5=RemoteConnection.analyseErrorSegment]I am able to connect Camel to the WebSphere QueueManager with a user, but not the the channel that is created, the configuration for the camel side in order to connect to the WebSphere server is:\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n\n \n \n And the way that I've created the Server-Connection channel is by going to the WebSphere MQ Explorer, select queue manager, create new Server-Connection channel, set the appropiate username in the MCA User Field.As a suggestion of @shashi in his answer below I've run the command DIS CHANNEL() with the following output:1 : DIS CHANNEL('channel.test')\nAMQ8414: Display Channel details.\n CHANNEL(channel.test) CHLTYPE(SVRCONN)\n ALTDATE(2015-07-22) ALTTIME(00.16.25)\n COMPHDR(NONE) COMPMSG(NONE)\n DESCR( ) DISCINT(0)\n HBINT(300) KAINT(AUTO)\n MAXINST(999999999) MAXINSTC(999999999)\n MAXMSGL(4194304) MCAUSER(mqm)\n MONCHL(QMGR) RCVDATA( )\n RCVEXIT( ) SCYDATA( )\n SCYEXIT( ) SENDDATA( )\n SENDEXIT( ) SHARECNV(10)\n SSLCAUTH(REQUIRED) SSLCIPH( )\n SSLPEER( ) TRPTYPE(TCP)Any help will be really helpfullThanks in advance### Assistant: MQRC 2540 means the queue manager did not recognize the channel name provided by the client.In MQ the object names are case sensitive. Ensure the channel name you have provided in Camel configuration matches the one you created in MQ Explorer.\n"}
+{"text": "### Human: MQQueue.Get()operation freezes for 5 minutes when getting a message from QueueManager using SSL on .NetCore 3.1. The same code works fine when running on .Net Framework (v4.8) or without SSL on both runtimes.Details:Client:MQ Managed Client from NuGet (IBMMQDotnetClient/v9.1.4)Server:docker from tagibmcom/mq:9.1.4.0-r1with basic SSL config usingSSLCIPH(ANY_TLS12) SSLCAUTH(OPTIONAL)Reproduced on:.Net Core 3.1.2 on Windows and .Net Core 3.1.1 on LinuxMQ Logs:MqGet-framework48.zip,MqGet-core31.zipMy Findings:The attachedMqGet-core31tells:The client sends the get message request at09:15:52.199588It receives response with message body almost immediately at09:15:52.311050Then it calls anotherMQRcvThread.ReceiveOneTSH()to finish the get operation. It callsMQTCPConnection.Receive()and it freeze for 5 minutes to09:20:52.412669Possible reason:MQTCPConnectionkeeps originalsocketandMQEncryptedSocketinstance wrapping the samesocketviaSslStreamThe methodMQTCPConnection.Receive()polls on thesocketand then it callsMQEncryptedSocket.Read()It looks like that data from thesocketare read bySslStreaminMQEncryptedSocketbefore thepoll()method is called andpoll()waits for its 5 minutes timeout. Or any other race condition around?If I put a breakpoint before problematicpoll()call and delay it for a moment, then it often passess without any delay!Test Code:This code finishes in ~2 seconds on .Net Framework, but it needs 5 minutes and ~2 seconds when it is run on .Net Core. (Win or Linux)// import server's CA\nMQConnectionPool.ImportServerCertificateAuthorityIfNotPresent(CertMqTestCa);\n\nHashtable properties = new Hashtable {\n {MQC.HOST_NAME_PROPERTY, Mq1QmSslAnyTls12.Host},\n {MQC.PORT_PROPERTY, Mq1QmSslAnyTls12.Port},\n {MQC.CHANNEL_PROPERTY, Mq1QmSslAnyTls12.ChannelName},\n {MQC.USER_ID_PROPERTY, \"admin\"},\n {MQC.PASSWORD_PROPERTY, \"changeit\"},\n {MQC.CCSID_PROPERTY, 819},\n {MQC.SSL_CIPHER_SPEC_PROPERTY, \"TLS_RSA_WITH_AES_256_CBC_SHA256\"},\n {MQC.SSL_CERT_STORE_PROPERTY, \"*USER\"}\n};\nMQQueueManager queueManager;\nusing (new MQCcsidSetter(properties)) {\n queueManager = new MQQueueManager(null, properties);\n}\n\nstring requestText = Guid.NewGuid().ToString();\nstring queueName = \"SV.MqConnectionPoolTest\";\n// put message - works fine\nusing (MQQueue queue = queueManager.AccessQueue(queueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING)) {\n byte[] requestBytes = Encoding.UTF8.GetBytes(requestText);\n MQMessage requestMessage = new MQMessage {Expiry = 3000, Priority = 4, CharacterSet = 1208, MessageType = MQC.MQMT_DATAGRAM};\n requestMessage.Write(requestBytes, 0, requestBytes.GetLength(0));\n queue.Put(requestMessage, new MQPutMessageOptions());\n}\n\n// get message back from the same queue\nusing (MQQueue queue = queueManager.AccessQueue(queueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING)) {\n while (true) {\n MQMessage msg = new MQMessage();\n queue.Get(msg, new MQGetMessageOptions()); // <<= !!!IT IS DELAYED HERE!!!\n msg.Seek(0);\n string msgContent = msg.ReadString(msg.MessageLength);\n if (requestText.Equals(msgContent)) {\n break;\n }\n }\n}Thread Dumps:MQ Client Receiver ThreadSocketPal.Poll()\nSocket.Poll()\nMQTCPConnection.Receive() \nMQRcvThread.ReceiveBuffer()\nMQRcvThread.ReceiveOneTSH()\nMQRcvThread.Run()\nThreadHelper.ThreadStart_Context()\nExecutionContext.RunInternal()\nThreadHelper.ThreadStart()Waits onPoll(), but it ends with 5 minute (heartbeat) timeout. Then it goes tothis.network.Read()and immediately gets proper data.this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, this.timeout);\n if (this.socket.Poll(this.timeout * 1000, SelectMode.SelectRead))\n {\n length2 = this.network.Read(cBuffer, offset1, length1);Application ThreadMonitor.Wait()\nMQSession.ExchangeTSH() \nMQProxyQueue.RequestMessages()\nMQProxyQueue.FlushQueue()\nMQProxyQueue.ProxyMQGET()\nMQFAP.zstMQGET()\nMQFAP.MQGET()\nMQDestination.Get()\nMQDestination.Get()\nMqConnectionPoolTest.TestMqDirect()Waits forentry.Replyto be filled by receive thread:while (entry.Reply == null) {\n Monitor.Wait((object) entry, this.rmtReqEntMaxPollTime, true);\n ...Please, does anybody know a workaround or has a fix?### Assistant: You should notGetand wait infinitely, you should do it like this:const int TIMEOUTTIME = 20000;\ntry\n{\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n gmo.Options = MQC.MQGMO_WAIT;\n gmo.WaitInterval = TIMEOUTTIME;\n queue.Get(msg, gmo);\n msg.Seek(0);\n string msgContent = msg.ReadString(msg.MessageLength);\n if (requestText.Equals(msgContent)) {\n break;\n }\n}\ncatch (MQException ex)\n{\n if (ex.CompletionCode == MQC.MQCC_FAILED && ex.ReasonCode == MQC.MQRC_NO_MSG_AVAILABLE)\n {\n // Log on DEBUG level something like this:\n // No message from after seconds, continue receiving\");\n continue;\n }\n throw ex;\n}To make your programmer's life easier, I would recommend to use theXMS API.\n"}
+{"text": "### Human: I am trying to create a connection to an mq manager that has ssl auth enabled. I am using Java 1.8I have thiscodeTrustStrategy trustStrategy = new TrustSelfSignedStrategy();\nKeyStore trustStore = KeyStore.getInstance(\"JKS\");\ntry (FileInputStream fileInputStream = new FileInputStream(propertyReader.getProperty(QUEUE_KEYSTORE))) {\ntrustStore.load(fileInputStream, propertyReader.getProperty(QUEUE_KEYSTOREPASS).toCharArray());\n}\nKeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());\nkmf.init(trustStore, \"changeit\".toCharArray());\nfinal TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());\ntmf.init(trustStore);\n\nfinal SSLContext sslContext = SSLContext.getInstance(\"TLSv1.2\");\nsslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom());\n\nconnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\nconnectionFactory.setHostName(propertyReader.getProperty(QUEUE_HOST));\nconnectionFactory.setQueueManager(propertyReader.getProperty(QUEUE_MANAGER));\nconnectionFactory.setChannel(propertyReader.getProperty(QUEUE_CHANNEL));\nconnectionFactory.setSSLCipherSuite(propertyReader.getProperty(QUEUE_CIPHERSUITE));\nconnectionFactory.setPort(Integer.parseInt(propertyReader.getProperty(QUEUE_PORT)));\nconnectionFactory.setSSLSocketFactory(sslContext.getSocketFactory());When I try to create the connection I get thisexception:com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2397\njavax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)I can see the following in thelogs:Allow unsafe renegotiation: false\nAllow legacy hello messages: true\nIs initial handshake: true\nIs secure renegotiation: false\nIgnoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1\nNo available cipher suite for TLSv1\nhandling exception: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)\nSEND TLSv1.2 ALERT: fatal, description = handshake_failure\nWRITE: TLSv1.2 Alert, length = 2\n[Raw write]: length = 7\n0000: 15 03 03 00 02 02 28 ......(\ncalled closeSocket()Is this saying that it is still trying to use TLSv1 instead of TLCv1.2?\nI have jce unlimited strength enabled in my security file.Update with details:IBM MQ Jar Version: 6.0.2.5java version \"1.8.0_201\"Java(TM) SE Runtime Environment (build 1.8.0_201-b26)### Assistant: You have stated you are using IBM MQ jar files from v6.0.2.5, this went out of support from IBM in September 30th 2012. See end of this question for additional details on the only CipherSuites that were supported in that old version.You can use Maven to get the current IBM MQ v9.1.0.4 LTS support client at the following link:MVN REPOSITORY \u00bb com.ibm.mq com.ibm.mq.allclientI checked old documentation saved as PDF and MQ v6 only supported SSL and TLS1.0 ciphers, the list is below:SSL_RSA_WITH_NULL_MD5\nSSL_RSA_WITH_NULL_SHA\nSSL_RSA_EXPORT_WITH_RC4_40_MD5\nSSL_RSA_WITH_RC4_128_MD5\nSSL_RSA_WITH_RC4_128_SHA\nSSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5\nSSL_RSA_WITH_DES_CBC_SHA\nSSL_RSA_EXPORT1024_WITH_RC4_56_SHA\nSSL_RSA_EXPORT1024_WITH_DES_CBC_SHA\nSSL_RSA_WITH_3DES_EDE_CBC_SHA\nSSL_RSA_WITH_AES_128_CBC_SHA\nSSL_RSA_WITH_AES_256_CBC_SHA\nSSL_RSA_WITH_DES_CBC_SHA\nSSL_RSA_WITH_3DES_EDE_CBC_SHA\nSSL_RSA_FIPS_WITH_DES_CBC_SHA\nSSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA\n"}
+{"text": "### Human: I would like to test some MQ-related functionality and I wanted to use MQ Explorer (v 7.5.0.2) to put a message to MQ queue. However, the input field accepts only one line messagesIs it possible to put multi-line messages using MQ Explorer? Using sequences like\\nor
does not work.### Assistant: It is sad, but currently IBM MQ Explorer does not allow to send multiline message.My workaround to this is to use JMSToolBox:https://github.com/jmstoolbox/jmstoolboxGeneral description how to set it up with IBM MQ is here:https://github.com/jmstoolbox/jmstoolbox/wiki/2.1-Setup-for-IBM-MQIn my case two extra jars were needed:\ncom.ibm.mq.allclient-9.2.4.0.jar\njson-20210307.jar\n"}
+{"text": "### Human: i kind of don't understand when to use the MQ client connection channel. From my understanding, when client trying to connect MQ server, it can be completed by defining the channel object withserver connection channelvalue directly in application code. Therefore, if so, then why do we need to make use of such client connection channel?Please help explain to me in detail. Thanks very much### Assistant: A Server Connection Channel is used by clients to connect to a queue manager.You don't really use a client connection channel to connect to queue manager. A client connection channel defines the connection parameters required to connect to a queue manager for example queue manager name, connection name, SSL etc. These channel definitions are stored in channel definition table (CCDT) files. CCDT files are used by client applications through MQCHLLIB and MQCHLTAB environment variables.Thislinkandanotherhas little more details.\n"}
+{"text": "### Human: I'm using the mq library of IBM to read messages from MQ queues. Now I need to retrieve the messageid of the message. I now it is in the message header under the name messageId. But this returns a byte[]. Now I need to change it to a readable string.How can I transform the messageId from byte[] to string?I tried a couple of conversions but non of them works:new String(theMessage.messageId)\nnew String(theMessage.messageId, \"UTF-8\")\nnew String(theMessage.messageId, \"UTF-16\")\ntheMessage.messageId.toString()### Assistant: The messageId in the MQMD is represented as 24 bytes. If you know what platform these were generated on you may be able to find some meaning to portions of them by converting the bytes to characters in the character set of the queue manager where they were produced but is not recommended to rely on any data being conveyed in the messageID as character data since I have seen statements from IBM similar to \"MsgId is generated by MQ in an IBM proprietary format and it may change at any time.\"If you want represent them as a string you should represent them as a 48 character HEX string representing the 24 bytes.Below is a sample functiongetHexStringIBM has provided in a Technote that will perform this conversion for you. You would use it like this:getHexString(theMessage.messageId)The sample function below is from IBM MQ Technote \"How to match correlation id's when request is made via JMS application and reply generated from base Java API\"public static String getHexString(byte[] b) throws Exception {\n String result = \"\";\n for (int i=0; i < b.length; i++) {\n result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 );\n }\n return result;\n}IBM Documents the format and uniqueness of the Queue Manager generated message IDs at the bottom of the Knowledge Center page \"Reference>Developing applications reference>MQI applications reference>Data types used in the MQI>MQMD - Message descriptor>Fields>MsgId (MQBYTE24)\"A MsgId generated by the queue manager consists of a 4-byte product identifier (AMQ\u00ac or CSQ\u00ac in either ASCII or EBCDIC, where \u00ac represents a blank character), followed by a product-specific implementation of a unique string. In IBM\u00ae MQ this contains the first 12 characters of the queue-manager name, and a value derived from the system clock. All queue managers that can intercommunicate must therefore have names that differ in the first 12 characters, in order to ensure that message identifiers are unique. The ability to generate a unique string also depends on the system clock not being changed backward. To eliminate the possibility of a message identifier generated by the queue manager duplicating one generated by the application, the application must avoid generating identifiers with initial characters in the range A through I in ASCII or EBCDIC (X'41' through X'49' and X'C1' through X'C9'). However, the application is not prevented from generating identifiers with initial characters in these ranges.\n"}
+{"text": "### Human: I am sending messages to a remote queue, to which I have no control.I send a xml file as message but when the application reads the message it gets a message header likejms_text \\0\\0\\0lqueue:///TEST12814758437071i don't want this message header to be present and my code for sending this message is as follows:Properties props = new Properties();\n props.setProperty(\"java.naming.factory.initial\",this.initialFactory);\n props.setProperty(\"java.naming.provider.url\", url);\n\n Context context = new InitialContext(props);\n\n QueueConnectionFactory qcf = (QueueConnectionFactory) context.lookup(this.context);\n qConn = qcf.createQueueConnection();\n queue = (Queue)context.lookup(name);\n qSession = qConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);\n qConn.start();\n QueueSender send = qSession.createSender(queue);\n String text = \"My xml file\";\n TextMessage tm = qSession.createTextMessage(text);\n send.send(tm);\n send.close();How do I avoid this ?### Assistant: It appears that you are sending a jms message to a non jms destination. How is the message being consumed on the destination? Is it expecting a native MQ message? The receiver is not understanding the MQRFH2 header that stores the JMS header properties.You should either configure the destination to understand jms or your can do something like the following to tell the mq jms that your receiver is a non-jms client.((com.ibm.mq.jms.MQQueue) queue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);\n"}
+{"text": "### Human: I just created a VM vagrant with centos, installed python2.7 and pip using Miniconda, installed pymqi using pip, created a test python file to see if my pymqi installation is correct :import pymqi\nprint \"hello...\"but I got this :[vagrant@localhost projects]$ python test.py\nTraceback (most recent call last):\nFile \"test.py\", line 1, in \nimport pymqi\nFile \"/home/vagrant/miniconda2/lib/python2.7/site-packages/pymqi/__init__.py\", line 109, in \nimport pymqe, CMQC, CMQCFC, CMQXC\nImportError: libmqic_r.so: cannot open shared object file: No such file or directoryI looked for that file :[vagrant@localhost projects]$ find /opt/mqm/ -name 'libmqic_r.so'\n/opt/mqm/lib/compat/libmqic_r.so\n/opt/mqm/lib/libmqic_r.so\n/opt/mqm/lib64/compat/libmqic_r.so\n/opt/mqm/lib64/libmqic_r.soThank you, your help is appreciated.### Assistant: I found the solution :export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/mqm/lib64\n"}
+{"text": "### Human: I'm pretty new to websphere MQ, so please pardon me if I am not using the right terms. We are doing a project in which we need to setup a MQ cluster for high availability.The client application maintains a pool of connection with the Queue Manager for subscribers and publishers. Suppose we have two Queue Managers in a cluster hosting the queues with the same names. Each of the queue has its own set of subscribers and publishers which are cached by the client application. Suppose one of the queue manager goes down, the subscribers and publishers of the queues on that queue manager will die making the objects on client application defunct.In this case can the following scenarios taken care of?1] When first QueueManager crashes, the messages on its queues are transferred to other queuemanager in the cluster2] When QueueManager comes up again, is there any mechanism to restore the publishers and subscribers. Currently we have written an automated recovery thread in the client application which tries to reconnect the failed publishers and subscriber. But in case of cluster setup, we fear that the publishers and subscribers will reconnect to the other running qmanager. And when the crashed queuemanager is restored, there will be no publishers and subscribers to it.Can anybody please explain how to take care of above two scenarios?### Assistant: WMQ Clustering is an advanced topic. You must first do a good amount of read up of WMQ and understand what clustering in WMQ world means before attempting anything.WMQ Cluster differs in many ways from the traditional clusters. Unlike the traditional clusters, say in a Active/Passive cluster, data will be shared between active and passive instances of an application. At any point in time, the active instance of application will be processing data. When the active instance goes down, the passive instance takes over and starts processing. This is not the case in WMQ clusters where queue managers in a cluster are unique and hence queues/topics hosted by those queue managers are not shared. You might have the same queues/topics in both queue managers but since queue managers are different, messages, topics, subscriptions etc won't be shared.Answering to your questions.1) No. Messages,if persistent, will remain in the crashed queue manager. They will not be transferred to other queue manager. Since the queue manager itself is not available nothing can be done till the queue manager is brought up.2)No. Queue manager can't do that. It's the duty of the application to check for queue manager availability and reconnect. WMQ provides automatic client reconnection feature where in the WMQ client libraries automatically reconnect to queue manager when they detect connection broken errors. This feature is available from WMQ v7.x and above with C and Java clients. C# client supports the feature from v7.1.For your high availability requirement, you could look at using Multi instance queue manager feature of WMQ. This feature enables an Active/Passive instances of the same queue manager running on two different machines. Active instance of the queue manager will be handling client connections while the passive instance will be in sleep mode. Both instances will be sharing data and logs. Once the active instance goes down, the passive instance becomes active. You will have access to all the persistent messages that were in the queues before the active queue manager went down.Read through the WMQ InfoCenter for more on Multi instance queue manager.\n"}
+{"text": "### Human: My aim is to put n number of messages in a for loop to a WebSphere MQ queue using WebSphere MQ java programming.My java program will run as a standalone program.If any exception in between , I need to rollback all the messages.If no exception then I should commit all the messages .The outside world should not see my messages in the queue until I complete fully. \nHow do I achieve this?Updated with sample code as per reply from T.Rob:Please check if sample code is fine ?Does setting MQGMO_SYNCPOINT is only related to my program's invocation ?\n(because similar programs running parallely will also be putting messages on the same queue and those messages should not gett affected by my program's SYNCPOINT.)public void sendMsg() {\n MQQueue queue = null;\n MQQueueManager queueManager = null;\n MQMessage mqMessage = null;\n MQPutMessageOptions pmo = null;\n System.out.println(\"Entering..\");\n try {\n MQEnvironment.hostname = \"x.x.x.x\";\n MQEnvironment.channel = \"xxx.SVRCONN\";\n MQEnvironment.port = 9999;\n\n\n queueManager = new MQQueueManager(\"XXXQMANAGER\");\n int openOptions = MQConstants.MQOO_OUTPUT; \n queue = queueManager.accessQueue(\"XXX_QUEUENAME\", openOptions, null, null, null);\n\n pmo = new MQPutMessageOptions(); \n pmo.options = CMQC.MQGMO_SYNCPOINT;\n\n\n String input = \"testing\";\n System.out.println(\"sending messages....\");\n for (int i = 0; i < 10; i++) {\n input = input + \": \" + i;\n mqMessage = new MQMessage();\n mqMessage.writeString(input);\n System.out.println(\"Putting message: \" + i);\n queue.put(mqMessage, pmo);\n\n }\n queueManager.commit();\n System.out.println(\"Exiting..\");\n\n } catch (Exception e) {\n e.printStackTrace();\n try {\n System.out.println(\"rolling back messages\");\n if (queueManager != null)\n queueManager.backout();\n } catch (MQException e1) {\n e1.printStackTrace();\n }\n } finally {\n try {\n if (queue != null)\n queue.close();\n if (queueManager != null)\n queueManager.close();\n } catch (MQException e) {\n e.printStackTrace();\n }\n }\n }### Assistant: WMQ supports both local and global (XA) units of work. The local units of work are available simply by specifying the option. Global XA transactions require a transaction manager, as mentioned by keithkreissl in another answer.For what you described, a POJO doing messaging under syncpoint, specifyMQC.MQGMO_SYNCPOINTin yourMQGetMessageOptions. When you are ready to commit, issue theMQQManager.commit()orMQQManager.backout()call.Note that the response and doc provided by ggrandes refers to the JMS and not Java classes. The Java classes use Java equivalents of the WMQ procedural API, can support many threads (doc) and even provide connection pooling (doc). Please refer to the Java documentation rather than the JMS documentation for the correct behavior. Also, I've linked to the WMQ V7.5 documentation which goes with the latestWMQ Java V7.5 client. The later clients have a lot more local functionality (tracing, flexible install path, MQClient.ini, etc.) and work with back-level QMgrs. It is highly recommended to be using the latest client and the download is free.\n"}
+{"text": "### Human: Since we are experiencing some trouble with IBM's Websphere MQ using XMS.net (Windows service that sometimes seems to give up listening for messages on a queue) we would like to create a simple application to monitor the depths of some queues (or number of messages on the queue) to be able to alert someone when the queue depth exceeds a certain threshold. This application would be launched by the task scheduler on a specific interval and would \"read out\" for X queues their queue depth (and maybe some other statistics).Our windows service is using the following code and I was hoping I could reuse that same \"knowledge\" for our \"monitoring\" application.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);\n\n //Read config values\n string QueueManager = ConfigurationManager.AppSettings[\"queuemanager\"];\n string Channel = ConfigurationManager.AppSettings[\"channel\"];\n string Queue = ConfigurationManager.AppSettings[\"queue\"];\n string HostIP = ConfigurationManager.AppSettings[\"host\"];\n int Port = int.Parse(ConfigurationManager.AppSettings[\"port\"]);\n\n //Create connection\n var factoryfactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n var connectionfactory = factoryfactory.CreateConnectionFactory();\n\n connectionfactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, QueueManager);\n connectionfactory.SetStringProperty(XMSC.WMQ_HOST_NAME, HostIP);\n connectionfactory.SetIntProperty(XMSC.WMQ_PORT, Port);\n connectionfactory.SetStringProperty(XMSC.WMQ_CHANNEL, Channel);\n connectionfactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V2);\n connectionfactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);\n\n Console.WriteLine(\"Creating connection\");\n var connection = connectionfactory.CreateConnection();\n connection.ExceptionListener = new ExceptionListener(OnXMSExceptionReceived);\n\n //Create a_session\n Console.WriteLine(\"Creating sessions\");\n var session = connection.CreateSession(false, AcknowledgeMode.ClientAcknowledge);\n\n //Create queue\n Console.WriteLine(\"Creating queue\");\n var queue = session.CreateQueue(string.Format(\"queue://{0}/{1}\", QueueManager, Queue));I have browsed through the properties ofsession,queueetc. but, ofcourse, there are no \"current queue depth\" properties. I could useGetIntProperty()orGetLongProperty()on these objects but I don't know which constant to use for that (I have seen IBM.XMS.MQC.MQIA_CURRENT_Q_DEPTH but that contains anintandGet...Property()expects astringas parameter).Long story short: how would I go about retrieving a queues depth with the above code as a starting-point? Is it at all possible using XMS.Net?### Assistant: I was able to solve it using,as Shashi suggested, the MQ API. For this you need to reference amqmdnet.dll (C:\\Program Files (x86)\\IBM\\WebSphere MQ\\bin\\amqmdnet.dll) and use the following (example) code. Please note that this is a simple example, no exception handling etc. is included.using System;\nusing System.Collections;\nusing System.Configuration;\nusing IBM.WMQ;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Connection properties\n var properties = new Hashtable();\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);\n properties.Add(MQC.CHANNEL_PROPERTY, \"SOME.CHANNEL.TCP\");\n properties.Add(MQC.HOST_NAME_PROPERTY, \"12.34.56.78\");\n properties.Add(MQC.PORT_PROPERTY, 1416);\n\n var qmgr = new MQQueueManager(\"MYQMGR\", properties);\n\n Console.WriteLine(\"Local : {0}\", GetQueueDepth(qmgr, \"FOO.LOCALQ\"));\n Console.WriteLine(\"Report : {0}\", GetQueueDepth(qmgr, \"FOO.REPORTQ\"));\n }\n\n public static int GetQueueDepth(MQQueueManager queuemgr, string queue)\n {\n return queuemgr.AccessQueue(queue,\n MQC.MQOO_INPUT_AS_Q_DEF + \n MQC.MQOO_FAIL_IF_QUIESCING + \n MQC.MQOO_INQUIRE).CurrentDepth;\n }\n }\n}This performs way better thanmy initial \"workaround\".\n"}
+{"text": "### Human: We have one MQ Queue which receives messages from an external system out of our control.\nOur system processing the incoming messages is a critical one and needs to be up and running 27x7 no matter what.The order in which the incoming messages are processed is also not negotiable which means we need to process them in exactly the order they arrived.To make sure our system is 100% available we deployed our system to a bunch of physical machines able to process those messages.Once the messages reached our system we put in place a mechanism to make sure the messages processing does not go out of order while also getting some performance gain as a result of the parallel processing. For us the performance gain is a good to have, however it is rather a side effect as our main goal is the high availability while assuring the right processing order.My thoughts were to have on every single machine an MDB able to process the incoming messages but only have one active consumer at a time.We are using Webshere MQ as a JMS provider and Webshere Application Server 8.5 to deploy our application.The problem with multiple consumers listening to the same queue does not seem to be a workable solution as when messages arrive in bulk they would be round-robin passed to all consumers and there is no way to control how this is going to happen and the messages easily go out of sequence.When I manually stopped all the listeners but one obviously the messages got processed in order. But manually shutting down and starting up such listeners is definitely not a HA solution.We could put in place monitoring processes to check for health of the system and shut things down or start them up as required but this still looks too weak to me.\nWhat we want in fact is to have all listeners up and running but only one receiving the messages. If that one goes down for whatever reasons then another one sitting there will become active and start processing messages.Initially we considered using a topic rather than a queue but this comes with other issues like below:we cannot control the source of our messagesthe high volume of messages we have would put us in in trouble with our going down subscribers that have to be durable and such when coming up back will have to deal with lots of pending messagesthe input queues are already part of a cluster and changing all the infrastructure would require a lot of workAnyway in my view it has to be an existing pattern to accommodate situations like this. Any help, suggestion would be greatly appreciated.The solution does not have to be a specific MQ one, any idea is welcome.Thanks in advance### Assistant: Create a second queue, we'll call it the \"control queue.\" Into this queue, put a single message, we'll call it the \"token.\" Change application processing as follows:Listen on the control queue for a message.Get the token from the control queue under syncpoint.Put the same token message back on the control queue, also under syncpoint.Process a transaction from the normal input queue, also under syncpoint.COMMITthe messages.Loop.TheCOMMITcompletes the transaction on the input queue and makes the token available to the other MDBs. No processing of the input queue can occur except by the MDB that has the token under syncpoint. However you can have any number of MDBs waiting on the token. A failure of any one of them allows the others to take over instantly.No need to use XA, by the way. WMQ's single-phase COMMIT works great with this.\n"}
+{"text": "### Human: Consider the following queue defintinons:SET AUTHREC OBJTYPE(QMGR) GROUP('mq-user') AUTHADD(INQ,DSP,CONNECT)SET AUTHREC PROFILE(SYSTEM.MQEXPLORER.REPLY.MODEL) OBJTYPE(QUEUE) GROUP('mq-user') AUTHADD(INQ,DSP,GET)SET AUTHREC PROFILE(SYSTEM.ADMIN.COMMAND.QUEUE) OBJTYPE(QUEUE) GROUP('mq-user') AUTHADD(INQ,DSP,PUT)DEFINE CHANNEL ($cname) CHLTYPE (SVRCONN) TRPTYPE (TCP) MCAUSER('tcs-mq-user') REPLACESET CHLAUTH($cname) TYPE(ADDRESSMAP) ADDRESS(*) MCAUSER('tcs-mq-user')What is the meaning of MCAUSER in both DEFINE CHANNEL and SETCHLAUTH?Should tcs-mq-user belong to mq-user group?Does this mean only tcs-mq-user has access to the queue manager in bindings mode? Now what if I want to give access to another user in the binding mode, should I create another pair of DEFINE CHANNEL and SET CHLAUTH commands for this user?Is it possible to give the channel access to the mcs-user group?### Assistant: OK, answers are on sale, buy one get three free today! :-) Let's take these in order...1.A.The channel's MCAUSER value is the ID against which authorization checks are performed. If theDEFINE CHL() CHLTYPE(SVRCONN)leaves MCAUSER blank, then clients connecting can specify the ID that they wish to connect as. If they fail to specify, WMQ clientattemptsto use the ID of the client user as seen from the workstation where the client app is running and present that. SettingMCAUSERin the channel definition prevents the client app from specifying the value.1.B.The MCAUSER in anADDRESSMAPrule is used to map theMCAUSERbased on some identifying criteria. It says \"IFa connection arrives onthis channelwith a specified IP address | User Name | SSL Distinguished NameTHENusethisID as theMCAUSERANDallow the channel to run if no other rules block it.The recommendation if aCHLAUTHmapping rule is used is usually to set the channel'sMCAUSERto a value that cannot possibly be a user ID so it will not run. This way the channel defaults to a secure state unless aCHLAUTHrule overrides the MCAUSER to a value intended to allow access. The quintessential value forMCAUSERused to benobodyuntil Mark Taylor, WMQ Strategist from the Hursley Lab, suggested using a value that can not be an actual user ID, such asno#body. As of WMQ V7.1 the value*NOACCESSis a reserved work and what I'm using in the conference presentations these days.2.Yes. WMQ authorizes based on groups. The standard advice is to deconstruct your security requirements into roles like 'admin', 'app1', 'app2', 'monitoring', 'anonymous', etc. Then for each of these roles that requires access, create a group.But access requests come from principals that are uniquely identified, not from groups. The authorization check requires an account to check against so the MCAUSER in the channel is an ID while the authorization rights are stored by group. To associate a user with the correct rights, enroll them in the right group.This is standard UNIX authorization model that supports separation of duties. Resource admins (the WMQ administrator) authorize groups. Account admins enroll user IDs in groups. It takes both groups to provide access. In the real world, most shops do not utilize the separation of duties feature but in a significant cases it is mandatory.3.Sort of. A default QMgr at V7.1 or higher won't allow any remote connections at all. This is because when created it has noAUTHRECrules so non-admins are not granted access. Admins are blocked from remote access by the defaultCHLAUTHrule.With the rules specified,anyonecan successfully connect to the$cnamechannel and will be authorized astcs-mq-user. If you want them to connect as a different user IDwith the same privilegesthen you would need to add that ID to themq-usergroup and then set the channel up to map the IDs presented. If you wanted toenforcewhich ID someone connected as you'd have to specify the mapping by IP address or, better yet, based on their certificate distinguished name.4.No. As noted in #2 above, access requests are always made by principals, not by groups. The whole point ofCHLAUTHrules,MCAUSERand distinguished name mapping is to resolve the user ID that the channel uses for authorization checks. The channel definition'sMCAUSERis a security control in that ID resolution process and so it operates on the ID and not on the group.If you haven't already found the site, you might findT-Rob.netuseful. In particular, on the Links page I have posted all the WMQ Security presentations from the conferences as well as links to my and other authors' articles.\n"}
+{"text": "### Human: I have a MDB which listens to WebSphere MQ. It does not picks up the messages in the order that has been received by the Queue. How can i make it read it in that order? Is it possible? Should i not use a MDB.### Assistant: In general, WMQ delivers messages in the order that they were received. However, several things can impact that...If the queue is set to priority instead of FIFO delivery and messages arrive in different priorities, they will be delivered \"out of order\".Distinguish between order produced and order delivered. If the messages are produced on a remote QMgr and there are multiple paths to the local QMgr, messages may arrive out of order.Difference in persistence - if messages are produced on a remote QMgr and are of different persistences, the non-persistent messages may arrive faster than the persistent ones, especially with channel NPMSPEED(FAST) set.Multiple readers/writers - Any dependency on sequence implies a single producer sending to a single consumer over a single path. Any redundancy in producers, consumers or paths between them can result in messages delivered out of sequence.Syncpoint - To preserve sequence, ALL messages must be written and consumed under syncpoint or else ALL must be written and consumed outside of syncpoint.Selectors - These specifically are intended to deliver messages out of order with respect to the context of all messages in the queue.Message groups - Retrieval of grouped messages typically waits until the entire group is present. If groups are interleaved, messages are delivered out of sequence.DLQ - if the target queue fills, messages may be delivered to the DLQ. As the target queue is drained, messages start going back there. With a queue near capacity, messages can alternate between the target queue and DLQ.So when an MDB is receiving messages out of order any of these things, or even several of them in combination, may be at cause. Either eliminate the dependency on message sequence (best choice) or else go back over the design and reconcile all the factors that may lead to out-of-sequence processing.\n"}
+{"text": "### Human: We are currently using IBM MQ via JMS, but seem to be pushing through more messages than it can handle - strangely, the problem seems to be intermittent.The messages are prices and thus dont need to be guaranteed, just need to be sent quickly.As IBM have aLow Latency product, I am wondering if that is perhaps the better solution - but it does not seem to have a JMS api, or at least not easily visible.Anyone know if there is a JMS api into the Low Latency product, or if the \"unique\" API it does have is JMS-like...Alternatively, pointers for MQ tuning would also be appreciated... :)### Assistant: Definitely a low latency messaging product would be better suited to your problem, I am working on a project where we do something very similar using a low latency messaging product called LBM from29West. It doesn't have a JMS api and I suspect most of the products in the low-latency space won't. There a large number of features that don't make sense in combination with these types of products (e.g. persistence, selectors, etc.). We found that writing our own simple api over the top of the messaging product to be fairly easy and gives use the flexibility to change products later and frees us from some of the bulk and verbosity of the JMS api.Another option to consider would beJGroups.29West have added JMS support to their messaging product line.\n"}
+{"text": "### Human: IBM WebSphere Liberty Profileprovides the\"wmqJmsClient-2.0\"feature to interact withIBM MQIs there an equivalent for Open Liberty?[UPDATED]If not (as it seems), how to connect Open Liberty to IBM MQ?Should I develop an Open Liberty \"feature\" equivalent of the one available in WLP, based on the IBM MQ official RAR file (currently\"9.1.0.0-IBM-MQ-Java-InstallRA.jar\") ?Or is there a \"generic\" way to configure such a connection in Open Liberty?(I guess the question arises with other Queue Managers likeActiveMQ,Artemis,OpenMQetc.)### Assistant: OpenLiberty has the jms-2.0 feature, which allows you to configure a JCA resource adapter which provides JMS such as theWebSphere MQ resource adapter.Configuration in server.xml would be something like the following,\n \n jms-2.0\n jndi-1.0\n servlet-3.1\n \n\n \n\n \n \n \n\n ...\n"}
+{"text": "### Human: I am doing an IBM webpshere project and IBM MQ is reauired within this project, and now, We need to use Jmeter to send message to IBM MQ,Anyone knows how to create the test plan in Jmeter for IBM MQ message test? link and test plan are preferred.Note, IBM MQ is a little difference with standard JMS, it provides host, queue manager, server channel, port and queue name, how can we configure this within Jmeter?Thanks in advance.### Assistant: Follow instructions fromObtaining the WebSphere MQ classes for JMSguide to get all the necessary client libraries.Place libraries from step 1 to JMeter classpath using one of following approaches:add jars to /lib folder of JMeter installationadd the next line touser.propertiesfileuser.classpath=/folder/with/mq/jarsJMeter restart will be required to pick the libraries up.Follow steps fromBuilding a JMS Testing Plan - Apache JMeterguide to set JMeter up.\n"}
+{"text": "### Human: So well, I am trying to get a MQXAQueueConnectionFactory to work, I have created a extended class from the JmsComponent to handle username and password when sending data to the queue.\nIt does get/put messages on the queue, but in my case I've created a router to test the XA such asfrom(\"wmq:queue:incomingQueue\")\n .process(new Processor(){\n ... Thread.sleep(20000)\n })\n .to(\"wmq:queue:outgoingQueue\")while being in sleep, I shut down the queuemanager. However when trying to get uncommited messages from the queueDISPLAY QSTATUS('qChainQueue')i getCURDEPTH(0), while it should be 1 as I understand the XA part.Am I doing this totally wrong?How can it be tested?HelpClass to handle WMQ:public class WMQComponent extends JmsComponent {\n private final String username;\n private final String password;\n\n public WMQComponent(String hostname, int port, String username, String password,\n String queueManager, String channel) throws JMSException {\n super();\n this.username = username;\n this.password = password;\n\n MQXAQueueConnectionFactory connectionFactory = new MQXAQueueConnectionFactory();\n connectionFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);\n connectionFactory.setFailIfQuiesce(1);\n\n connectionFactory.setHostName(hostname);\n connectionFactory.setPort(port);\n connectionFactory.setQueueManager(queueManager);\n connectionFactory.setChannel(channel);\n\n setConnectionFactory(connectionFactory);\n }\n\n @Override\n public Endpoint createEndpoint(String uri) throws Exception {\n if (uri.contains(\"username\") || uri.contains(\"password\")) {\n throw new IllegalStateException(\"Username and password is set by the component\");\n }\n if (uri.contains(\"?\")) {\n return super.createEndpoint(uri + \"&username=\" + username + \"&password=\" + password);\n } else {\n return super.createEndpoint(uri + \"?username=\" + username + \"&password=\" + password);\n }\n }\n\n}With the following errors:2015-03-25 14:01:12,077 [ #2 - Multicast] INFO dest_chain_ldap - org.springframework.jms.IllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'QMBATCHESB' with connection mode 'Client' and host name 'hostname.com'.; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'QMBATCHESB' with connection mode 'Client' and host name 'hostname.com'. Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2059' ('MQRC_Q_MGR_NOT_AVAILABLE').\n at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:279)\n at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)\n at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)\n at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:228)\n at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:431)\n at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:385)\n at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:153)\n at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)\n at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)\n at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)\n at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)\n at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)\n at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)\n at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)\n at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)\n at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)\n at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)\n at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)\n at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)\n at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)\n at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)\n at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)\n at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)\n at org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:732)\n at org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:82)\n at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:303)\n at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:288)\n at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)\n at java.util.concurrent.FutureTask.run(FutureTask.java:166)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)\n at java.lang.Thread.run(Thread.java:722)\nCaused by: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'QMBATCHESB' with connection mode 'Client' and host name 'hostname.com'. Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:496)\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:236)\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:430)\n at com.ibm.msg.client.wmq.internal.WMQXAConnection.(WMQXAConnection.java:70)\n at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:190)\n at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6210)\n at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:278)\n at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6155)\n at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:144)\n at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:223)\n at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.doCreateConnection(UserCredentialsConnectionFactoryAdapter.java:175)\n at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.createConnection(UserCredentialsConnectionFactoryAdapter.java:150)\n at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)\n at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:456)\n ... 29 more\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2059' ('MQRC_Q_MGR_NOT_AVAILABLE').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:223)\n ... 41 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9204: Connection to host 'hostname.com(1514)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2059;AMQ9213: A communications error for occurred. [1=java.net.ConnectException[Connection refused: connect],3=hostname.com]],3=hostname.com(1514),5=RemoteTCPConnection.connnectUsingLocalAddress]\n at com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiConnect(RemoteFAP.java:1831)\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:345)\n ... 40 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9213: A communications error for occurred. [1=java.net.ConnectException[Connection refused: connect],3=hostname.com]\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:612)\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:940)\n at com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.connect(RemoteConnection.java:1097)\n at com.ibm.mq.jmqi.remote.internal.system.RemoteConnectionPool.getConnection(RemoteConnectionPool.java:348)\n at com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiConnect(RemoteFAP.java:1503)\n ... 41 more\nCaused by: java.net.ConnectException: Connection refused: connect\n at java.net.DualStackPlainSocketImpl.connect0(Native Method)\n at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)\n at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)\n at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)\n at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)\n at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)\n at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)\n at java.net.Socket.connect(Socket.java:579)\n at java.net.Socket.connect(Socket.java:528)\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection$2.run(RemoteTCPConnection.java:597)\n at java.security.AccessController.doPrivileged(Native Method)\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:588)\n ... 45 more### Assistant: The reason code 2059 and various errors stating that the connection was refused suggest either a mechanical issue (i.e. Listener not running) or an auths issue.If I were attempting to debug this, the first thing I'd do is to enable authorization events, channel events, and any others you would normally enable. If you use MQ Explorer, also install theMS0P Pluginwhich will allow you to view the event messages in human-readable text.Next, I would use the MQ sample programs to test. Since I always install the full client rather than grabbing the jar files, I have amqsputc available. However, the Java classes have IVT (initial verification test) programs. These ensure that the listener is running, the channel is configured and available, etc. As of v7.1 this also ensures that theCHLAUTHrules are set to allow the access. As of v8.0, or if you had the Capitalware exit installed, this also lets us test the user ID and password authentication.The queue manager's error log and the event messages should provide good diagnostics, assuming the connection request makes it to MQ. Be sure to look both in the QMgr-specific error logs and the installation-global error logs.Once I had confirmed that basic connectivity is in place, I'd reconcile my client-side configuration parameters for host, port, channel and if it is specified [shudder!] the QMgr name. Assuming these are correct and having proven basic connectivity works, it is now possible to test the app with some confidence.The same method applies. First make sure the app's connection request makes it to the QMgr. If it does and is refused, the event messages and error logs will note this and why. If there is no indication of a failure in these places, the app isn't getting to the QMgr. The 2059 can indicate that the socket was refused, that the listener is up but the QMgr is not, that the channel instances have maxed out, or that after provisionally starting the channel it was closed by the QMgr, often due to aCHLAUTHrule. In any case, the event messages and error logs will have a detailed explanation as to why.\n"}
+{"text": "### Human: I have a TIBCO BusinessWorks process that is publishing to a JMS topic -- lets call it TOPIC.A -- there is one process that is subscribing to that topic with a name SUBSCRIBE.A.The problem I have is that the first server that starts listening to SUBSCRIBE.A hooks in fine. The other 3 servers, running the exact same process get an error of \"WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2429' ('MQRC_SUBSCRIPTION_IN_USE')\"This can't be reasonable behavior for enterprise software, and I know WebsphereMQ, JMS and TIBCO Businessworks all scale well, so I must be missing something. I only want each event processed once, but a single box just isn't going to do it, both for fail-over reasons and shear volume reasons.What do I have to do to let all 4 servers in the cluster to service the subscription SUBSCRIBE.A?### Assistant: I agree it does not seem like reasonable behavior for enterprise software - but this restriction is imposed by the JMS specification. The JMS 1.1 spec, section 6.66.1 says \"Only one session at a time can have a TopicSubscriber for a particular durable subscription\".That said, WebSphere MQ does provide a vendor-specific option that allows you to do what you want: see theCLONESUPPConnection Factory property. This is documented in the Infocenter at theCLONESUPPpropertiespage.While it's specific to MQ, if you specify this using administered objects you code will not need to use any vendor-specific methods.\n"}
+{"text": "### Human: I have a cluster named inventory with 4 queue managers defined london, paris, newyork, tokyo. If london and paris are the default queue managers which get messages, how can I make newyork and tokyo as default to receive and not allow clients to put messages on london and paris but they should still be in the cluster. can this be achieved with workload management ?If there are any other solutions please let me know. All this should be done without making any changes on the client side.Thanks### Assistant: Adding to T.Rob's suggestions here are couple of options you could take a look at:Disable put on cluster queue instances inlondonandparis. So the messages will be distributed betweennewyorkandtokyo.Write a cluster workload balancing exit that will skip putting messages to cluster queues inlondonandparisand puts messages only to cluster queue instances innewyorkandtokyo.SeeWriting and compiling cluster workload exitsfrom the MQ 7 Documentation.\n"}
+{"text": "### Human: I'm new to WebSphere MQ and I am trying to move files through WebSphere MQ as messages using c# code. Can WebSphere MQ transfer files (e.g. *.txt) directly?Thanks in Advance.### Assistant: WebSphere MQ File Transfer Edition (FTE) is a product built on top of WebSphere MQ for transferring files. No coding is required to for transferring files. There are commands and MQ Explorer through which you can configure your file transfers. You can also start file transfers through scripting.Read through this developerWorksarticle\n"}
+{"text": "### Human: We are working on an IBM WebSphere MQ application, and we use JMS API to operate the message. But we have a problem that the connection takes too much time, and we want to pool the JMS connection, for it's a standalone application, we have no application container to provide JNDI or pooling service. So is there a solution to resolve this? For JDBC we can use DBCP or c3p0 to archive pooling datasource, in JMS, is there any similar project that can pool JMS connections?### Assistant: It used to be that the JMSMQConnectionFactoryhad pooling built in, but it seems that in version 7, it has been removed.Set the use of ConnectionPooling in earlier versions of the WebSphere\n MQ classes for JMS. This method is retained for compatibility with\n older MQJMS applications, but, because this Connection Pooling\n functionality has been removed from version 7, setting this property\n will have no effect.In the absence of anything else, you can useApache Commons Pool. Same idea as DBCP (which uses Pool) but for non JDBC objects.\n"}
+{"text": "### Human: Let's say there is a mobile application that needs to make a sync request/query for some data from a server. The request will come to hosted JMS client first, that will publish a message/request on external Queue (from partner). Now here where it start to be unclear. How do I get a response back from the partner in the synchronous fashion.Should the partner expose separate queue for me to subscribe and I then block the mobile request till I get the response message from that separate queue?Does JMS or proprietary WebSphere MQ interface have support for sync messaging?What are other ways to implement it with messaging?Thanks### Assistant: The textbook pattern is as follows:JMS app receives a request from the mobile device.JMS app opens the reply-to queue (which may be dynamic).JMS app prepares a request message specifying the destination from #2 as the JMSREplyTo destination.JMS app sends the request outside of syncpoint to the external service provider.JMS app listens for a response with a specified wait interval. If it used a dynamic reply-to queue it does a simple receive. If multiple instances are listening on the same queue (which is more likely with an external service) then it uses the JMSMessageID returned from the send as the JMSCorrelationID specified on the receive.JMS app receives the response from the external service.JMS app replies to the mobile device.Note that with WMQ the expected behavior from the service provider is to copy the JMSMessageID from the request message to the JMSCorrelationID of the response. It is less common to require the sender to generate a JMSCorrelation ID and copy it to the JMSCorrelationID of the response but some applications use that behavior. You will need to understand how your service provider deals with this to determine the correct behavior for your requester application.If you are using the complete WMQ Client install you will already have sample code that does most of this. If installed to the default location, look in...C:\\Program Files\\IBM\\Websphere MQ\\tools\\jms\\samples\\simple\\simpleRequestor.java...or the equivalent location under/var/mqmfor UNIX/Linux distributions. This is one of the many reasons to install the full client rather than simply grabbing the jar files. If you need to download the client is is delivered asSupportPac MQC7.\n"}
+{"text": "### Human: I am writing a C# client that connects to IBM Websphere MQ Manager using amqmdnet.dll using the following construct:_myQueueManager = new MQQueueManager(queueManagerName, properties);In the properties Hashtable I am setting hostname, channel and queuemanager. Now, how can I have auto reconnect functionality in my client application? We have IBM MQ multi-instance queue manager HA configuration.Basically, I have four end points to which I have to fall back in case of connection failure from my client?### Assistant: According tothe docs:You can supply a list of hostnames and ports as an argument to the\n constructor MQQueueManager (String queueManagerName, Hashtable\n properties) using CONNECTION_NAME_PROPERTY.For example:ConnectionName = \"fred.mq.com(2344),nick.mq.com(3746),tom.mq.com(4288)\";\nHashtable Properties-new Hashtable();\nproperties.Add(MQC.CONNECTION_NAME_PROPERTY,ConnectionName);\nMQQueueManager qmgr=new MQQueue Manager(\"qmgrname\",properties);When a connection attempt is made, the connection name list is\n processed in order. If the connection attempt to the first host name\n and port fails, then connection to the second pair of attributes is\n attempted. The client repeats this process until either a successful\n connection is made or the list is exhausted. If the list is exhausted,\n an appropriate reason code and completion code is returned to the\n client application.Be sure to also follow the advice inAutomatic client reconnection in .NETto make sure the option is correctly specified with respect to managed/unmanaged mode.\n"}
+{"text": "### Human: We are backend processor and doing programming with JMS MQ. We have 2 queues. one is used to get message and another one is used to send message. All the banking users will put messages to Q1 through their IB, MB etc. We receive messages from Q1 and process it and we send message to Q2.Currently we do not use multi threading for this. Can we able to use multi threading for this or single thread is enough to do this. because we are getting messages from Q1 one by one and process it.Kindly revert back to me if question is not understandable. Please someone help me.### Assistant: Yes, JMS allows for multiple readers on the same queue. You can do this by multi-threading, multiple application instances, or a dispatch layer that fetches messages and then passes them to a handler through a callback or other mechanism.The application must support that, however. For example, if two messages are related and must be processed in order, the order is not preserved if there is more than one listener on the queue. This is one reason why async messaging patterns strongly prefer messages not to have order dependencies or affinities.If you use multi-threading, it is important to make sure to preserve transactionality. If multiple threads use the same connection and one issues aCOMMITthen that commits all outstanding messages across all the threads sharing that connection.\n"}
+{"text": "### Human: I have a task to write a script that will filter an input from an MQ runmqsc command and redirect the output into another file. I have been working around using many other Linux commands piped together and it seems to work just fine in Linux, but my manager needs to run the script on an AIX system, so UNIX operating system.\nI was made aware that many commands that run fine on Linux or get the job done in Linux will produce a totally different output on UNIX or UNIX-based systems.\nThe output from the runmqsc command looks like this:5724-H72 (C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.\nStarting MQSC for queue manager CNUMQ02B.\n\n\n 1 : DISPLAY QLOCAL(*) CURDEPTH\nAMQ8409: Display Queue details.\n QUEUE(ADEXA.AOM.REPLY.MR.QL) TYPE(QLOCAL)\n CURDEPTH(0) \nAMQ8409: Display Queue details.\n QUEUE(ADEXA.AOM.REPLY.QL) TYPE(QLOCAL)\n CURDEPTH(0) \nAMQ8409: Display Queue details.\n QUEUE(ADEXA.ERROR.QL) TYPE(QLOCAL)\n CURDEPTH(0) \nAMQ8409: Display Queue details.\n QUEUE(ADEXA.FACT.OUT.QL) TYPE(QLOCAL)\n CURDEPTH(0)\nAMQ8409: Display Queue details.\n QUEUE(ADW.REMAN.XREF.ERR.QL) TYPE(QLOCAL)\n CURDEPTH(14)\nAMQ8409: Display Queue details.\n QUEUE(SAPNA.MESS.CRITICAL.CLASS.RESUME.QL)\n TYPE(QLOCAL) CURDEPTH(123)\nOne MQSC command read.\nNo commands have a syntax error.\nAll valid MQSC commands were processed.What I basically need to do is only display the name of the queue, a whitespace, and then the queue depth on the same line, with no trailing whitespaces and no newline characters at the beginning or end of file, so that it will resemble a csv file with the whitespace as the separator. I also need to filter out queues that have a queue depth equal to 0, so the output will look like this:ADW.REMAN.XREF.ERR.QL 14As I said I tried many commands on Linux, but I have a lack of knowledge of what commands and flags actually work more or less the same on UNIX and Linux, and my manager wants this today, so if by any chance you read this I ask that you at least guide me what to use to try working it out :) Thanks.This is what I wrote in Linux:head -n -3 \"$1\" | \ntail -n +6 | \nsed '/AMQ8409: Display Queue details./d' | \nsed 's/TYPE(QLOCAL)//g' | \ntr -d ' \\t\\r\\f' | \nawk 'NR%2{printf \"%s \",$0;next;}1' | \nsed '/CURDEPTH(0)/d' | \nawk '{gsub(/QUEUE(/, \"\"); gsub(/CURDEPTH(/, \"\"); gsub(/)/, \"\"); print}' |\nsort -nk2### Assistant: Try this simpler command..sed -n -e 's/.*QUEUE(\\([^)]*\\)).*/\\1/p' -e 's/.*CURDEPTH(\\([0-9]*\\)).*/\\1/p' \\\n | paste -d ' ' - - \\\n | grep -v ' 0$'\n"}
+{"text": "### Human: How do I ping an IBM WebSphere MQ queue manager? Is there a way throughcmd.exe? Is there a way to use WebSphere to do it?I have triedrunmqsc QMGR \"qManager\"Thanks!### Assistant: Depends on what exactly you mean by 'ping'. Do you want to check for running WMQ processes? For local connectivity to the QMgr? Remote connectivity? Whether a specific channel or queue is available?Locally you can usedspmqand it will show you all the locally defined QMgrs and their status. Remotely, you can ping the listener but if you do not complete the connection, it causes WMQ to log an error and cut a trace. Remotely, it is better to use the WMQ client to make a connection. If the connection succeeds then the QMgr is up. If you get an error, then the error code (or linked exception in JMS) will tell you how far into the WMQ stack the connection request got - i.e. whether the listener was down, or if it was up and there was a problem at the QMgr, or if you don't have authority, etc.There are sample programs that come with MQ such asamqsgetandamsqput, and their client-based equivalentsamqsgetcoramqsputc, which connect and get or put a message. These can be used in scripts to check MQ status. Also, there is a tutorialherethat provides a stand-alone JMS program that can connect which you could customize as a ping application.The format for the command you tried is:echo dis qmgr qmname | runmqsc QMGRNAMEThis echoes a command to display the QMgr's attributes intorunmqscand executes it. The manual containing all therunmqsccommands for v7.0 ishere. The v7.1 manualis here.Finally, although I don't think this is what you are looking for, WMQ has a ping command. It is used on one queue manager to test the channel connectivity to another queue manager. The WMQ ping exercises the channel path and validates things such as the remote listener is up, the remote queue manager has a compatible channel instance defined, etc. However, this is more useful to an MQ administrator than to a developer wanting to know if the queue manager is up. For that you'd want some version of one of the suggestions above.\n"}
+{"text": "### Human: I'm using MQ JMS interface with MQ 6.0.2.It seems that only pre defined properties are suported and not arbitrary ones.\nfor instance, I can properlygetJMSCorrelationID(),getJMSPriority()etc. However, when i set an arbitrary property on the sender:message.setStringProperty(\"my arbitrary name\", \"value\");I can't get the property from the message on the receiver:message.getStringProperty(\"my arbitrary name\");I simply getnull.Is there a way to do that as in any JMS implementation, or is that an MQ JMS limitation?### Assistant: If you have the complete client install, you can go toC:\\Program Files\\IBM\\WebSphere MQ\\tools\\jms\\samples\\interactive\\or somewhere in/opt/mqm/sampand look forSampleConsumerJava.javaandSampleProducerJava.java.From the sample Producer program:// Set custom properties\n msg.setStringProperty(\"MyStringProperty\", \"My Year Of Birth\");\n msg.setIntProperty(\"MyIntProperty\", 2007);And from the sample Consumer:// Get values for custom properties, if available\n String property1 = msg.getStringProperty(\"MyStringProperty\");\n\n // Get value for an int property, store the result in long to validate\n // the get operation.\n long property2 = ((long) Integer.MAX_VALUE) + 1;\n property2 = msg.getIntProperty(\"MyIntProperty\");\n\n if ((property1 != null) && (property2 < Integer.MAX_VALUE)) {\n System.out.println(\"[Message has my custom properties]\");Property names follow the rules for Java variable names and cant have spaces in them.\n"}
+{"text": "### Human: This is excerpt of program which throws an exception with code MQException (CompCode: 2 Reason: 2059)Hashtable properties = new Hashtable();\n\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n properties.Add(MQC.HOST_NAME_PROPERTY, _host);\n properties.Add(MQC.PORT_PROPERTY, _port);\n properties.Add(MQC.CHANNEL_PROPERTY, _channel);\n\n _mqQMgr = new MQQueueManager(_manager, properties);I have setup trace log which produceslink. Small excerpt of it :000002B4 14:45:52.635100 16832.1 0x00000000 0B 08 00 00 : ..\n000002B5 14:45:52.635100 16832.1 ----} MQFAP.NmqiConnect(String,NmqiConnectOptions,MQConnectOptions,Hconn,Phconn,out int,out int,ManagedHconn) rc=OK\n000002B6 14:45:52.636100 16832.1 System.ArgumentNullException: Value cannot be null.\nParameter name: dest\n at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)\n at System.Array.CopyTo(Array array, Int32 index)\n at IBM.WMQ.MQFAPMQCNO.set_ConnTag(Byte[] value)\n at IBM.WMQ.MQFAP.NmqiConnect(String name, NmqiConnectOptions pNmqiConnectOpts, MQConnectOptions cno, Hconn remoteParentHconn, Phconn pHconn, Int32& compCode, Int32& reason, ManagedHconn rcnHconn)\n at IBM.WMQ.MQFAP.MQCONNX(String pQMgrName, MQConnectOptions pConnectOpts, Phconn phconn, Int32& pCompCode, Int32& pReason)\n000002B7 14:45:52.636100 16832.1 ---} MQFAP.MQCONNX(String,MQConnectOptions,Phconn,out int,out int) rc=OK\n000002B8 14:45:52.636100 16832.1 IBM.WMQ.MQQueueManager#01475D71 throwing MQException: cc=2 rc=2059\n000002B9 14:45:52.636100 16832.1 New MQException CompCode: 2 Reason: 2059\n000002BA 14:45:52.662095 16832.1 --}! MQQueueManager.Connect() rc=(Unknown(2059))Server side Windows Event Log:2/6/2020 16:00:18 - Process(4472.130285) User(MUSR_MQADMIN) Program(amqrmppa.exe) Host(MQ-TEIRESIAS-T) Installation(MQTest) VRMF(8.0.0.4) QMgr(MQ.EXTSERVICES)\n\nError on receive from host 10.0.8.46.\n\nAn error occurred receiving data from 10.0.8.46 over TCP/IP. This may be due to a communications failure.\n\nThe return code from the TCP/IP recv() call was 10054 (X'2746'). Record these values and tell the systems administrator.This is working code with amqmdnet.dll (9.0.0.0)We appreciate any help or how can contact IBM Support for this### Assistant: The issue has been resolved in APARIT31572. Fix provided by IBM, tested and verified OK. Released v9.1 CD 9.1.5\n"}
+{"text": "### Human: Is it possible to keep a history of messages (with message content would be perfect) that have already been retrieved and are no longer on a queue?In the application I can see when the sender attempts to put the message in the queue and when the receiver attempts to pick the messages up, but I'd like to see when the message really arrived into the queue and when the messages were really received.Does MQ Explorer have this function? How would I use it?### Assistant: What you are looking for is a message tracking/auditing software for IBM MQ. You can find a list of what is availablehere.\n"}
+{"text": "### Human: I am trying to write simple string message into a queue. TheMaxMsgLengthproperty of queue is set as 4 kb. The message has 2700 characters and when I try to put into queue I am getting 2030 (07EE) (RC2030):MQRC_MSG_TOO_BIG_FOR_Qexception. I am not doing any special kind of encoding and hence whatever is default for Windows should be used.I want to know how to determine the value that I should give inMaxMsgLengthproperty. How to calculate that.### Assistant: Please remember that theMaxMsgLengthas specified in the queue definition includes not just the payload, but also the message headerandany properties that you set. If you check the InfocenterMQ_* (String Lengths)page and look forMQ_MSG_HEADER_LENGTHyou will see that the MQMD alone is 4000 bytes. So if you set theMaxMsgLengthof the queue to 4k, the largest payload you can have is 96 bytes. If the queue in question is a transmission queue, you need the queue size plus the size of theMQXQHtransmission queue header.To specifically answer the question in the title of the post, you can find theMaxMsgLengthin two ways. Visually, by displaying the queue attributes. Programmatically, add \"Inquire\" to the open options when opening the queue and use theMQInqAPI call. Then add the total of theMQMD, any properties that you add (including the XML structures that contain them but are not returned in the API calls that manipulate them) plus any headers such asRFH2(if the queues are set to use that instead of native properties),MQXQH,MQDLQ, etc.\n"}
+{"text": "### Human: I am on websphere v7.0 and websphere mq 6. while trying to connect to queue manager through websphere console i am getting compcode '2' ('MQCC_FAILED') reason '2058' error.The queue manager with the same is available on the mq server with the server channel defined.Any help much Appreciated.### Assistant: MQRC_Q_MGR_NAME_ERROR (2058) is a generic error (This has been improved in the latest version of wmq). There could be a problem with the host name or its resolution, the port or even the channel name or qmgr name. Look closely for errors. Is there anything reported in /var/mqm/errors on the websphere 7 server?\n"}
+{"text": "### Human: I'm kind of confused about thesyncpointfrom WebSphere MQ. According to the reference from the WMQ Infocenter, thesyncpointis defined as below:The decision to commit or back out the changes is taken, in the simplest case, at the end of a task. However, it can be more useful for an application to synchronize data changes at other logical points within a task. These logical points are called sync points (or synchronization points) and the period of processing a set of updates between two sync points is called a unit of work.Therefore,a unit of workis named as processing between two sync points. From my understanding, that unit of work is a transaction actually. So I draw the picture here reflecting the relationship between them:Am I understanding it correctly?Another question here is as for the syncpoint, it's said to synchronize data for application, where is the data synced from and where to?Thanks### Assistant: Answer 1: Yes, you are understanding it correctly. Transactions are atomic units of work that succeed or fail in their entirety. Syncpoints are the boundaries between the transactions. The subtle difference between a transaction and a syncpoint is that the work done under a transaction can be in-doubt for a period of time whereas the sync point is the state during which the transaction is not in doubt. In the event of failure, the queues are restored to the state which existed at the last syncpoint and then any pending transactions rolled back or, in the case of XA, possibly committed by the resource manager.The Infocenter pageTransaction management and supportmay explain it better than the page linked in the post.Answer 2: The data is synchronized by the resource manager(s). For local units of work where messages are the only participants in the transaction, the synchronization occurs only in the queue, and the queue manager acts as both the resource manager and the transaction manager. For global units of work involving messages and database updates in the same transaction, the synchronization occurs in the QMgr and the database which act as resource managers. The transaction manager will either be MQ or an application server and it orchestrates the synchronization between the resource managers.Regardless of whether the transaction is local or global (sometimes also referred to as single-phase commit or 2-phase commit) the relationship between transactions and syncpoints is the same. The syncpoint is the most recent point in time at which a known state is preserved and to which an in-doubt transaction might be rolled back.\n"}
+{"text": "### Human: I am new to MQ..\nI have a requirement.\nCan I connect to a particular queue, using java, on a server without specifying the queue manager name?\nI have all the details like host name, port number, request, response queue name etc.,Thanks### Assistant: Yes. If the app specifies the QMgr name, then the name specified must actually match the QMgr connected to. However, if the app leaves the QMgr name blank, then whatever QMgr responds on that host, port and channel is accepted.For example, if you define a managed object it might look like this:DEFINE CF(JMSDEMOCF) +\n SYNCPOINTALLGETS(YES) +\n TRAN(client) +\n HOST(127.0.0.1) CHAN(MYAPP.SVRCONN) PORT(1414) +\n QMGR( )If not using JNDI, omit the environment hashtable entry for the QMgr name.\n"}
+{"text": "### Human: I am trying to set up a 2 way SSl using my java code. I am successful doing it one way that is server certificate gets validated from my side but when it comes to two way I get a 2397 Error code.Steps followed by me are:Create a keystore with a self-signed certificate using Keytool, deploy it in truststore of MQ server.Create a keystore for MQ server and create a self-signed certificate.Deploy MQ server's certificate in my truststore.Then I try to run my java Code. This works fine without SSL or One way SSL.But two way handshake if failing. Below is the code and stack trace://code to create MQ connectivity\n public static void main(String [] args){\n System.setProperty(\"javax.net.debug\",\"ssl\");\n //keystore path\n System.setProperty(\"javax.net.ssl.keyStore\", \"C:/keystores/keystore.jks\"); \n System.setProperty(\"javax.net.ssl.keyStorePassword\", \"password\");\n //trsutstore path\n System.setProperty(\"javax.net.ssl.trustStore\", \"C:/keystores/truststore.jks\");\n System.setProperty(\"javax.net.ssl.trustStorePassword\", \"password\");\n //cipher spec \n MQEnvironment.sslCipherSuite = \"SSL_RSA_WITH_NULL_MD5\";\n MQEnvironment.hostname = \"*****-ws3717\";//system name\n MQEnvironment.port = 1414;\n MQEnvironment.channel = \"channel_name\";//channel name\n MQQueueManager qm = null;\n try { qm = new MQQueueManager(\"QMNGR\");\n System.out.println(\"Conn Successs!!!\");\n } catch (MQException e) {\n e.printStackTrace();\n } \n finally {\n try {\n qm.disconnect();\n } catch (Exception e) {\n e.printStackTrace();\n e.getCause();\n }\n }\n } }Stack Trace is as follows:keyStore is : C:/keystores/keystore.jks\nkeyStore type is : jks\nkeyStore provider is : \ninit keystore\ninit keymanager of type SunX509\n***\nfound key for : selfsigned\nchain [0] = [\n[\n Version: V3\n Subject: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4\n Key: Sun RSA public key, 1024 bits\n modulus: 132473562370742919150140985227175013875110053845431438145351913928668686945002725183702560702247749924970161010103451411451345824467592557656888776558245848713650717773344294766986771753500118311618188922138349812131167438364266468003061810102502957510761089213138803410346480285664890149111581898928681089463\n public exponent: 65537\n Validity: [From: Fri May 25 13:54:00 IST 2012,\n To: Sat May 25 13:54:00 IST 2013]\n Issuer: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n SerialNumber: [ 4fbf41a0]\n]\n Algorithm: [MD5withRSA]\n Signature:\n0000: 46 D0 CC DF AB 5F 6F D3 37 33 E1 64 F7 1B F7 3F F...._o.73.d...?\n0010: 98 95 06 09 F9 84 C8 3A 65 CF A7 24 BB 46 95 DF .......:e..$.F..\n0020: 8B 30 F2 BC 5C F9 CC 31 E4 36 53 43 BB 50 1B EF .0..\\..1.6SC.P..\n0030: 8C 9B DB C0 41 C9 2C 37 AD B6 1D 30 BF 6E 75 E4 ....A.,7...0.nu.\n0040: A9 05 E7 30 5A B1 30 84 6B 8E B7 7A 83 2D 33 01 ...0Z.0.k..z.-3.\n0050: A1 44 86 A0 11 30 C3 4D 5B 68 7E 0B 09 48 03 CC .D...0.M[h...H..\n0060: DF C5 97 AD 87 40 DC 2A 9A 3D ED FC 27 D3 8B 4F .....@.*.=..'..O\n0070: F0 21 02 E8 62 6B 05 63 57 BB E8 4D 33 EA 35 9E .!..bk.cW..M3.5.\n]\n***\ntrustStore is: C:\\keystores\\truststore.jks\ntrustStore type is : jks\ntrustStore provider is : \ninit truststore\nadding as trusted cert:\n Subject: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n Issuer: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n Algorithm: RSA; Serial number: 0x4fbf4261\n Valid from Fri May 25 13:57:13 IST 2012 until Sat May 25 13:57:13 IST 2013\ntrigger seeding of SecureRandom\ndone seeding SecureRandom\nAllow unsafe renegotiation: false\nAllow legacy hello messages: true\nIs initial handshake: true\nIs secure renegotiation: false\n%% No cached client session\n*** ClientHello, SSLv3\nRandomCookie: GMT: 1321485794 bytes = { 138, 193, 95, 113, 86, 252, 250, 50, 154, 121, 73, 8, 93, 116, 115, 184, 182, 142, 240, 205, 15, 250, 172, 171, 111, 5, 122, 52 }\nSession ID: {}\nCipher Suites: [SSL_RSA_WITH_NULL_MD5]\nCompression Methods: { 0 }\nExtension renegotiation_info, renegotiated_connection: \n***\nmain, WRITE: SSLv3 Handshake, length = 52\nmain, READ: SSLv3 Handshake, length = 4875\n*** ServerHello, SSLv3\nRandomCookie: GMT: 1321485794 bytes = { 250, 173, 248, 90, 241, 136, 107, 119, 99, 92, 80, 19, 223, 223, 152, 131, 216, 115, 242, 56, 198, 135, 156, 111, 210, 234, 220, 103 }\nSession ID: {240, 31, 0, 0, 80, 56, 194, 89, 112, 238, 203, 154, 79, 75, 68, 48, 106, 203, 19, 130, 88, 88, 88, 88, 226, 70, 196, 79, 13, 0, 0, 0}\nCipher Suite: SSL_RSA_WITH_NULL_MD5\nCompression Method: 0\n***\nWarning: No renegotiation indication extension in ServerHello\n%% Created: [Session-1, SSL_RSA_WITH_NULL_MD5]\n** SSL_RSA_WITH_NULL_MD5\n*** Certificate chain\nchain [0] = [\n[\n Version: V3\n Subject: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4\n Key: Sun RSA public key, 1024 bits\n modulus: 105605049659295333895264877648371480987144339115417104117025065956957634413900327625548229515098843172709660865042903412409581107015480309223474293490705595126088958625491899627683399717294708677347640098462040771799700233921554682196524988217754821345297656825451441457385676164016790486091736694366149540953\n public exponent: 65537\n Validity: [From: Fri May 25 13:57:13 IST 2012,\n To: Sat May 25 13:57:13 IST 2013]\n Issuer: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n SerialNumber: [ 4fbf4261]\n]\n Algorithm: [MD5withRSA]\n Signature:\n0000: 81 F5 2C 2A 77 63 F1 CD D8 31 E1 BE B5 9B 28 C5 ..,*wc...1....(.\n0010: 6B EA 24 BB 5C 3D EB D0 EB E3 86 2E D7 1C 0D 92 k.$.\\=..........\n0020: 36 A2 79 13 BC 74 40 C4 BF 7C F7 1B 05 8C 6B CF 6.y..t@.......k.\n0030: EB 2C C2 0D E3 40 F7 F0 95 66 B6 85 AE 84 66 C9 .,...@...f....f.\n0040: B7 C5 29 BE 71 1F 28 C0 83 1C 94 41 08 2A 44 45 ..).q.(....A.*DE\n0050: 99 FD C5 77 28 26 FC 50 A3 69 32 BD F5 8B 0C A6 ...w(&.P.i2.....\n0060: 13 21 0F BA B2 C6 A2 71 18 17 94 31 3B 7E 88 63 .!.....q...1;..c\n0070: C0 01 76 DC 60 47 BB 3F 2F 7E 2A 73 84 DA 60 79 ..v.`G.?/.*s..`y\n]\n***\nFound trusted certificate:\n[\n[\n Version: V3\n Subject: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4\n Key: Sun RSA public key, 1024 bits\n modulus: 105605049659295333895264877648371480987144339115417104117025065956957634413900327625548229515098843172709660865042903412409581107015480309223474293490705595126088958625491899627683399717294708677347640098462040771799700233921554682196524988217754821345297656825451441457385676164016790486091736694366149540953\n public exponent: 65537\n Validity: [From: Fri May 25 13:57:13 IST 2012,\n To: Sat May 25 13:57:13 IST 2013]\n Issuer: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n SerialNumber: [ 4fbf4261]\n]\n Algorithm: [MD5withRSA]\n Signature:\n0000: 81 F5 2C 2A 77 63 F1 CD D8 31 E1 BE B5 9B 28 C5 ..,*wc...1....(.\n0010: 6B EA 24 BB 5C 3D EB D0 EB E3 86 2E D7 1C 0D 92 k.$.\\=..........\n0020: 36 A2 79 13 BC 74 40 C4 BF 7C F7 1B 05 8C 6B CF 6.y..t@.......k.\n0030: EB 2C C2 0D E3 40 F7 F0 95 66 B6 85 AE 84 66 C9 .,...@...f....f.\n0040: B7 C5 29 BE 71 1F 28 C0 83 1C 94 41 08 2A 44 45 ..).q.(....A.*DE\n0050: 99 FD C5 77 28 26 FC 50 A3 69 32 BD F5 8B 0C A6 ...w(&.P.i2.....\n0060: 13 21 0F BA B2 C6 A2 71 18 17 94 31 3B 7E 88 63 .!.....q...1;..c\n0070: C0 01 76 DC 60 47 BB 3F 2F 7E 2A 73 84 DA 60 79 ..v.`G.?/.*s..`y\n]\n*** CertificateRequest\nCert Types: RSA\nCert Authorities:\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n*** ServerHelloDone\nmatching alias: selfsigned\n*** Certificate chain\nchain [0] = [\n[\n Version: V3\n Subject: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4\n\n Key: Sun RSA public key, 1024 bits\n modulus: 132473562370742919150140985227175013875110053845431438145351913928668686945002725183702560702247749924970161010103451411451345824467592557656888776558245848713650717773344294766986771753500118311618188922138349812131167438364266468003061810102502957510761089213138803410346480285664890149111581898928681089463\n public exponent: 65537\n Validity: [From: Fri May 25 13:54:00 IST 2012,\n To: Sat May 25 13:54:00 IST 2013]\n Issuer: CN=Pooja Joshi, OU=SGW, O=SUNGARD, L=PUNE, ST=MH, C=IN\n SerialNumber: [ 4fbf41a0]\n]\n Algorithm: [MD5withRSA]\n Signature:\n0000: 46 D0 CC DF AB 5F 6F D3 37 33 E1 64 F7 1B F7 3F F...._o.73.d...?\n0010: 98 95 06 09 F9 84 C8 3A 65 CF A7 24 BB 46 95 DF .......:e..$.F..\n0020: 8B 30 F2 BC 5C F9 CC 31 E4 36 53 43 BB 50 1B EF .0..\\..1.6SC.P..\n0030: 8C 9B DB C0 41 C9 2C 37 AD B6 1D 30 BF 6E 75 E4 ....A.,7...0.nu.\n0040: A9 05 E7 30 5A B1 30 84 6B 8E B7 7A 83 2D 33 01 ...0Z.0.k..z.-3.\n0050: A1 44 86 A0 11 30 C3 4D 5B 68 7E 0B 09 48 03 CC .D...0.M[h...H..\n0060: DF C5 97 AD 87 40 DC 2A 9A 3D ED FC 27 D3 8B 4F .....@.*.=..'..O\n0070: F0 21 02 E8 62 6B 05 63 57 BB E8 4D 33 EA 35 9E .!..bk.cW..M3.5.\n]\n***\n*** ClientKeyExchange, RSA PreMasterSecret, SSLv3\nmain, WRITE: SSLv3 Handshake, length = 711\nSESSION KEYGEN:\nPreMaster Secret:\n0000: 03 00 3D 04 C8 EF 08 83 A4 EF 85 1C D9 96 A0 77 ..=............w\n0010: 32 2A A5 43 14 98 11 6F DD 01 52 73 4D DF B4 5A 2*.C...o..RsM..Z\n0020: C5 2E FC 2A C0 F6 C2 9B 11 23 B2 C0 7B 59 E8 96 ...*.....#...Y..\nCONNECTION KEYGEN:\nClient Nonce:\n0000: 4F C4 46 E2 8A C1 5F 71 56 FC FA 32 9A 79 49 08 O.F..._qV..2.yI.\n0010: 5D 74 73 B8 B6 8E F0 CD 0F FA AC AB 6F 05 7A 34 ]ts.........o.z4\nServer Nonce:\n0000: 4F C4 46 E2 FA AD F8 5A F1 88 6B 77 63 5C 50 13 O.F....Z..kwc\\P.\n0010: DF DF 98 83 D8 73 F2 38 C6 87 9C 6F D2 EA DC 67 .....s.8...o...g\nMaster Secret:\n0000: C0 20 A8 BC D1 A7 06 B0 C5 07 CA A7 83 C5 35 9E . ............5.\n0010: 20 AB B6 28 8C 7E EF 14 CB 9D C1 ED C5 62 F8 A1 ..(.........b..\n0020: 6A DE 9F AF 16 5B 2F 1D 21 8F A3 2C F7 B9 3D 36 j....[/.!..,..=6\nClient MAC write Secret:\n0000: 09 E8 CE 6C D1 2D 43 86 7E 74 1C 5F 68 DA E2 AE ...l.-C..t._h...\nServer MAC write Secret:\n0000: CE 62 DA F7 2C F2 2B 4A AD 47 8F 61 BD 58 51 BD .b..,.+J.G.a.XQ.\n... no encryption keys used\n... no IV used for this cipher\n*** CertificateVerify\nmain, WRITE: SSLv3 Handshake, length = 134\nmain, WRITE: SSLv3 Change Cipher Spec, length = 1\n*** Finished\nverify_data: { 4, 127, 139, 212, 93, 181, 170, 62, 121, 196, 243, 156, 251, 103, 206, 222, 2, 10, 84, 35, 186, 251, 144, 6, 31, 97, 135, 179, 160, 127, 204, 93, 100, 140, 74, 79 }\n***\nmain, WRITE: SSLv3 Handshake, length = 56\nmain, waiting for close_notify or alert: state 1\nmain, Exception while waiting for close java.net.SocketException: Software caused connection abort: recv failed\nmain, handling exception: java.net.SocketException: Software caused connection abort: recv failed\nMQJE001: An MQException occurred: Completion Code 2, Reason 2397\nMQJE030: IOException during security flows\nMQJE001: Completion Code 2, Reason 2397\ncom.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2397\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:219)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:318)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:338)\n at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:84)\n at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)\n at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:772)\n at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:697)\n at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:657)\n at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:153)\n at com.ibm.mq.MQQueueManager.(MQQueueManager.java:451)\n at com.test.SSlTest.main(SSlTest.java:68)\nCaused by: java.net.SocketException: Software caused connection abort: recv failed\n at java.net.SocketInputStream.socketRead0(Native Method)\n at java.net.SocketInputStream.read(SocketInputStream.java:129)\n at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)\n at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)\n at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)\n at com.sun.net.ssl.internal.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1493)\n at com.sun.net.ssl.internal.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:103)\n at com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:689)\n at com.sun.net.ssl.internal.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:985)\n at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:904)\n at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:238)\n at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)\n at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)\n at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:893)\n at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)\n at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165)\n at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)\n at com.ibm.mq.SSLHelper.configureSSLSocket(SSLHelper.java:567)\n at com.ibm.mq.SSLHelper.createSSLSocket(SSLHelper.java:150)\n at com.ibm.mq.MQInternalCommunications.createSocketConnection(MQInternalCommunications.java:2264)\n at com.ibm.mq.MQv6InternalCommunications$1.run(MQv6InternalCommunications.java:157)\n at java.security.AccessController.doPrivileged(Native Method)\n at com.ibm.mq.MQv6InternalCommunications.initialize(MQv6InternalCommunications.java:154)\n at com.ibm.mq.MQv6InternalCommunications.(MQv6InternalCommunications.java:102)\n at com.ibm.mq.MQSESSIONClient.MQCONNX(MQSESSIONClient.java:1337)\n at com.ibm.mq.MQSESSIONClient.MQCONN(MQSESSIONClient.java:1246)\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:184)\n ... 10 moreKindly help me....### Assistant: Your debugging process is perfect! When setting up SSL for the first time, always test first without SSL (validates channel name spelling, listener port, etc.), then check with anonymous SSL (validates that the client can validate the QMgr's certificate) then finally check with mutually authenticated SSL.In this case the failure is in that final step. By this point we know that the QMgr can read it's KDB and that the client can read its trust store. There are very few possible issues at this point and the primary ones are that the client cannot find its private key or that the QMgr cannot validate the client's key.Since the trace shows the client is able to access its key, we know that's not the problem. In most cases then, this points to a problem on the QMgr's side. There are two problems typical in this case.The client's key is not properly loaded into the QMgr's keystore (or perhaps a prior version of the key is loaded).The QMgr does not have the current version of the KDB loaded.Since you provided the stack trace and all other aspects of key exchange appear to be good, I'm going to take a wild guess and say the cause is #2 above. If so then it is easily fixed. You can use runmqsc to enter the commandREFRESH SECURITY TYPE(SSL)which causes the QMgr to stop all SSL channels and flush the KDB from its cache. There is an equivalent command in WMQ Explorer found by right-clicking on the QMgr. Or just bounce the QMgr, which accomplishes the same thing. Either of these methods result in the QMgr reloading the KDB which gives it access to the new certificate.UPDATE:Sorry that was not the issue. Can you recreate the failure and look at the QMgr's error logs? You should see the error at the bottom of/var/mqm/qmgrs//errors/AMQERR01.LOGright after the failure.You can also dump the certificate details on the client and QMgr to verify they match and are marked as trusted in the QMgr's kdb. You already know how to do this with keytool. Depending on your version of WMQ server, you can usegsk7capicmdorgsk8capicmdor with WMQ v7.1runmqakm. First dump the QMgr's KDB using the-cert -listcommand, then dump the client's cert using the-cert -detailsand post the results as an update to your question.The commands will give you help with the needed parameters. If you want the deep details, go tohttps://t-rob.net/wmq/where you will find links to the GSKit 7 and GSKit 8 manuals about halfway down the page. Therunmqakmcommand is a wrapper over GSKit 8 so if the QMgr is running WMQ v7.1 use the GSKit 8 manual.\n"}
+{"text": "### Human: I have an application where messages keep coming at a rate of 70K XMLs per hour. We consume these XML messages and store it into an intermediate queue. The intermediate queue is created because we need to meet SLA of consuming all the messages with 24 hours. We are able to consume and load the XMLS into the internal queue within 24 hours. After loading it to internal queue, we process the XMLS (parse, apply very few transformation, perform very few validations) and store the data to a heavily normalized data model. I know that the datamodel can have a huge impact on performance, unfortunately, we have no control over the datamodel. Currently, we take 3.5 minutes to process 2K messages, which is unacceptable. We want to bring it down to 1 minute for 2K messages. Here is what we have done so far:1) Applied indexes wherever applicable.2) Use XMLBeans for parsing the XMLs (size of each XML is not very huge)3) Removed all unnecessary validations, transformatios, etc.The application runs on:Operating system: RHEL 5.4 64 bitPlatform: JDK 1.6.0_17, 64 bitDatabase: Oracle 11g R2 64 bit (2 node cluster)External MQ: IBM QueueInternal temporary storage MQ: JBoss MQApplication Server: Jboss 5.1.0.GA (EAP Version)The order in which we consume and process the XML messages is very important and so we cannot do a parallel processing.Is there anything else we can do to improve performance?### Assistant: Some suggestions outside of message delivery tuning since it appears this is not your [primary] bottleneck:You mentioned you are storing data into a highly normalized database. This invariably means one or more reference data or PK lookups which creates several additional trips to the database to fetch this data. To avoid or reduce this, create a local cache with all your reference data and update the cache as you go. In memory lookups will be significantly faster than a trip to the DB.If you feel you have insufficient RAM to cache all your decodes and reference data, shoot for a disk based cache (e.g. EHCache which will do RAM, Disk or Overflow) or a lightweight local DB like HyperSonic or H2 which will still give you better lookup times than a trip to Oracle (unless you're on the same host, and even then....)Ultimately, if each message requires many round trips to the DB, you may benefit from migrating the processing of the message to the DB itself, where you can implement the process in PL/SQL or Java.If your write to the database for one message processed involves multiple inserts/updates, make sure to use prepared statement batching. This will send multiple inserts/updates in one call to the DB.Speaking of prepared statements, make sure yourJBoss DataSource configurationfor Oracle hasprepared-statement-cache-sizeset to some number high enough to handle all your prepared statements created during processing (and not the default which is zero, or no caching).The XML parser you are using may be imposing more overhead than is necessary, even (or especially) for small messages. If you are using JAXB, make sure you're not recreating the unmarshaller more than once (or more than necessary). Alternatively, try aPull/Streaming parser. If you are using a DOM parser, the additional memory required may be causing a lot of garbage collection.Silly thing, but worth mentioning, if you are executing a lot of logging for each message, that will be costing you time, so turn it off.Using JBoss MQ as an intermediary buffer is elegant but it is probably not the fastest way to store your messages for deferred processing since the persistence is more complex and generalized for all sorts of JMS message types. On that note, if JBoss MQ is persisting to Oracle anyways, then it seems improbable that a custom persistence procedure would not be faster. If JBoss MQ is storing to HyperSonic (as it does by default), you can still probably outperform the store of the JMS message with some custom code. This will also mean that you will need a new mechanism to pull the message back out of the DB for processing, but as with the JMS store, a custom process may outperform the more generalized procedure implemented by JBoss MQ.Storing intermediary messages to the DB may also give more query flexibility to determine where messages do not have to be serially processed. (Perhaps, for example, messages originating from different clients do not need to be processed in sequence). Of course, you can also do this with JBoss MQ by placing the appropriate headers in the intermediary messages. This would allow you to parallelize by using different selectors in multiple different message listeners/processors.One quick item on messaging.....You did not mention if you were using message driven beans with WebSphere MQ, but if you are, there is a setting in theInbound ConfigurationcalledpollingIntervalwhich, to quote from the docs, means:If each message listener within a session has no suitable message on its queue, this is the maximum interval, in milliseconds, that elapses before each message listener tries again to get a message from its queue. If it frequently happens that no suitable message is available for any of the message listeners in a session, consider increasing the value of this property. This property is relevant only if TRANSPORT has the value BIND or CLIENT.The defaultpollingTimeis 5000 ms. Your current message processing time is(3.5 * 60 * 1000 / 2000)= 105 ms per message.If you introduce a 5000 ms pause here-and-there, that will seriously cut down on your throughput, so you might want to look into this by measuring the ongoing difference between the message enqueue time and the time that you receive the message in your JBoss message listener. The enqueue time can be determined from these message headers:JMS_IBM_PutDateJMS_IBM_PutTimeAll in all, your best bet is going to be to figure out how to parallelize.Good luck.//Nicholas\n"}
+{"text": "### Human: I have read the articlehttp://techtots.blogspot.com/2010/01/connecting-to-mq-using-spring-without.htmlabout configuringQueueConnectionFactoriesand have that side of things working nicely.# MQ related values\nmq.jms.qcf=QM_Epsilon\nmq.jms.request.queue=TEST.REQUEST.QUEUE\n\n# Connection details\nmq.host.url=localhost:1414/SYSTEM.DEF.SVRCONN\nmq.factoryclass=com.ibm.mq.jms.context.WMQInitialContextFactory\n\n# Authentication details\nmq.auth=simple\nmq.user=******\nmq.password=********\n \n \n \n \n ${mq.factoryclass}\n ${mq.host.url}\n ${mq.auth}\n ${mq.user}\n ${mq.password}\n \n \nUsing this configuration thequeueConnectionFactorybean is easily injected into my classes as anMQQueueConnectionFactory.But I am wanting to use the publish/subscribe model and, as I understand it, I need to get an MQTopicConnectionFactory for this. I have searched everywhere and tried numerous things but I cannot find any information on how to modify this configuration, or the MQ installation so that I get anMQTopicConnectionFactoryinstead of anMQQueueConnectionFactory.### Assistant: TheWMQInitialContextFactoryis a class that implements a JNDI provider over a WebSphere MQ queue. Instead of the managed objects being stored in a .bindings file or LDAP, they are serialized and stored in a queue and this class allows you to treat that queue as just another JNDI store. This class was only ever intended to be a JNDI provider and not a replacement for the actual IBM JMS implementation. Since storing managed objects on a topic would not work, these classes have no topic factories in them. This is as expected.In my opinion, the problem withWMQInitialContextFactoryis that it must first connect to WebSphere MQ in order to to obtain a connection factory which then tells the app - you guessed it - how to connect to WebSphere MQ. This makes the article that was linked confusing because it appears that all that configuration, the WMQ connection details and so forth, are for the benefit of the application when in fact they just bootstrap a JNDI provider which is expected to have defined connection factory objects with all this same information.What is missing from the article is that the author would have had to use IBM's JMSAdmin tool to connect to the MQInitialContext and define the ConnectionFactory and other administered objects before connecting the application to that same Initial Context in order to access them.For the record, the WebSphere MQ JMS classes have supported JMS 1.1 ConnectionFactory and Destination classes for quite some time now. Prior to that they supported both queues and topics as per the JMS 1.0 spec.You can download the IBM WMQ JMS implementation asSupportPac MQC7. There is a lot more there than just the jar files. For example, you get lots of sample code, diagnostic and trace utilities, documentation, etc. You also get the correct jar files.If you want to use a .bindings file (File-system initial context) instead of theWMQInitialContextFactory, download the latest WebSphere MQ Explorer tool asSupportPac MS0T. You can create a directory, point WMQ Explorer to it and define all your connection factories and destinations. (Or go with domain-specific QueueConnectionFactory and TopicConnectionFactory if you rock it old school.) More information on using WMQ Explorer to define your managed objects may be found at:Creating and configuring JMS administered objectsIf you want a tutorial that includes a demonstration of how to use IBM's JMSAdmin tool to create the .bindings file, look atRunning a standalone Java application on WebSphere MQ V6.0. (The JMSAdmin tool is installed with the WMQ Server and I believe it also comes with the free MS0T WMQ Client install linked above.) The documentation for the JMSAdmin tool is here:Using the WebSphere MQ JMS administration toolWhichever method you choose to create managed objects, you can look up all the possible properties supported in IBM's implementation at:Properties of WebSphere MQ classes for JMS objects\n"}
+{"text": "### Human: I have been asked this a lot lately so I thought I'd post the question and answer here.What is the difference between an FTE exit and an FTE call? What are they for and when do I use them?### Assistant: BackgroundWebSphere MQ File Transfer Edition (WMQ FTE) is a Java application built on WebSphere MQ and which provides an enterprise file transfer platform. The transfer occurs between two agents, one at the source and one at the destination. In the lifecycle of the transfer there are four points at which external code can be called - before the transfer starts at both the source and the destination agents, and after the transfer completes at the source and destination agents. The two methods by which external code may be called are exits and calls.ExitsExits are implemented as Java classes and are called from the agent code. The scope of these is per-agent and once enabled, the exit is called for every transfer. This makes them appropriate for enforcing global policies or providing a ubiquitous service such as virus scanning.CallsCalls are implemented as (mostly) separate tasks in the transfer lifecycle and may be either an Ant script or a command-line executable. These are defined within the transfer job definition and the post-transfer calls will not fire if the transfer fails. This makes them suitable for providing functionality that is specific to a transfer or that depends on the outcome of the transfer. For example, a post-transfer destination call is a good place to perform decryption because this is something you would usually define for specific transfers and the decrypt step will not fire if the transfer fails.Order of exits and callsExits and calls both fire before the transfer starts and after the transfer completes, at both the source and target agents. But the documentation does not yet show the relationship between calls and exits. By creating a set of calls and exits which update the same log file, it is possible to demonstrate the firing order.Below is the timeline of exit points and calls during a file transfer. The names of the exits are as per the Java interface definition. The names of the calls are as per the XML schema for transfer definitions.Successful transferSun Feb 6 20:20:21 EST 2011: onSourceTransferStart Exit firedSun Feb 6 20:20:21 EST 2011: PreSourceCall firedSun Feb 6 20:20:21 EST 2011: onDestinationTransferStart Exit firedSun Feb 6 20:20:21 EST 2011: PreDestinationCall firedSun Feb 6 20:20:22 EST 2011: onDestinationTransferEnd Exit firedSun Feb 6 20:20:22 EST 2011: PostDestinationCall firedSun Feb 6 20:20:22 EST 2011: onSourceTransferEnd Exit firedSun Feb 6 20:20:22 EST 2011: PostSourceCall firedFailed transferSun Feb 6 20:28:49 EST 2011: onSourceTransferStart Exit firedSun Feb 6 20:28:50 EST 2011: PreSourceCall firedSun Feb 6 20:28:50 EST 2011: onDestinationTransferStart Exit firedSun Feb 6 20:28:50 EST 2011: PreDestinationCall firedSun Feb 6 20:28:50 EST 2011: onDestinationTransferEnd Exit firedSun Feb 6 20:28:50 EST 2011: onSourceTransferEnd Exit firedAdditional resourcesFor more information on programming WMQ FTE calls and exits, see theWMQ FTE Infocenter.\n"}
+{"text": "### Human: is there a limit on how many queues I can have open within a single connection and single session? I can currently open up 128 queues and send messages to them. If I try to open up 129 I get the following error...ThanksError:com.ibm.msg.client.jms.DetailedResourceAllocationException: JMSWMQ2008: Failed to open MQ queue 'TestQueue_129'. JMS attempted to perform an MQOPEN, but WebSphere MQ reported an error. Use the linked exception to determine the cause of this error. Check that the specified queue and queue manager are defined correctly.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:579)\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:219)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1000)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:956)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:59)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.initialise(WMQMessageProducer.java:727)\n at com.ibm.msg.client.wmq.internal.WMQMessageProducer.(WMQMessageProducer.java:931)\n at com.ibm.msg.client.wmq.internal.WMQSession.createProducer(WMQSession.java:783)\n at com.ibm.msg.client.jms.internal.JmsSessionImpl.createProducer(JmsSessionImpl.java:1122)\n at com.ibm.msg.client.jms.internal.JmsQueueSessionImpl.createSender(JmsQueueSessionImpl.java:131)\n at com.ibm.mq.jms.MQQueueSession.createSender(MQQueueSession.java:147)\n at com.ibm.mq.jms.MQQueueSession.createProducer(MQQueueSession.java:248)\n at MyQueue.(MyQueue.java:25)\n at Main.main(Main.java:54)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:599)\n at com.ibm.ws.client.applicationclient.launchClient.createContainerAndLaunchApp(launchClient.java:788)\n at com.ibm.ws.client.applicationclient.launchClient.main(launchClient.java:493)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:599)\n at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)\n at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)\n at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)\n at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)\n at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)\n at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)\n at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)\n at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:599)\n at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)\n at org.eclipse.core.launcher.Main.basicRun(Main.java:282)\n at org.eclipse.core.launcher.Main.run(Main.java:981)\n at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:330)\n at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:108)\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2017' ('MQRC_HANDLE_NOT_AVAILABLE').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:206)\n ... 39 more\nWSCL0100E: Exception received: java.lang.reflect.InvocationTargetException\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:599)\n at com.ibm.ws.client.applicationclient.launchClient.createContainerAndLaunchApp(launchClient.java:788)\n at com.ibm.ws.client.applicationclient.launchClient.main(launchClient.java:493)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:599)\n at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)\n at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)\n at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)\n at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)\n at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)\n at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)\n at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)\n at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:599)\n at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)\n at org.eclipse.core.launcher.Main.basicRun(Main.java:282)\n at org.eclipse.core.launcher.Main.run(Main.java:981)\n at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:330)\n at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:108)\nCaused by: java.lang.NullPointerException\n at MyQueue.sendMessage(MyQueue.java:39)\n at Main.main(Main.java:55)\n ... 27 more### Assistant: This is controlled by the queue manager'sMAXHANDSattribute.The default is 256. Depending on how you access the queues, the classes may be opening each one twice, resulting in 128 max open queues.You can display the queue handles in runmqsc with theDIS QSTATUScommand.\n"}
+{"text": "### Human: in my Java application I getMQQueueobject usingMQQueue tQueue = qManager.accessQueue(tqName, tqOptions);The queue is a remote queue. Is there way to get corresponding local transmission queue ?(UsingMQ 7.5)Thanks### Assistant: Yes, usingrunmqscconsole.First on a command prompt runrunmqsc .Once the console opens rundis qr XMITQto display the transmit queue used by the remote queue definition.UPDATEAnother method is to use PCF classes.PCFMessageAgent pcfma = new PCFMessageAgent(\"QM\");\n PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_Q);\n pcfCmd.addParameter(MQConstants.MQCA_Q_NAME, \"Q.REMOTE\");\n PCFMessage[] pcfResponse = pcfma.send(pcfCmd);\n String xmitQName = (String) pcfResponse[0].getParameterValue(MQConstants.MQCA_XMIT_Q_NAME);\n System.out.println(\"XmitQ name \" + xmitQName);\n"}
+{"text": "### Human: I'm using XMS (i.e IBM Message Services Client for .NET) to connect to IBM MQ and get the messages.With that said, I wanted to know how to get count of messages on a Queue at any given point of time.(Explored on IQueueBrowser.GetEnumerator, but it will download the messages onto client.)### Assistant: XMS .NET is an implementation of JMS specification and JMS specific does not define a method or a property that retrieves count of messages in a queue. Hence XMS does not provide a way to do that.Anything to do with queue attributes is a provider specific administrative job, so you have to use message provider specific APIs.But why do you want to know the count of messages? Application should be coded to receive messages continuously. Your application can choose to quit receiving messages when there are no more messages in the queue or wait for further messages. If there are no messages, the receive call will return with null message object. Your application can check for this and decide to make further receive calls or quit.HTH\n"}
+{"text": "### Human: I am trying to get the number of consumers of a particular Websphere MQ queue from Java? I need to know whether someone is going to consume the messages before placing them on the queue.### Assistant: First, it is worth noting that the design proposed is a very, VERY bad design. The effect is to turn async messaging back into synchronous messaging. This couples message producers to consumers, introduces location and resolution dependencies, breaks clustering, defeats WMQ's load distribution and balancing, embeds network topology into the application, and makes the whole system brittle. Please do not blame WMQ for not working correctly after intentionally defeating all its best features except the actual queue/dequeue operations.However, to answer your question more directly, use thegetOpenInputCountmethod of the queue object to obtain the number of open input handles. Here's how:MQQueue outQ = qMgr.accessQueue(qName,\n openOptions,\n null, // default q manager\n null, // no dynamic q name\n null); // no alternate user id\n\nint inCount = outQ.getOpenInputCount();Note that you can only inquire the input handles on a local queue. If the queue is hosted on a QMgrotherthan the one where the message sender is connected, this method will not work. Of course it is the normal case that the message sender and receiver would reside on different QMgrs. However since you do not mention much about the design, I'll assume for purposes of this answer that connections from the message producer and consumer attach to the same QMgr. If that's not the case, we need to have a discussion about PCF and even stronger warnings about the design.\n"}
+{"text": "### Human: We are reading messages from Websphere MQ using JMS and Spring Integration.\n\n\n \n \n \n \n\n\nThere is another system, which put message on this Queue. (Out of scope for us)We can have 2000 messages at a time on queue to be read.Sometimes, Message Listener stops reading messages from Queue, when I tried to troubleshoot this issue, it gives reason that there are some un-commited message on queue, which listener trying to read and won't be able to process further and hangs there itself.As when delete that message manually from queue, it processes other message perfectly.So how to skip such uncommitted messages, so that system can continue with next message ?### Assistant: Sounds like a classic unhandled poison message problem. When the app reads a message that it cannot process, the message is backed out to the queue. It is then read back in again since it is at the top of the queue. This results in the message appearing to be under syncpoint until finally the listener gives up and stops.Sometimes the problem is in the app and it is the app explicitly callingROLLBACK. Sometimes though the rollback happens befor the app even sees the message. For example, if the message cannot be converted to the local code page, or other low-level error.If this is what is happening, the answer is to define a backout queue and then alter the input queue to point at it. For example, if the input queue is calledSRC.RECEIVER.QUEUEyou might do something like this on the QMgr usingrunmqsc:DEFINE QL(SRC.RECEIVER.QUEUE.BKOUT)\nALTER QL(SRC.RECEIVER.QUEUE) BOQNAME(SRC.RECEIVER.QUEUE.BKOUT) BOTHRESH(15)If the problem really is a poison message, the problem message will show up in the backout queue as an uncommitted message. As soon as the app issues the nextCOMMITagainst the source queue, the backout message will become visible in the backout queue. If no other message arrives on the source queue, the poison message will either remain uncommitted in the backout queue or possibly revert to the source queue ifROLLBACKis called by the app or QMgr.The setup of the backout queue is simple to do and should be standard practice so I'd recommend doing it whether or not it resolves the problem. Please seeHandling poison messages in WebSphere MQ classes for JMSin the Infocenter.\n"}
+{"text": "### Human: I'm trying to write a small application which connects to a Queue Manager and issues some commands on it, in Java.From what I have read in the documentation, I understand that one must issue commands by sending them in the \"SYSTEM.ADMIN.COMMAND.QUEUE\" queue.However, the reply queue defined byreplyToQueueNameis still empty after execution.Is there something I missed ?Here is a stripped-down version of the code :MQQueueManager qMgr = new MQQueueManager(\"SOME_HOSTNAME\");\n\nMQQueue qOut = qMgr.accessQueue(\"SYSTEM.ADMIN.COMMAND.QUEUE\", MQC.MQOO_OUTPUT);\nMQQueue qIn = qMgr.accessQueue(\"SYSTEM.DEFAULT.LOCAL.QUEUE\", MQC.MQOO_INPUT_AS_Q_DEF);\n\nMQMessage message = new MQMessage();\nmessage.writeUTF(\"DISPLAY QMGR ALL\");\nmessage.messageType = MQC.MQMT_REQUEST;\nmessage.format = MQC.MQFMT_STRING;\nmessage.replyToQueueName = \"SYSTEM.DEFAULT.LOCAL.QUEUE\";\n\nqOut.put(message, new MQPutMessageOptions());\n\nMQMessage retrievedMessage = new MQMessage();\nMQGetMessageOptions gmo = new MQGetMessageOptions();\ngmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_CONVERT;\n\nqIn.get(retrievedMessage, gmo);### Assistant: The Command Processor expects to receive messages in Programmable Command Format (PCF) format. Please see thecom.ibm.mq.pcfclasses and theProgrammable Command Formats and Administration Interfacemanual.Depending on the version of MQ client you are using, you may need to download the PCF Java classes fromSupportPac MS0B. However, it is strongly encouraged to develop using the latest MQ client. The current client will always work with earlier WMQ server versions V7 and fall back to the level of functionality available on those platforms. This ensures that at least your client classes are supported, whereas an older version such as V5.3 or V6 are not.The V7.0 MQ client is available asSupportPac MQC7.The V7.5 MQ client is available asSupportPac MQC75.The V8.0 MQ client is available asSupportPac MQC80.\n"}
+{"text": "### Human: I'm connecting to an IBM Websphere MQ. I want to be able to match the reply message with the correct request message. I've trawled through hundreds of pages to get this and have had no luck.I have a class - MQHandler - which sends a message to one defined queue, and reads the request from another. This works fine, however, if multiple users are using the application at the same time, messages get mixed up.I can't seem to get a method on the receiver to indicate the CorrelationID to match.\nSomething like...consumer.receive( selector );Can you check the below methods to ensure I'm doing this correctly?/**\n * When the class is called, this initialisation is done first.\n * \n * @throws JMSException\n */\npublic void init() throws JMSException\n{\n // Create a connection factory\n JmsFactoryFactory ff;\n try\n {\n ff = JmsFactoryFactory.getInstance( WMQConstants.WMQ_PROVIDER );\n cf = ff.createConnectionFactory();\n\n // Set the properties\n cf.setStringProperty( WMQConstants.WMQ_HOST_NAME, hostServer );\n cf.setIntProperty( WMQConstants.WMQ_PORT, 1414 );\n cf.setStringProperty( WMQConstants.WMQ_CHANNEL, channel );\n cf.setIntProperty( WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT );\n cf.setStringProperty( WMQConstants.WMQ_QUEUE_MANAGER, qManager );\n\n connection = cf.createConnection();\n\n session = connection.createSession( false, Session.AUTO_ACKNOWLEDGE );\n }\n catch( JMSException e )\n {\n throw e;\n }\n\n} // end of init\n\n\n\n/**\n * @param request\n * @return\n * @throws JMSException\n */\nprivate String sendRequest( String request ) throws JMSException\n{\n\n // Create JMS objects\n Destination destination = session.createQueue( \"queue:///\" + writeQueueName );\n\n // Enable write of MQMD fields. See documentation for further\n // details.\n ((JmsDestination) destination).setBooleanProperty( WMQConstants.WMQ_MQMD_WRITE_ENABLED, true );\n\n // Set message context, if needed. See comment at the top.\n\n // Create a producer\n MessageProducer producer = session.createProducer( destination );\n\n // Create a message\n TextMessage message = session.createTextMessage( request );\n\n // Generate a custom message id\n message.setJMSCorrelationID( generateRandomID() );\n\n // Start the connection\n connection.start();\n\n // And, send the message\n producer.send( message );\n System.out.println(message);\n\n return message.getJMSCorrelationID();\n}\n\n\n/**\n * @param customMessageId\n * @return\n * @throws JMSException\n */\nprivate String recvResponse( String customMessageId ) throws JMSException\n{\n Destination destination = session.createQueue( \"queue:///\" + readQueueName );\n\n // Enable read of MQMD fields.\n ((JmsDestination) destination).setBooleanProperty( WMQConstants.WMQ_MQMD_READ_ENABLED, true );\n ((JmsDestination) destination).setObjectProperty( WMQConstants.JMS_IBM_MQMD_CORRELID, customMessageId );\n\n // Create a consumer\n MessageConsumer consumer = session.createConsumer( destination );\n\n // Start the connection\n connection.start();\n\n // And, receive a message from the queue\n TextMessage receivedMessage = (TextMessage)consumer.receive( 15000 );\n\n connection.close();\n session.close();\n\n return receivedMessage.getText();\n}Here is a snippet of the main method...try\n {\n String customMessageId;\n init();\n customMessageId = sendRequest( request );\n return recvResponse( customMessageId );\n }\n catch( Exception ex )\n {\n System.out.println( \"Error on MQ.\" );\n throw new Exception( \"\\n\\n*** An error occurred ***\\n\\n\" + ex.getLocalizedMessage()\n + \"\\n\\n**********************************\" );\n }### Assistant: QueueReceiver queueReceiver = \n session.createReceiver(destination, \"JMSCorrelationID='customMessageId'\");\n\nTextMessage receivedMessage = (TextMessage)queueReceiver.receive( 15000 );In my example, customMessageId should contain the actual value you have previously set.Also, I have seen many cases where people generate a correlationID and set it in the outbound message expecting to be able to select the response based on that value. The textbook way to do this is for the service provider app to copy the message ID to the correlation ID when responding. The requestor would still specify the JMSCorrelationID as the selector but would use the original JMSMessageID as the value. Since the JMSMessageID is guaranteed to be unique even across QMgrs, you are MUCH less likely to get collisions on this value. You will need to insure that your client matches the behavior of the service provider with respect to which value gets copied into the correlation ID.\n"}
+{"text": "### Human: I have a .NET application that needs to monitor a queue in WebSphere MQ. I need to react to each message without impacting the current process. The client application can't explicity send me the same message.Can I read a message without removing it from the queue? Can I be notified for each message? Can I configure the MQ to duplicate the current queue?Is there another solution?### Assistant: If you are using WMQ v7 then you can do this without any impact to the existing applications other than to change the queue name for one of them.Currently the message producer and consumer use the same queue. In v7 of WMQ you can create an alias over a topic so that the message producer thinks it's a queue. Then you can create two administrative, durable subscriptions such that one points to the existing input queue and another points to a queue dedicated to your new application.Of course you are already using v7 since v6 goes out of service next year, right? You can upgrade the QMgr to v7 which enables this behavior while still using v6 client code for the apps.If you are using WMQ v6 then theMirrorQ programmight work for you.\n"}
+{"text": "### Human: I'm forwarding my IBM MQ v9.1 error logs using splunk forwarder to a centralized cluster to see trends on common error occurring across my distributed messaging systems.However I'm unable to parse the required fields, since the format of MQ error logs are varying i.e. the severity of the messages could be error, warning, informational, severe and termination and each have different set of fields in itself and are not consistent.Please let me know if anyone have used regex in splunk for parsing the fields of IBM MQ error logs for v9.1.I have tried few regex patterns but it wasn't parsing as expected.I have already referred below link, but that is for v8 and there is a different in format of error logs for v9,https://t-rob.net/2017/12/18/parsing-mq-error-logs-in-splunk/Also the splunk user is unable to access the error logs. I have updated below stanza in qm.ini \nFilesystem: \n ValidateAuth=Noalso set chmod -R 755 to /var/mqm/qmgrs/qmName/errors folder.Though the permissions for the ERROR logs doesn't change whenever it gets updated, when the logs rotate the permissions are revoked and splunk user is not able to read the logs.Please let me know how to overcome this without adding splunk user to mqm group### Assistant: I would suggest enabling JSON logging and forward those logs to Splunk which should be able to parse this format.In IBM MQ v9.0.4 CDS release IBM added the ability to log out to a JSON formatted log, MQ will always log to the original AMQERR0x.LOG files even if you enable the JSON logging. This is included in all MQ 9.1 LTS and CSD releases.The IBM MQ v9.1 Knowledge Center PageIBM MQ>Configuring>Changing IBM MQ and queue manager configuration information>Attributes for changing queue manager configuration information>Diagnostic message logging>Diagnostic message service stanzas>Diagnostic message serviceshas information on the topic. You can add the following to yourqm.inito have it output the log information to a JSON formatted file calledAMQERR0x.jsonin the standard queue managererrorsdirectory:DiagnosticMessages:\n Service = File\n Name = JSONLogs\n Format = json\n FilePrefix = AMQERRAs noted by the OP the JSON formatted logs do not contain theEXPLANATIONorACTIONportion that you see in the normal logs.In IBM MQ v9.1 you can use themqrccommand to convert the JSON format to the familiar format you see inAMQERR01.LOG.One simple example is below:cat <' for channel '' closed.\n\nEXPLANATION:\nAn error occurred receiving data from '' over . The\nconnection to the remote host has unexpectedly terminated.\n\nThe channel name is ''; in some cases it cannot be determined and\nso is shown as '????'.\n\nACTION:\nTell the systems administrator.You could take it further and specify the inserts from the JSON:Exmple portion of the JSON log:\"ibm_messageId\":\"AMQ9209E\",\"ibm_arithInsert1\":0,\"ibm_arithInsert2\":0,\"ibm_commentInsert1\":\"localhost (127.0.0.1)\",\"ibm_commentInsert2\":\"TCP/IP\",\"ibm_commentInsert3\":\"SYSTEM.DEF.SVRCONN\"In the command below eachibm_arthInsertis specified with a proceeding-nflag in order following by eachibm_commentInsertwith a proceeding-cflag:mqrc AMQ9209E -n 0 -n 0 -c \"localhost (127.0.0.1)\" -c \"TCP/IP\" -c \"SYSTEM.DEF.SVRCONN\"The output is below:536908297 0x20009209 rrcE_CONNECTION_CLOSED\n 536908297 0x20009209 urcMS_CONN_CLOSED\n\nMESSAGE:\nConnection to host 'localhost (127.0.0.1)' for channel 'SYSTEM.DEF.SVRCONN'\nclosed.\n\nEXPLANATION:\nAn error occurred receiving data from 'localhost (127.0.0.1)' over TCP/IP. The\nconnection to the remote host has unexpectedly terminated.\n\nThe channel name is 'SYSTEM.DEF.SVRCONN'; in some cases it cannot be determined\nand so is shown as '????'.\n\nACTION:\nTell the systems administrator.\n"}
+{"text": "### Human: I am trying to install pymqi on windows 64-bit machine.\"pip install pymqi\" gives an errorCollecting pymqi\n Using cached https://files.pythonhosted.org/packages/15/d9/b5babbd3f296b47a9d8bca417ca185ede9e8780ce4ca6b66bbf2dd1b7880/pymqi-1.9.2.tar.gz\nInstalling collected packages: pymqi\n Running setup.py install for pymqi ... error\n Complete output from command C:\\Users\\xxxxxxxxx\\.virtualenvs\\BBG_IBM_MQ_connection\\Scripts\\python.exe -u -c \"import setuptools, tokenize;__file__='C:\\\\Users\\\\xxxxxxxxx\\\\AppData\\\\Local\\\\\nTemp\\\\pip-install-1qy7i0yt\\\\pymqi\\\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))\" install --recor\nd C:\\Users\\xxxxxxxxx\\AppData\\Local\\Temp\\pip-record-hhuxyqkh\\install-record.txt --single-version-externally-managed --compile --install-headers C:\\Users\\xxxxxxxxx\\.virtualenvs\\BBG_IBM_MQ_con\nnection\\include\\site\\python3.7\\pymqi:\n Building PyMQI client 64bits\n running install\n running build\n running build_py\n creating build\n creating build\\lib.win-amd64-3.7\n creating build\\lib.win-amd64-3.7\\pymqi\n copying pymqi\\__init__.py -> build\\lib.win-amd64-3.7\\pymqi\n copying pymqi\\CMQC.py -> build\\lib.win-amd64-3.7\\pymqi\n copying pymqi\\CMQCFC.py -> build\\lib.win-amd64-3.7\\pymqi\n copying pymqi\\CMQXC.py -> build\\lib.win-amd64-3.7\\pymqi\n copying pymqi\\CMQZC.py -> build\\lib.win-amd64-3.7\\pymqi\n running build_ext\n building 'pymqi.pymqe' extension\n creating build\\temp.win-amd64-3.7\n creating build\\temp.win-amd64-3.7\\Release\n creating build\\temp.win-amd64-3.7\\Release\\pymqi\n C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX86\\x64\\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYQMI_SERVERBUILD=0 \"-Ic:\\Program Fi\nles (x86)\\IBM\\WebSphere MQ\\tools\\c\\include\" -IC:\\Users\\xxxxxxxxx\\.virtualenvs\\BBG_IBM_MQ_connection\\include -IC:\\Users\\xxxxxxxxx\\AppData\\Local\\Programs\\Python\\Python37\\include -IC:\\Users\\\nxxxxxxxxx\\AppData\\Local\\Programs\\Python\\Python37\\include \"-IC:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.21.27702\\include\" /Tcpymqi/pymqe.c /Fobuild\\temp.\nwin-amd64-3.7\\Release\\pymqi/pymqe.obj\n pymqe.c\n pymqi/pymqe.c(78): fatal error C1083: Cannot open include file: 'cmqc.h': No such file or directory\n error: command 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community\\\\VC\\\\Tools\\\\MSVC\\\\14.21.27702\\\\bin\\\\HostX86\\\\x64\\\\cl.exe' failed with exit status 2\n\n ----------------------------------------\nCommand \"C:\\Users\\xxxxxxxxx\\.virtualenvs\\BBG_IBM_MQ_connection\\Scripts\\python.exe -u -c \"import setuptools, tokenize;__file__='C:\\\\Users\\\\xxxxxxxxx\\\\AppData\\\\Local\\\\Temp\\\\pip-install-1qy7i0\nyt\\\\pymqi\\\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))\" install --record C:\\Users\\xxxxxxxxx\\AppD\nata\\Local\\Temp\\pip-record-hhuxyqkh\\install-record.txt --single-version-externally-managed --compile --install-headers C:\\Users\\xxxxxxxxx\\.virtualenvs\\BBG_IBM_MQ_connection\\include\\site\\pyt\nhon3.7\\pymqi\" failed with error code 1 in C:\\Users\\xxxxxxxxx\\AppData\\Local\\Temp\\pip-install-1qy7i0yt\\pymqi\\I tried to install \"python-dev\" as I read for pymqi installation, python-dev is necessary. But it is also giving an error and after searching for that error, got to know from this forum that \"python-dev\" doesn't exist for windows.Can I get help on this?### Assistant: Download MQ client libraries from this link:https://ibm.biz/IBM-MQC-Redist-Win64zipOnce downloaded and extracted, you will find thecmqc.hfile in this location:9.3.0.0-IBM-MQC-Redist-Win64\\tools\\c\\includeCreate a new folder on yourC:drive:C:\\Program Files (x86)\\IBM\\WebSphere MQCopy the tools subfolder9.3.0.0-IBM-MQC-Redist-Win64\\tools\\c\\includetoC:\\Program Files (x86)\\IBM\\WebSphere MQNow run:pip install pymqiThe output should be similar to this:C:\\Windows\\system32>pip install pymqi\nCollecting pymqi\n Using cached pymqi-1.12.8.tar.gz (88 kB)\n Preparing metadata (setup.py) ... done\nUsing legacy 'setup.py install' for pymqi, since package 'wheel' is not installed.\nInstalling collected packages: pymqi\n Running setup.py install for pymqi ... done\nSuccessfully installed pymqi-1.12.8For me it worked. Please give it a try and let me know if it worked for you.\n"}
+{"text": "### Human: I have problem connecting to IBM MQ8.0 from Java client when SSL enabled at client channel(SVRCONN). When SSL is disabled(SSLAUTH to OPTIONAL) at channel, the flow is working fine.Client is java with JRE1.7. MQ server version is IBM MQ8.0Created self-signed certificates and exchanged properly as per MQ setup references.javax.net.debug=ssl option cofirms in the log that certificate exchange and SSL handshake is successful.But when java client code is trying to get MQManager object, following MQ Exception thrown.com.ibm.mq.MQException: MQJE001: Completion code '2', reason '2059' ...\n\ncaused by: com.ibm.jmqi.JmqiException: CC=2;RC=2059;AMQ9204: Connection to host '1.2.3.4(1414)' rejected. [1=com.ibm.jmqi.JmqiException[CC=2;RC=2059;AMQ9503: Channel negotiation failed. [3=CHANNEL.SVRCONN.SSL]],3=1.2.3.4(1414), 5=RemoteConnection.analyseSegment] ...\n\ncaused by: com.ibm.jmqi.JmqiException: CC=2;RC=2059;AMQ9503: Channel negotiation failed. [3=CHANNEL.SVRCONN.SSL]I have configured to use TLS_RSA_WITH_AES_256_CBC_SHA256 as cipherspec in both client side and MQ client channel(SVRCONN).Tried with other cipherspecs like TLS_RSA_WITH_AES_128_CBC_SHA, error remains same.MQ server error log has AMQ9665: SSL connection closed by remote end of channel '????' \n\nExplanation: The SSL or TLS connection was closed by the remote host '5.6.7.8' during the secure socket handshake. The channel is '????', in some cases its name can not be determined and so is shown as '????'. The chanel didn't start. \n\nACTION: Check the remote end of for SSL and TLS errors. Fix them and restart the channel.But remote side, I have only java client which is uses MQ libraries to connect to MQ server.SSLLog Page-4SSLLog Page-5Not able to get data from server, so added image of last 2 pages from SSL logs.MQ server side logs are already given above. Along with there is a default log AMQ9999: Channel '????' to host 1.2.3.4 ended abnormally. \nThe same error is getting logged repeatedly with . Didn't find any other logs.MQ client code snippet below.void connect2MQ()\n{\n MQEnvironment.hostname=1.2.3.4\n MQEnvironment.port=1414\n MQEnvironment.channel=CLIENT.SVRCONN.SSL\n if(SSLEnabled.equals(\"Y\") // It is set to 'Y' in main method\n {\n MQEnvironment.sslCipherSuit=\"TLS_RSA_WITH_AES_128_CBC_SHA\";\n System.setProperty(\"javax.net.ssl.truststore\",\"trustStoreCertFilePath\");\n System.setProperty(\"javax.net.ssl.keyStore\",\"keyStoreCertFilePath\");\n System.setProperty(\"javax.net.ssl.trustStorePassword\",\"Pass\");\n System.setProperty(\"javax.net.ssl.keyStorePassword\",\"Pass\");\n System.setProperty(\"javax.net.ssl.trustStoreType\",\"JKS\");\n System.setProperty(\"javax.net.ssl.keyStoreType\",\"JKS\");\n }\n\n try {\n MQQueueManager qmgr = new MQQueueManager(\"QMGR.TEST.SSL\"); // Exception is thrown from here\n ...\n }### Assistant: It appears you are hitting the issue described in APARIT10837. This is fixed in the 8.0.0.5 and later MQ Classes for Java and MQ Classes for JMS client jar files, I would suggest moving to 8.0.0.7 which is the latest v8 version.The error messages don't match but the symptoms of it working withSSLCAUTH(OPTIONAL)and not working withSSLCAUTH(REQUIRED)matches up as does the version you are running not having the fix.There is a IBM developerWorks MQdev Blog by Tom Leend titled \"MQ Java, TLS Ciphers, Non-IBM JREs & APARs IT06775, IV66840, IT09423, IT10837 -- HELP ME PLEASE!which describes a work around if you are not at a level of MQ that has the fix.---- Code Snippet Start ----\nKeyStore keyStore = KeyStore.getInstance(\"JKS\");\njava.io.FileInputStream keyStoreInputStream = new java.io.FileInputStream(\"/home/tom/myKeyStore.jks\");\nkeyStore.load (keyStoreInputStream, password_char_array);\n\nKeyStore trustStore trustStore = KeyStore.getInstance (\"JKS\");\njava.io.FileInputStream trustStoreInputStream = new java.io.FileInputStream(\"/home/tom/myTrustStore.jks\");\ntrustStore.load (trustStoreInputStream, password_char_array);\n\nkeyStoreInputStream.close();\ntrustStoreInputStream.close();\n\nKeyManagerFactory keyManagerFactory = \n KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());\nTrustManagerFactory trustManagerFactory = \n TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());\nkeyManagerFactory.init(keyStore,password);\ntrustManagerFactory.init(trustStore);\n\nSSLContext sslContext = SSLContext.getInstance(\"TLSv1\"); \nsslContext.init(keyManagerFactory.getKeyManagers(), \n trustManagerFactory.getTrustManagers(), \n null);\nSSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); \n\n// classes for JMS\n//myJmsConnectionFactory.setObjectProperty(\n// WMQConstants.WMQ_SSL_SOCKET_FACTORY, sslSocketFactory);\n\n// classes for Java\nMQEnvironment.sslSocketFactory = sslSocketFactory;\n---- Code Snippet End ----\n"}
+{"text": "### Human: Received signed certificate, installed in windows user cert. store with the public key from MQ, but getting MQRC_Q_MGR_NOT_AVAILABLE error? \n What's missing?EDITOne more question - where certificates should be placed to be available using### Assistant: Looking at the comments and question i see you mentionReceived signed certificate, installed in windows user cert store with the public key from MQandwhen SSL is optional on the server it all magically worksFrom this i believe you are trying to connect a client into your Queue Manager where the client application has it's own certificate. Because you have not specified a certificate for the client to use i don't believe the client is connecting with the (signed) certificate you added to the windows certificate store. This is why it works when the SSL is set to optional but does not work when the SSL is set to required. (Assuming you are talking about the SSLCAUTH attribute on the channel)Fromthis knowledge center pagei believe you need to add the following:replacingcertificatelabelwith the label of the certificate you want the client to use.\n"}
+{"text": "### Human: I am fairly new to Spring and Spring Batch, so feel free to ask any clarifying questions if you have any.I am seeing an issue with Spring Batch that I cannot recreate in our test or local environments. We have a daily job that connects to Websphere MQ via JMS and retrieves a set of records. This job uses the out-of-the-box JMS ItemReader. We implement our own ItemProcessor, but it doesn't do anything special other than logging. There are no filters or processing that should affect incoming records.The problem is that out of the 10,000+ daily records on MQ, only about 700 or so (the exact number is different each time) usually get logged in the ItemProcessor. All records are successfully pulled off the queue. The number of records logged is different each time and seems to have no pattern. By comparing the log files against the list of records in MQ, we can see that a seemingly random subset of records are being \"processed\" by our job. The first record might get picked up, then 50 are skipped, then 5 in a row, etc. And the pattern is different each time the job runs. No exceptions are logged either.When running the same app in localhost and test using the same data set, all 10,000+ records are successfully retrieved and logged by the ItemProcessor. The job runs between 20 and 40 seconds in Production (also not constant), but in test and local it takes several minutes to complete (which obviously makes sense since it is handling so many more records).So this is one of those tough issue to troubleshoot since we cannot recreate it. One idea is to implement our own ItemReader and add additional logging so that we can see if records are getting lost before the reader or after the reader - all we know now is that only a subset of records are being handled by the ItemProcessor. But even that will not solve our problem, and it will be somewhat timely to implement considering it is not even a solution.Has anyone else seen an issue like this? Any possible ideas or troubleshooting suggestions would be greatly appreciated. Here are some of the jar version numbers we are using for reference.Spring - 3.0.5.RELEASESpring Integration - 2.0.3.RELEASESpring Batch - 2.1.7.RELEASEActive MQ - 5.4.2Websphere MQ - 7.0.1Thanks in advance for your input.EDIT: Per request, code for processor:public SMSReminderRow process(Message message) throws Exception {\n\n SMSReminderRow retVal = new SMSReminderRow();\n LOGGER.debug(\"Converting JMS Message to ClaimNotification\");\n ClaimNotification notification = createClaimNotificationFromMessage(message);\n\n retVal.setShortCode(BatchCommonUtils\n .parseShortCodeFromCorpEntCode(notification.getCorpEntCode()));\n retVal.setUuid(UUID.randomUUID().toString());\n retVal.setPhoneNumber(notification.getPhoneNumber());\n retVal.setMessageType(EventCode.SMS_CLAIMS_NOTIFY.toString());\n\n DCRContent content = tsContentHelper.getTSContent(Calendar\n .getInstance().getTime(),\n BatchCommonConstants.TS_TAG_CLAIMS_NOTIFY,\n BatchCommonConstants.TS_TAG_SMSTEXT_TYP);\n\n String claimsNotificationMessage = formatMessageToSend(content.getContent(),\n notification.getCorpEntCode());\n\n retVal.setMessageToSend(claimsNotificationMessage);\n retVal.setDateTimeToSend(TimeUtils\n .getGMTDateTimeStringForDate(new Date()));\n\n LOGGER.debug(\n \"Finished processing claim notification for {}. Writing row to file.\",\n notification.getPhoneNumber());\n return retVal;\n}JMS config:\n\n\n \n \n \n \n\n\n\n\n\n \n\n\n \n \n \n \n false\n \n \n 20000\n \n### Assistant: As a rule, MQ will NOT lose messages when properly configured. The question then is what does \"properly configured\" look like?Generally, lost messages are caused by non-persistence or non-transactional GETs.If non-persistent messages are traversing QMgr-to-QMgr channels andNPMSPEED(FAST)is set then MQ will not log errors if they are lost. That is what those options are intended to be used for so no error is expected.Fix: SetNPMSPEED(NORMAL)on the QMgr-to-QMgr channel or make the messages persistent.If the client is getting messages outside of syncpoint, messages can be lost. This is nothing to do with MQ specifically, it's just how messaging in general works. If you tell MQ to get a message destructively off the queue and it cannot deliver that message to the remote application then the only way for MQ to roll it back is if the message was retrieved under syncpoint.Fix: Use a transacted session.There are some additional notes, born out of experience.Everyone swears message persistence is set to what they think it is. But when I stop the application and inspect the messages manually itveryoften isnotwhat is expected. It's easy to verify so don't assume.If a message is rolled back on the queue, it won't happen until MQ or TCP times out the orphan channel This can be up to 2 hours so tune the channel parms and TCP Keepalive to reduce that.Check MQ's error logs (the ones at the QMgr not the client) to look for messages about transactions rolling back.If you still cannot determine where the messages are going, try tracing withSupportPac MA0W. This trace runs as an exit and it isextremelyconfigurable. You can trace allGEToperations on a single queue and only that queue. The output is in human-readable form.\n"}
+{"text": "### Human: I want to build a publish/subscribe program to compute matrix manipulation on a cluster.When a publisher send a message to a topic, message copies to all subscribers.I want a copy of message send to one subscriber and the message deletes and not send to other subscribers.### Assistant: There are two ways to do this.Make an administrative subscription and have all subscribers read messages off the queue to which the subscription points.Use MQ V8.0, the new JMS 2.0 interface, and theShared Subscriptionfeature.Note that in both of these cases, all subscribers are connected to the same queue manager. Although Pub/Sub creates a single logical message, when it is broadcast to other queue managers it becomes multiple physical messages and their consumption by subscribers is not coordinated across the network.\n"}
+{"text": "### Human: I am trying to use Websphere MQ (without WAS) as the XA transaction coordinator for my java application between MQ and Oracle 11g.Is it possible? Is it a good practice?I have installed the MQ V7.0.1 server on my windows (64bit win7) and config the XA resource manager properly. However when my simple java code start a transaction and blackout it, only the message on the queue can rollback but DB operation can not rollback. I expect both of them can rollback together.My simple java code like belowQueueManager qmgr = new QueueManager(QM_NAME, properties);.....JdbcConnection conn = qmgr.getJdbcConnection(xads);qmgr.begin();// do DB operation and put message to queueqmgr.backout();conn.close();However only the 'put message' can rollback, while the DB operation can not.I am a newbie for MQ, Do you have any idea to resolve this issue? Any input is highly appreciate!### Assistant: TheDetailed System Requirementspage says that this is supported, but with some combinations it is necessary to have installed Fix Pack 7.0.1.2 or 7.0.1.3 to work. Please see the section of the page entitledResource Manager\u200bs (when MQ is the Transaction Manager)\u200bfor details.The Fix Packs can be downloadedfrom here.The documentation to enable XAis here.\n"}
+{"text": "### Human: I'm building a spring-websocket application that currently uses RabbitMQ as a message broker via the STOMP protocol. The rest of our organization mostly uses IBM Websphere MQ as a message broker, so we'd like to convert it away from RabbitMQ. However Websphere MQ doesn't support the STOMP protocol, which is spring-websocket's default. MQTT seems like the easiest supported protocol to use instead. Ideally our front-end web clients will continue to use STOMP, but I'm also OK with migrating them to MQTT if needed.What classes do I need to overwrite to make spring-websocket interface with the broker via MQTT instead of STOMP?This articleprovides some general guidance that I should extendAbstractMessageBrokerConfiguration, but I'm unclear where to begin.Currently I'm using the standard configuration methods:registry.enableStompBrokerRelayandregisterStompEndpointsinAbstractWebSocketMessageBrokerConfigurer### Assistant: Ryan has some good pointers.The main work is going to be creating a replacement for StompBrokerRelayMessageHandler with an MqttBrokerMessageHandler that not only talks to an MQTT broker but also adapts client STOMP frames to MQTT and vice versa. The protocols are similar enough that it may be possible to find common ground but you won't know until you try.Note that we did have plans for for MQTT supporthttps://jira.spring.io/browse/SPR-12581but the key issue was that SockJS which is required over the Web for fallback support does not support binary messages.\n"}
+{"text": "### Human: somebody can help me in configuring Websphere MQ Server in WAS 8.5?I got the below error while creating the WAS MQ Server.Error: WebSphere MQ server MQSERVER connection test failed for WebSphere MQ queue manager MQSERVER. CWSJP0050E: An attempt to connect to WebSphere MQ queue manager or queue sharing group MQSERVER failed. The WebSphere MQ reason code is Unknown (2538)..### Assistant: MQRC 2538 means \"host not available\". Check the host name and port name that you have specified and is pointing to the machine where MQ queue manager \"MQSERVER\" is running.Check on which port your queue manager is listening. You can do that by using MQExplorer or runmqsc command shell on the machine where you queue manager is running. In a command prompt, run the following commandrunmqsc MQSERVEROnce the runmqsc shell opens run the following command to list TCP listener.dis listener(SYSTEM.DEFAULT.LISTENER.TCP)Check the PORT number displayed. By default it will be 0. You need to change this to some port number. To change the port number run the following command.alter listner(SYSTEM.DEFAULT.LISTENER.TCP) port(1414)Once this is done you need to start the listener by running the following commandstart listener(SYSTEM.DEFAULT.LISTENER.TCP)After this you can attempt your tests.\n"}
+{"text": "### Human: I need to change the C++ code to connect with WebSphere MQ using Client Channel defnition table. There are about 5000+ MQ clients and 10 MQ Servers on Windows 2003 with v6.0. Please help me if any one using C++ with CCDT.### Assistant: Set the MQCHLLIB and MQCHLTAB environment variables to point to the channel table as described in \"Using WebSphere MQ environment variables.\" Next, set SSLKEYR as described in the same section of the manual. These will allow the app to find the CCDT and the KDB files. Be sure that the CCDT contains channel definitions which specify the right SSLCIPH and then connect as usual. No code changes should be required.A word of advice, use the WMQ v7 client, even though the server is at v6. The client is backward compatible as long as you do not try to use the v7 features like automatic reconnect. However, v6 is end-of-life next year and if you want to avoid retesting and redeployment - or running an unsupported version - deploy as much as possible on v7 components.\n"}
+{"text": "### Human: I am currently building a Mule ESB server application which uses a request-response jms connector. Since it is being used in a highly concurrent environment, we enabled spring jms cache in our MQ config.\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \nThis configuration runs fine when the client uses a static replyTo queue. However, we have some customers who are using dynamic/temporary replyTo queue. Sinceorg.springframework.jms.connection.CachingConnectionFactorycaches producers, for every temporary replyTo queue, a producer object is cached and never closed. After processing hundreds of requests, the application started throwing exceptions:********************************************************************************\nMessage : Failed to create and dispatch response event over Jms destination \"queue://QMGR1/TESTret5a975v53AF980F2006BE02?targetClient=1\". Failed to route event via endpoint: null. Message payload is of type: JMSTextMessage\nCode : MULE_ERROR-42999\n--------------------------------------------------------------------------------\nException stack is:\n1. MQJE001: Completion Code 2, Reason 2017 (com.ibm.mq.MQException)\n com.ibm.mq.MQQueueManager:2808 (null)\n2. MQJMS2008: failed to open MQ queue TESTret5a975v53AF980F2006BE02(JMS Code: MQJMS2008) (javax.jms.ResourceAllocationException)\n com.ibm.mq.jms.MQQueueServices:398 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/ResourceAllocationException.html)\n3. Failed to create and dispatch response event over Jms destination \"queue://QMGR1/TESTret5a975v53AF980F2006BE02?targetClient=1\". Failed to route event via endpoint: null. Message payload is of type: JMSTextMessage (org.mule.api.transport.DispatchException)\n org.mule.transport.jms.JmsReplyToHandler:173 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)After investigating the MQ error code (MQJE001: Completion Code 2, Reason 2017), I found that the reason behind this error is because we never closed producers, and the producers exhausted MQ Handles on the Queue Manager. The quick and easy fix is to uncomment the line in spring jms cache config to close Producers each and every time.\n \n \n \n \nNow I am not seeing the MQ issue, but came up with another performance issue, because no producers are cached, so a new producer is created every single time.My question is, how to deal with this scenario? Since the client won't change the way they receive reply messages from temporary queues, how can we avoid exhausting MQ handlers without impacting the performance.Thank you very much\n- Lei### Assistant: This is a very interesting use case. However, I'm afraid there is nothing out of the box to fix this. There are the more obvious solutions: disable the caching or extend the spring cache provider.Temporary queues and performance are definitely not two things that you can have at the same time. I would suggest another posibility:If you are using the temporary queues to have the responses come back to a given consumer only, probably in adition to having old messages discarded on reconnection:You could use a well know queue for the replies, using a combination of a header with the hostname that should receive the message plus a selector different on each consumer node and a TTL on the messages sent to make them dissapear after a while.\n"}
+{"text": "### Human: I am having problems testing the MQSC Adapter in BizTalk to communicate with a Queue on Z/OS Host.The test senario: While sending messages though Biztalk I (Force)stop and start the Host channel, to mimic a HOST IPL.In this scenario I experienced the following outcomes:Sometimes there are messages left uncomitted on the Host MQ.Even after the channel are started again. This way I don't know if the messages have been processed by Biztalk.QuestionIs there a way to make sure that messages are always committed on the Host MQ or still available on the MQ if not committedOnce I experienced duplicate messages and once that messages was lostSince these things happened only once each. I hope to find problems in my test applications / procedure.Not really a question, but if others have experienced the same errors I would like to know.The test SetupBiztalk 2009 on 2 nodesWebSphere MQ client 7.5.0.2 (Transactions supported)MSDTC -XA Transactionsare enabled (Edited to reflect comments)MS Biztalk Adapters for Host Systems 2.0Port ConfigurationReceive LocationSend Port### Assistant: If you are using MQ transactions, that is just MQPMO_SYNCPOINT and MQCMIT, then the disconnection (either explicitly or implicitly due toSTOP CHANNEL(chl-name) MODE(FORCE)) will cause any outstanding transaction to be completed (committed on an explicit disconnection, rolled-back on an implicit one).If you are using 2-PC transactions with a Transaction Manager (TM), then the transaction will need to be dealt with by the TM, depending on how far through it is, is it prepared already for example.\n"}
+{"text": "### Human: When a local queue manager receives the following message in it's AMQ error log:09/13/12 08:00:19 - Process(3017.20) User(mqm) Program(amqrmppa_nd)\n AMQ9544: Messages not put to destination queue.EXPLANATION: During the processing of channel 'TO_QM_QD2T1_C1' one or\n more messages could not be put to the destination queue and attempts\n were made to put them to a dead-letter queue. The location of the\n queue is 2, where 1 is the local dead-letter queue and 2 is the remote\n dead-letter queue.... what is the mechanism by which MQ exchanges such information? Is there a built in facility within the channel program API itself, or is the info exchanges as discrete messages placed on theSYSTEM.CLUSTER.COMMAND.QUEUE(in the case of a cluster)? Given that this could occur in a remote queue definition situation, with only simple sender/receiver channel pairs, and no corresponding COMMAND QUEUE necessarily, I could imagine that it would be handled via the channel process communications... just wondering...### Assistant: The channel agents have a bi-directional communication between them, even though messages flow in only one direction. When a message fails to find the destination at the remote end there are several possibilities for what happens next. The channel will only continue to run if the message can be successfully putsomewhereand the first place to try is the remote DLQ. If that fails, the local MCA must either relocate the message or stop the channel. Therefore, the two message channel agents work out between them what happens and what the status of the channel should be.The peculiar wording of the error message reflects that the different dispositions of the message derive from within the same code path and exception handling and the optimization of WMQ. The MCA knows the message was put to a DLQ at that point and rather than having two different error messages or logic to work out the wording on which DLQ was used, it just drops a number into a template. Thus a single error message and streamlined logic are used for both possibilities.\n"}
+{"text": "### Human: I've run into a frustrating problem browsing a queue all the way through its depth. I understood that the queue needs to be opened with the MQOO_BROWSE option among the open options. Then on the first read do a GET using the Get Messsage Option MQGMO_BROWSE_FIRST. Finally, the subsequent GET's should use the MQGMO_BROWSE_NEXT option.The problem is, my attempts worked only to retrieve the first message! Upon the second GET, even with MQGMO_BROWSE_NEXT, the method threw MQRC_NO_MSG_AVAILABLE, even though there were 5 messages in the queue!Here was the code I was using:IList Messages = new List();\n_queueManager = new MQQueueManager(QueueManagerName);\nint openOptions = MQC.MQOO_BROWSE // open queue for browsing\n_queue = QManager.AccessQueue(QueueName, openOptions);\n\nMQGetMessageOptions mqGetMsgOpts = new MQGetMessageOptions();\nmqGetMsgOpts.Options = MQC.MQGMO_BROWSE_FIRST;\n\nMQMessage msg = new MQMessage();\n\n_queue.Get(msg, mqGetMsgOpts);\nMQGetMessageOptions mqGetNextMsgOpts = new MQGetMessageOptions();\nmqGetNextMsgOpts.Options = MQC.MQGMO_BROWSE_NEXT;\n\ntry\n{\n while (true)\n {\n string messageText = msg.ReadString(msg.MessageLength);\n Messages.Add(messageText);\n _queue.Get(msg, mqGetNextMsgOpts);\n }\n}\ncatch (MQException ex)\n{\n // Handle it\n}### Assistant: This was frustrating, but I was able to rely upon questions and answers posted here on SO to verify that I was on the right path. Unfortunately, none of the answers addressed subsequent GETs with browse, and I was stumped. The answer came to me after trying a number of fruitless other paths, and it was very simple when I finally came to it. I decided to post the Q&A of my solution that worked.Apparently, once having done a GET into an MQMessage, unless you re-initialize it, the GET can't get the next message, and it throws the MQRC_NO_MSG_AVAILABLE exception immediately. Re-initializing the MQMessage instance before performing the GET solves the problem. I modified the code above by adding the needed line of code just before the GET in the while loop:while (true)\n{\n string messageText = msg.ReadString(msg.MessageLength);\n Messages.Add(messageText);\n msg = new MQMessage();\n _queue.Get(msg, mqGetNextMsgOpts);\n}Once I made this change, the routine browsed all the messages on the queue.\n"}
+{"text": "### Human: IBM's advice doesn't work for me:http://www-01.ibm.com/support/docview.wss?uid=swg21454454### Assistant: Open file ...\\MQExplorer\\eclipse\\configuration\\config.ini and add this lines:org.osgi.framework.language=en\nosgi.nl=en_UScredits go to:http://blog.ondruska.com/2012/12/switch-eclipse-language.html\n"}
+{"text": "### Human: I wrote a program to put messages into MQ . It works fine when I don't have SSL configuration in place. If I configure SSL in QueueManager and Channel, always getting An MQException occurred: Completion Code 2, Reason 2400\nMQJE011: Socket connection attempt refused. Tried with different cipher suite\nPlease advise how to resolve it.SSL properties :com.ibm.mq.MQEnvironment.sslCipherSuite = \"TLS_RSA_WITH_AES_256_GCM_SHA384\"; \nSystem.setProperty(\"javax.net.ssl.trustStore\", \"D:/keystore/testKS.jks\");\nSystem.setProperty(\"javax.net.ssl.trustStorePassword\", \"12345678\");\nSystem.setProperty(\"javax.net.ssl.keyStore\", \"D:/keystore/testKS.jks\");\nSystem.setProperty(\"javax.net.ssl.keyStorePassword\", \"12345678\");### Assistant: This answer specific to Java code .Java JREs, including Oracle/Sun and IBM's have Import Limits on Cryptographic Algorithms enabled. This limits the maximum key sizes and also some algorithms.When trying to use a AES 256 cipher, such asECDHE_RSA_AES_256_CBC_SHA384orTLS_RSA_WITH_AES_256_CBC_SHA256, you need to ensure JRE supports this cipher. In most cases, when the stronger cipher algorithms are needed, such as AES 256 ciphers, the JCE Unlimited Strength Jurisdiction Policy Files must be obtained and installed in the JDK/JRE.This is mentioned in the JDK/JRE documentation: For Oracle 1.7:http://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.htmlFor IBM JRE: ** Cipher suites that use AES_256 require installation of the JCE Unlimited Strength Jurisdiction Policy Files.http://www-01.ibm.com/support/knowledgecenter/SSYKE2_7.0.0/com.ibm.java.security.component.71.doc/security-component/jsse2Docs/ciphersuites.html?lang=enThis is similar to the issue noted with IBM MQ Explorer in :https://developer.ibm.com/answers/questions/187285/why-is-a-mqrc-ssl-initialization-error-displayed-w.htmlPlease updated this JAR File run with MSPKI and Cipher value \u201cTLS_RSA_WITH_AES_256_CBC_SHA\u201dNew policy jar which will support all the algorithms, you need to update jars into yourC:\\java-8\\jdk1_8_0\\jre\\lib\\securityhttp://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html\n"}
+{"text": "### Human: I have to periodically check messages in a queue within Websphere MQ. I haven't found better approach rather than try getting a message and handle 2033 reason code (which is NO_MSG_AVAILABLE) like this:try\n{\n // ...\n inQueue.Get(message);\n}\ncatch (MQException exception)\n{\n if (exception.ReasonCode != 2033)\n throw;\n}Is there better way to get message from queue? I think that there might be some openOptions flag that I'm not aware of, that wouldn't throw exception when no message available, but return null instead.### Assistant: There are three ways to avoid or reduce this polling mechanism.\nHere they are in oder of elegance(the higher the better):MQGET with wait interval UNLIMITED and MQGMO_FAIL_IF_QUIESCINGGet your application be triggered by MQServerCallback function - new with MQ V7 on both sides\n"}
+{"text": "### Human: I've installed WebSphere MQ 7.1 on Linux platform, after which I installed WebSphere Message Broker 8.0.0.1. Now when I try to create an execution group, I get an exception: Reason code 2035. This exception states that the user is unauthorised to connect to the queue manager. I have this user added in themqmgroup. I did not face any such issue when I was working with MQ 7.0.x. I searched a lot and came to know that there is user ID blocking in MQ 7.1. But, I want this user to be able to create execution group, how can I do so? Please advise.### Assistant: MQ security has been improved a lot in MQ v7.1 and is different from what it used to be in earlier MQ versions. In MQ v7.1, by default all SYSTEM.channels are blocked. If you are trying to use any of these SYSTEM.channels then you will get 2035 which is MQRC_NOT_AUTHORIZED. The recommended way is to create your own SVRCONN channel for broker and create channel authentication records to allow the user to access queue manager.Please see thislinkfor detailed answers from T.Rob on similar issue.Update:A SVRCONN channel defines the endpoint of a queue manager meaning the connection information required by the clients to connect to a queue manager. Client applications use this type of channel to send and receive messages to/from a queue or a topic.Message Broker toolkit is GUI that you can use to administer message broker, for example creating execution groups, creating flow, deploying bar files etc. Toolkit is available on Windows and I guess it's available on Linux.I got to know that MB toolkit requires SYSTEM.BRK.CONFIG channel which is a SVRCONN channel to connect to queue manager. I am thinking this is the channel you will need to authorize to allow Message Broker to connect to MQ. Can you check if this is the case and if so create channel authentication record for that channel?\n"}
+{"text": "### Human: I'm new to SpringBoot. Trying to build a simple non-web process where I listen to a MQ Queue and process the messages received. I tried various ways to acheive this in SB, but unfortunately I cant get the @JmsListener method to get called. No errors either & the process just waits.All the MQ Queue details are in application.propertiesI did verify there are messages in the Queue and I could retrieve them using the old MQ receiver way.I would like to know how & when does @JmsListener Annotation method gets called? I did try creating a JmsListenerContainerFactory and included it in the annotation params but made no difference.There are few examples similar to this, it looks simple but I just cant get it to work. Any suggestions are appreciated. Thanks.Main SpringBoot Class@SpringBootApplication\n@EnableJms\npublic class Application {\n\n public static void main(String[] args) {\n SpringApplication.run(Application.class, args);\n }\n\n}MQListener Class@Component\npublic class MQListener {\n @JmsListener(destination = \"${mq.queueName}\")\n public void receiveMessage(final Message message) throws JMSException{\n System.out.println(\"...Message Received...\");\n String messageData = null;\n if(message instanceof TextMessage) {\n TextMessage textMessage = (TextMessage)message;\n messageData = textMessage.getText();\n }\n }\n}MQConfiguration Class@Configuration\npublic class MQConfiguration {\n @Value(\"${mq.host}\")\n private String host;\n @Value(\"${mq.port}\")\n private Integer port;\n @Value(\"${mq.queue-manager}\")\n private String queueManager;\n @Value(\"${mq.channel}\")\n private String channel;\n @Value(\"{mq.queueName}\")\n private String queueName;\n @Value(\"${mq.receive-timeout}\")\n private long receiveTimeout;\n \n @Bean\n public MQQueueConnectionFactory mqQueueConnectionFactory() {\n MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n mqQueueConnectionFactory.setHostName(host);\n try {\n mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n mqQueueConnectionFactory.setChannel(channel);\n mqQueueConnectionFactory.setPort(port);\n mqQueueConnectionFactory.setQueueManager(queueManager);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return mqQueueConnectionFactory;\n }\n}### Assistant: As you are using default settings for the MQ connection factory you don't actually need it. Instead you can use the default one that Spring Boot will create for you. You are also only expecting a text message so you can let Spring do the marshalling. In which case all you need is a message consumer derived from this example -https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level101package ...\n\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.springframework.jms.annotation.JmsListener;\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class MessageConsumer101 {\n protected final Log logger = LogFactory.getLog(getClass());\n\n @JmsListener(destination = \"${mq.queueName}\")\n public void receive(String message) {\n logger.info(\"\");\n logger.info( this.getClass().getSimpleName());\n logger.info(\"Received message is: \" + message);\n }\n}As you will be letting Spring Boot create the MQ container you need to provide settings inapplication.propertiesin the form -# MQ Connection settings\nibm.mq.queueManager=QM1 \nibm.mq.channel=DEV.APP.SVRCONN\nibm.mq.connName=localhost(1414)\n\n\n# Change the following lines as necessary. Set the ibm.mq.user\n# property to an empty string to send no authentication request.\nibm.mq.user=app\nibm.mq.password=passw0rdYou are more likely to want a custom listener than a custom connection factory, but if you do want to configure a ConnectionFactory different from the default, then use a configuration and message consumer derived from this example -https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level114Configuration, you only need to set the properties that deviate from the default.package ...\n\nimport com.ibm.mq.jms.MQConnectionFactory;\nimport com.ibm.mq.samples.jms.spring.globals.handlers.OurDestinationResolver;\nimport com.ibm.mq.samples.jms.spring.globals.handlers.OurMessageConverter;\nimport com.ibm.mq.spring.boot.MQConfigurationProperties;\nimport com.ibm.mq.spring.boot.MQConnectionFactoryFactory;\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.jms.config.DefaultJmsListenerContainerFactory;\nimport org.springframework.jms.config.JmsListenerContainerFactory;\nimport org.springframework.jms.core.JmsTemplate;\nimport org.springframework.jms.support.QosSettings;\n\n\nimport javax.jms.DeliveryMode;\nimport javax.jms.JMSException;\n\n@Configuration\npublic class MQConfiguration114 {\n protected final Log logger = LogFactory.getLog(getClass());\n\n @Bean\n public MQConnectionFactory mqConnectionFactory() throws JMSException {\n MQConfigurationProperties properties = new MQConfigurationProperties();\n // Properties will be a mix of defaults, and those found in application.properties\n // under ibm.mq\n // Here we can override any of the properties should we need to\n MQConnectionFactoryFactory mqcff = new MQConnectionFactoryFactory(properties,null);\n MQConnectionFactory mqcf = mqcff.createConnectionFactory(MQConnectionFactory.class);\n return mqcf;\n }\n\n @Bean\n public JmsListenerContainerFactory> myContainerFactory114() throws JMSException {\n DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();\n factory.setConnectionFactory(mqConnectionFactory());\n factory.setPubSubDomain(false);\n\n factory.setMessageConverter(new OurMessageConverter());\n factory.setDestinationResolver(new OurDestinationResolver());\n\n // reply Qos\n QosSettings rQos = new QosSettings();\n rQos.setPriority(2);\n rQos.setTimeToLive(10000);\n rQos.setDeliveryMode(DeliveryMode.NON_PERSISTENT);\n factory.setReplyQosSettings(rQos);\n\n return factory;\n }\n\n @Bean(\"myNonJmsTemplate114\")\n public JmsTemplate myNonJmsTemplate114() throws JMSException {\n JmsTemplate jmsTemplate = new JmsTemplate(mqConnectionFactory());\n jmsTemplate.setDestinationResolver(new OurDestinationResolver());\n jmsTemplate.setMessageConverter(new OurMessageConverter());\n\n return jmsTemplate;\n }Note: The listener container factory based on the customised connection factory. You need this step. Your message consumer then looks something like:package ...\n\nimport com.ibm.mq.samples.jms.spring.globals.data.OurData;\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.springframework.jms.annotation.JmsListener;\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class MessageConsumer114 {\n protected final Log logger = LogFactory.getLog(getClass());\n\n @JmsListener(destination = \"${mq.queueName}\", containerFactory = \"myContainerFactory114\")\n public void receiveRequest(OurData message) {\n logger.info(\"\");\n logger.info( this.getClass().getSimpleName());\n logger.info(\"Received message of type: \" + message.getClass().getSimpleName());\n logger.info(\"Received message :\" + message);\n }\n}if you need to perform your own marshalling from JMSMessage objects then use a message consumer derived from this example (You only need a consumer and nothing else) -https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level105package ...\n\nimport javax.jms.*;\n\nimport com.ibm.mq.samples.jms.spring.globals.Constants;\nimport com.ibm.mq.samples.jms.spring.globals.data.OurData;\nimport com.ibm.mq.samples.jms.spring.globals.data.OurOtherData;\nimport com.ibm.mq.samples.jms.spring.globals.utils.MessageUtils;\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.springframework.jms.annotation.JmsListener;\n\nimport org.springframework.stereotype.Component;\n\nimport java.io.Serializable;\n\n\n@Component\npublic class MessageConsumer105 {\n protected final Log logger = LogFactory.getLog(getClass());\n\n @JmsListener(destination = \"${app.l105.queue.name2}\")\n public void receiveData(Message message) {\n logger.info(\"\");\n logger.info( this.getClass().getSimpleName());\n logger.info(\"Received message of type: \" + message.getClass().getSimpleName());\n if (null != message) {\n MessageUtils.checkMessageType(message);\n }\n }\n}Wherepackage ...\n\nimport com.ibm.mq.samples.jms.spring.globals.Constants;\nimport com.ibm.mq.samples.jms.spring.globals.data.OurData;\nimport com.ibm.mq.samples.jms.spring.globals.data.OurOtherData;\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\n\nimport javax.jms.*;\nimport java.io.Serializable;\nimport java.util.Map;\n\npublic class MessageUtils {\n protected static final Log logger = LogFactory.getLog(MessageUtils.class);\n\n private MessageUtils () {}\n\n public static void checkMessageType(Message message) {\n try {\n if (message instanceof TextMessage) {\n logger.info(\"Message matches TextMessage\");\n logger.info(\"message payload is \" + ((TextMessage) message).getText());\n } else if (message instanceof BytesMessage) {\n logger.info(\"Message matches BytesMessage\");\n } else if (message instanceof MapMessage) {\n logger.info(\"Message matches MapMessage\");\n } else if (message instanceof StreamMessage) {\n logger.info(\"Message matches StreamMessage\");\n } else if (message instanceof ObjectMessage) {\n checkForObject((ObjectMessage) message);\n }\n } catch (JMSException e) {\n logger.warn(\"Unable to process JMS message\");\n }\n }\n\n public static void logHeaders(Map msgHeaders) {\n if (! msgHeaders.isEmpty() ) {\n logger.info(\"\");\n logger.info(\"Headers found\");\n msgHeaders.forEach((k, v) -> {\n logger.info(k + \": is of type\" + v.getClass());\n });\n }\n }\n\n private static void checkForObject(ObjectMessage message) {\n try {\n int typeValue = message.getIntProperty(Constants.DATATYPE);\n if (Constants.DataTypes.OURDATATYPE.getValue() == typeValue) {\n logger.info(\"It is one of our objects\");\n Serializable serObj = message.getObject();\n OurData data = (OurData) serObj;\n logger.info(data);\n } else if (Constants.DataTypes.OUROTHERDATATYPE.getValue() == typeValue) {\n logger.info(\"It is one of our other objects\");\n Serializable serObj = message.getObject();\n OurOtherData data = (OurOtherData) serObj;\n logger.info(data);\n } else {\n logger.warn(\"It is not one of our objects\");\n }\n } catch (JMSException e) {\n logger.warn(\"Unable to retrieve message data\");\n } catch (ClassCastException e2) {\n logger.warn(\"Not the object we were expecting\");\n }\n }\n\n}If your consumer and configuration classes have the@Componentand@Configurationannotations and sit within the same package family, then they will be found, If not then you need to add some more annotations to the Application to get Spring to pick them up. eg.package ...\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.EnableAutoConfiguration;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.annotation.ComponentScan;\nimport org.springframework.jms.annotation.EnableJms;\n\n\n@SpringBootApplication\n@EnableJms\n@ComponentScan\n@EnableAutoConfiguration\npublic class MQApplication {\n public static void main(String[] args) {\n SpringApplication.run(MQApplication.class, args);\n }\n}If you don't havespring.jms.listener.auto-startup=falsein your application.properties file then all the listeners will start automatically on application start.You will need to namemq-jms-spring-boot-starteras a dependency. Eg. if using maven :\n com.ibm.mq\n mq-jms-spring-boot-starter\n 2.4.1\n If this is the only JMS implementor then Spring Boot will be able to figure out that all your listeners are Using IBM MQ. If you have other JMS providers listed as dependancies, then Spring needs to be explicitly told which connection factories to use. There is a sample pom.xml with only the required dependancies in the sample athttps://github.com/ibm-messaging/mq-dev-patterns/blob/master/Spring-JMS/pom.xmlTry the 101 sample athttps://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMSIt's maven based, has only the required dependancies listed in itspom.xmland all you will need to do is update theapplication.propertiesinhttps://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/resourcesto point at your MQ server.\n"}
+{"text": "### Human: I want to dump a message from a queue in WebSphere MQ which is installed on a linux machine. How could I check messages inside queues withmqmauthorized user? I have already checked insideopt/mqm/binand I found some MQ commands likedmpmqautand etc. But I can't find a command for dumping messages inside queues.EDIT-I am using WebSphere MQ v.7.1### Assistant: You don't say what version you are, but hopefully you are at a new enough version to have thedmpmqmsgcommand, This will dump the messages off the queue to a file.If you are on an older version on IBM MQ that does not have this command, then the equivalent function can be used throughSupportPac MO03 QLOAD.dmpmqmsgwas the productisation of this free tool.\n"}
+{"text": "### Human: if [[ $(dspmq | grep '(Running)' | grep \"$QMgr\" | wc -l | tr -d \" \") != 1 ]]The above code is to check if queue manager is running or not.Is there any command to check whether the given queue name is exists in the queue manager or not?### Assistant: Adding another suggestion in addition to what Rob and T.Rob have said.MQ v7.1 and higher come with the dmpmqcfg command and you can use this to check for a specific queue.The examples below are in line with your sample that checks if a queue manager is running:To use dmpmqcfg to check if a queue name of any type exists you could do this:if dmpmqcfg -m ${QMgr} -t queue -x object -o 1line -n ${QName}|egrep '^DEFINE '; then\n echo \"Queue ${QName} exists on Queue Manager ${QMgr}\nfiUsing the method Rob Parker provided* to check if a queue name of any type exists:*Note I usedDISPLAY Q(instead ofDISPLAY QLOCAL(if printf \"DISPLAY Q(${QName})\" | runmqsc ${QMgr} 2>&1 >/dev/null; then\n echo \"Queue ${QName} exists on Queue Manager ${QMgr}\nfiYour example check for a queue manager Running could be simplified to this:if dspmq -m ${QMgr}| grep --quiet '(Running)'; then\n echo \"Queue Manager ${QMgr} is Running\"\nfi\n"}
+{"text": "### Human: How do I create the listener in WebSphere MQ version 5.3? I have used therunmqsccommand and enter into console and try to execute this command:DEFINE LISTENER (name) TRPTYPE(TCP) PORT(99990)But is throwing andAMQ8426error and saying:Valid commands are DEFINE AUTHINFO,DEFINE CHANNEL,\n DEFINE PROCESS, DEFINE NAMELIST,DEFINE QALIAS, DEFINE QLOCAL,DEFINE\n QMODE,DEFINE QREMOTE### Assistant: How do i create the listener in the MQ version 5.3?You don't. That component wasn't available in v5.3, a version of MQ that was out of service in 2007. In fact, it has been out of service for so long, that IBM has removed the online Infocenter for it. However, you can still find the individualMQ v5.3 manuals online. In particular, theIntercommunicationmanualsection on receiving on TCPexplains that with this version you will need either to useinetdor therunmqlsrprogram.Of course since v5.3 has been out of service for 8 years on most platforms, the more important advice here isuse a modern version. IBM has provided a license that allows people to run an unrestricted MQ server install on their laptop or PC at no charge. The product/license name isIBM MQ Advanced For Developers.Note that while it is important for individuals to move to a modern version of MQ, it is even more so for the companies using MQ for business purposes. In the 8 years (as of this writing) since v5.3 was retired, there have been many security-relevant fixes, none of which were maintained in the 5.3 code base. Obviously, that goes for all the performance improvements, bug fixes and enhancements as well.There are almost no legitimate reasons for anyone to still be working with MQ v5.3 (which I am intentionally not enumerating here) but if you actually are facing one of them and are stuck at that version, use therunmqlsrprogram and launch it in your start script.But the correct answer for virtually EVERYONE else reading this isdo NOT keep using MQ v5.3.\n"}
+{"text": "### Human: From my application I need to query some Websphere MQ per-queue statistics (last message get/put time, number of en/dequeued messages, current queue depth, number of connected clients).\nI managed to get the queue depth via PCFAgent, but I'm kind of stuck on the rest because the IBM documentation is rather confusing.Do you know any useful references (or code examples) that might help?### Assistant: If you installed the WMQ client in the default location then the samples will be at:C:\\Program Files (x86)\\IBM\\WebSphere MQ\\tools\\pcf\\samples.On UNIX flavors, they end up under/opt/mqm/samp.If you just grabbed the jar files and did not install the client then you won't have a supported configuration - or the samples, tracing utilities, diagnostic tools, etc., etc. The client install media is available for free download in theSupportPacs page. The different clients currently available are:Version 6.0 isSupportPac MQC6(V6 is end of life Sept 2012)Version 7.0 isSupportPac MQC7Version 7.1 isSupportPac MQC71Make sure that you are looking at the Infocenter for the version of WebSphere MQ Server that you are connecting to. Also note that if you connect to a v7 QMgr and are using a v6 client, then the constants and classes you are using will limit you to the v6 functionality. Preferably, use the latest client since it is always backward compatible with older QMgr versions.UPDATE:Here are some code snippets to perform the requested functions:First you need a queue manager connection (qmgr). Then you can create aPCFMessageAgent:// Create PCF Message Agent\ntry {\n pcfAgent = new PCFMessageAgent(qmgr);\n} catch (MQException mqe) {\n System.err.println(\"PCF Message Agent creation ended with reason code \"\n + mqe.reasonCode);\n return mqe.reasonCode;\n}You can get most of the attributes you need using (except the enq/deq count) the call below. Note that in order to get last msg get\\put time you need to turn queue monitoring (MONQ) on.// Prepare PCF command to inquire queue status (status type)\ninquireQueueStatus = new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_STATUS);\ninquireQueueStatus.addParameter(CMQC.MQCA_Q_NAME, \"name of queue to inquire\");\ninquireQueueStatus.addParameter(CMQCFC.MQIACF_Q_STATUS_TYPE, CMQCFC.MQIACF_Q_STATUS);\ninquireQueueStatus.addParameter(CMQCFC.MQIACF_Q_STATUS_ATTRS, new int[] {\n CMQC.MQCA_Q_NAME, CMQC.MQIA_CURRENT_Q_DEPTH,\n CMQCFC.MQCACF_LAST_GET_DATE, CMQCFC.MQCACF_LAST_GET_TIME,\n CMQCFC.MQCACF_LAST_PUT_DATE, CMQCFC.MQCACF_LAST_PUT_TIME,\n CMQCFC.MQIACF_OLDEST_MSG_AGE, CMQC.MQIA_OPEN_INPUT_COUNT,\n CMQC.MQIA_OPEN_OUTPUT_COUNT, CMQCFC.MQIACF_UNCOMMITTED_MSGS });You can retrieve the parms using:pcfResp = pcfAgent.send(inquireQueueStatus);The for each individual parms you can use thegetXXXXXParameterValuemethod (XXXXXXis the type of data).For the Enq/Deq counts, you need to reset the queue statistics:// Prepare PCF command to reset queue statistics\nqueueResetStats = new PCFMessage(CMQCFC.MQCMD_RESET_Q_STATS);\nqueueResetStats.addParameter(CMQC.MQCA_Q_NAME, queueName);\n\npcfResp3 = pcfAgent.send(queueResetStats);\n\nqueueMsgDeqCount = pcfResp3[0].getIntParameterValue(CMQC.MQIA_MSG_DEQ_COUNT);\nqueueMsgEnqCount = pcfResp3[0].getIntParameterValue(CMQC.MQIA_MSG_ENQ_COUNT);Let me know if you have more questions.\n"}
+{"text": "### Human: Please tell me how do i read the MQ activity logs ? Which inside the QManger folder.Thats format is human unreadable### Assistant: Please confirm which directory and the filename of the log you are trying to read. Active log files such as S0000001.LOG are not human readable. They are used internally by the queue manager.The logs most often used to administer a queue manager are the error logs such as AMQERR01.LOG which are found in the subdirectory under qmgrs/QMGRNAME/errors directory.If you truly need to see some info stored in the active log files, you can use the dmpmqlog command to dump a formatted version. Refer to the knowledge center:http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q083170_.htm\n"}
+{"text": "### Human: I want to load files in the file system to a WebSphere MQ Queue. There are couple of support pacs -Q ProgramandMO03: WebSphere MQ Queue Load / Unload Utilitythat come close but they mandate the files to be in a specific format. I have the messages which are XML files and want a quick way to load them to a queue. The number of files run into a few hundred so looking for an utility to do this job instead of having to write an application to achieve this.I could not locate some general purpose application to achieve this. So looking for some help hereThanks### Assistant: Why do you believe that the Q program requires a specific file format? According to theREADME.TXTfile, the following options are available:-f\n Input file.\n Each line of the file will be put to output queue as a different\n message.\n See \"Z/OS FILE NAME FORMAT EXAMPLES\" for specific z/OS details.\n\n-F[+]\n Input/output file.\n Entire file will be put to the output queue as a single message.\n If '+' is specified the dataset attributes will be retained if\n the output dataset exists - z/OS only.\n See \"Z/OS FILE NAME FORMAT EXAMPLES\" for specific z/OS details.So if you specify-F(without the+) all lines in the the XML file are loaded into a single message. You can also specify the message options using the-aparameter:-a Sets message attributes when put to the output queue\n\n n - forces non-persistence\n p - forces persistence\n q - uses queue default persistence\n d - put a datagram message type\n r - put a reply message type\n R - put a request message type\n t - put a report message type\n x - don't treat lines starting with '#' as specialAlthough the Q program will interpret files by default, note that the-axoption above tells it to ignore lines with#which it would ordinarily interpret as commands. This allows you to load XML files or source code with comments or even binary files such as a PDF or JPG.Was there a specific limitation in Q that you are unable to work with? If so, it would be helpful to know what that is so we might point you to something that would better fit your purpose.UPDATEResponding to Spyro's comments, Q isnotlimited to 1000 characters. Here's an example where the README file from the Q distribution is written to a single message and read back.D:\\WMQ\\MA01>q -m JMSDEMO -OSYSTEM.DEFAULT.LOCAL.QUEUE -FREADME\nMQSeries Q Program by Paul Clarke [ V6.0.0 Build:May 1 2012 ]\nConnecting ...connected to 'JMSDEMO'.\n\nD:\\WMQ\\MA01>echo dis q(SYSTEM.DEFAULT.LOCAL.QUEUE) curdepth | runmqsc JMSDEMO\n5724-H72 (C) Copyright IBM Corp. 1994, 2011. ALL RIGHTS RESERVED.\nStarting MQSC for queue manager JMSDEMO.\n\n\n 1 : dis q(SYSTEM.DEFAULT.LOCAL.QUEUE) curdepth\nAMQ8409: Display Queue details.\n QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE) TYPE(QLOCAL)\n CURDEPTH(1)\nOne MQSC command read.\nNo commands have a syntax error.\nAll valid MQSC commands were processed.\n\nD:\\WMQ\\MA01>q -m JMSDEMO -dl -iSYSTEM.DEFAULT.LOCAL.QUEUE\nMQSeries Q Program by Paul Clarke [ V6.0.0 Build:May 1 2012 ]\nConnecting ...connected to 'JMSDEMO'.\nMQGET 24309 bytes\n============================================================================\nMessage Descriptor (MQMD)\nReport :00000000\nMessage Type :8 (Datagram)\nFormat :'MQSTR '\nPriority :0\nPersistence :0 (Not Persistent)\nMessage Id :A M Q J M S D E M O . . . R . * .\n 414D51204A4D5344454D4F20202020201DDEA052200B2A02\n 'AMQ JMSDEMO ...R .*.'\nReplyToQ :' '\nReplyToQMgr :'JMSDEMO '\n ----------------------------------------------------------------------\n| |\n| |\n| DESCRIPTIVE NAME WebSphere MQ Q Program |\n| |\n\n------- 8><-------------------------------------------------------------\nREMAINDER OF MSG OUTPUT OMITTED FOR BREVITY. PRINT-OUT RESUMES...\n------- 8><-------------------------------------------------------------\n\nNo more messages.\n\nD:\\WMQ\\MA01>Note the header lines where the message was printed. The-dloption tells Q to print the message length which, in this case, was 24309 bytes. I downloaded the current version to perform this test so this is accurate as of 7 December 2013.\n"}
+{"text": "### Human: In my test I run inmem ActiveMQ and then instantiate ActiveMQConnectionFactory and do whatever I want in order to test it. I used this because that seemed to be the easiest way to create integration test. I thought the switch from ActiveMQConnectionFactory to com.ibm.mq.jms.MQTopicConnectionFactory would be straightforward. But it apparently is not. What would be the mapping from this snippet\n \nto that one:\n \n \n \n \n \nWould that be even possible without some kind of weird bridges Camel has?### Assistant: This is not possible. The JMS specification covers the API and behavior but vendors are free to implement any wire format and communication protocols that they wish. WebSphere MQ uses it's own formats and protocols and Active MQ has its own formats and protocols.Bridge applications function by reading messages into memory from one transport then writing that message to the other transport. Although this works at a basic level, the two transports have different destination namespaces and security realms so these interfaces tend to be hard-coded point-to-point routes. This is usually the best you can expect when mixing JMS transport providers.\n"}
+{"text": "### Human: I have a program which publishes data to IBM Websphere MQ via the MQAX200 interface. I'm struggling to work out how to test it.What's the simplest way of setting up an application to consume the messages from the queue and confirm they're correct? I don't currently have any MQ infrastructure here (that's on the client's site).Do I need a message broker? Are there any open source implementations? Or do i need to purchase Websphere MQ, in which case what's the minimal license I'd require?ThanksBen### Assistant: As your application is written using a MQ interface, you need MQ to test. If it's just for testing, you can use thetrialversion of MQ.As far as I know MQAX200 interface supports only P2P messaging and not Publish/Subscribe messaging. So using your application put message to a queue and then use the application likeamqsgetto receive message.You don't need message broker.\n"}
+{"text": "### Human: I am trying to test the authentication exits in a MQ server. All the channels has theSSLCAUTHattribute set toREQUIRED. As I know, this means each client must have SSL certificate in order to put message in channel and if they don't have valid SSL certificate, the connection will be refused. However, when I checked theSSLCIPHattribute for these channels, they are all blank. IBM documentation says: \"TheSSLCIPHattribute can contain a blank value, meaning that you are not using SSL or TLS. If one end of the channel has a blankSSLCIPHattribute, the other end of the channel must also have a blankSSLCIPHattribute.\"So, I am totally confused here. Are the channels using SSL certificate for authentication or not. Any help will be greatly appreciated.### Assistant: The SSLCAUTH attribute is only applicable if the SSLCIPH attribute is not blank. In other words the SSLCIPH attribute is the big switch for SSL/TLS being used. Only then will the SSLCAUTH attribute even be looked at.\n"}
+{"text": "### Human: I need to write a Windows based service in C# to listen to the request queue configured in WebSphere MQ. I successfully put the request in MQ and get a correlation ID, but in response, I'm not getting the actual result.I want to develop a system that whenever a new message arrives in the queue, the service should pick up the message and process the request. I can map that response with my correlation ID.### Assistant: The following code has solved my problem.class Program\n{\n static void Main(string[] args)\n {\n Program app = new Program();\n app.Setup();\n Console.ReadLine();\n\n }\n\n public void Setup()\n {\n XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n IConnectionFactory cf = xff.CreateConnectionFactory();\n cf.SetStringProperty(XMSC.WMQ_HOST_NAME, \"10.87.188.156(7111)\");\n cf.SetIntProperty(XMSC.WMQ_PORT, 7111);\n cf.SetStringProperty(XMSC.WMQ_CHANNEL, \"QMEIGS1.CRM.SVRCONN\");\n cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\n cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"QMEIGS1\");\n cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1);\n\n IConnection conn = cf.CreateConnection();\n Console.WriteLine(\"connection created\");\n ISession sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n IDestination dest = sess.CreateQueue(\"DOX.APYMT.ESB.SSK.RPO.02\");\n IMessageConsumer consumer = sess.CreateConsumer(dest);\n MessageListener ml = new MessageListener(OnMessage);\n consumer.MessageListener = ml;\n conn.Start();\n Console.WriteLine(\"Consumer started\");\n\n\n }\n\n private void OnMessage(IMessage msg)\n {\n ITextMessage textMsg = (ITextMessage)msg;\n Console.Write(\"Got a message: \");\n Console.WriteLine(textMsg.Text);\n }\n\n}\n"}
+{"text": "### Human: I am trying to find some documentation on what is MQSecurityExit and how do we actually implement it in Java. I just have a very little idea on this - like I believe it's for authenticating MQ client to MQ provider. But don't know how this fits in overall security architecture of WebSphere MQ.### Assistant: An exit is a point in the vendor code that calls out to user or 3rd party code to perform custom functions. WebSphere MQ provides security exit points at both the server and at the client. A common use for a security exit is that after authenticating the connection, the exit sets the MCAUSER field in the channel to the user ID that was resolved in the authentication. Authorization is performed against this value.A stand-alone server-side exit can authenticate connections based on data passed in the connection request. The most common items used by a server-side exit are SSL certificate details, user credentials passed from the client and IP connection information.A client/server exit pair can do any arbitrarily complex authentication. For example, the client-side exit can prompt the user for ID and password, encrypt these and then forward to the server-side exit for validation. There is an SSPI exit pair supplied with the Windows version of WMQ that authenticates using Kerberos tokens.Server-side exits must be written in C. In v6.0 and prior versions of WebSphere MQ you were required to write channel exits in C as well. As of v7 it is possible to write channel exits in Java as described in the documentationhere. Note that client channel exits are most useful when paired with a server-side exit. For example, it would not do much good for a client channel exit to supply authentication credentials if there is no server-side exit to do something with them.Additional information on exits is available in theIntercommunications manual.A well known example of a server-side exit isBlockIP2.\n"}
+{"text": "### Human: I got key files from our client where I need to use them to connect to MQ over SSL. The files we have got from client are:xxx.crl \nxxx.kdb \nxxx.rdb \nxxx.sth \nxxx.tabThey said client channel table in that. I am trying to connect using the below code. And they are saying I don't need to specify the Queue Manager it will be defined in the Client Channel Table. But one thing is they have done while created key with the using \"user1\".Code:Hashtable connectionProperties = new Hashtable(); \n\n// Add the connection type \nconnectionProperties.Add(MQC.TRANSPORT_PROPERTY, connectionType); \n\nMQQueueManager qMgr; \n\nMQEnvironment.SSLCipherSpec = \"TRIPLE_DES_SHA_US\"; \nMQEnvironment.SSLKeyRepository = @\"D:\\Cert\\BB\\key\"; \nMQEnvironment.UserId = \"user1\"; \nMQEnvironment.properties.Add(MQC.TRANSPORT_PROPERTY, connectionType); \nqMgr = new MQQueueManager();Error I am getting:Message = \"MQRC_Q_MGR_NAME_ERROR\"I also tried telneting the server which I am able to do.Can some help me what is wrong I am doing here and why I am getting this error.### Assistant: I sloved the issue by setting following env varibles. before the connection.Env varibles are MQCHLLIB,MQCHLTAB,MQSSLKEYR - use Environment.SetEnvironmentVariable - to set values\" /> \n --- Certs location. \n\n - **Make sure you give the refarance of this DLL**After setting all this just call queueManager = new MQQueueManager(); - You should be good.\n"}
+{"text": "### Human: We have messages coming in over a WebSphere MQ queue. It takes a long time before we receive the message.Is there a simple, easy way of tracking when a message gets received/picked up?### Assistant: When the message is put, you can request Confirmation on Delivery. When the message is consumed, a report message is delivered to the Reply-To Queue and Reply-To QMgr that were set in the original message. This is relatively easy if you are using the C or Java procedural interfaces or WMQ v7.0 with any language. The report options are set like any other message option prior to the PUT.http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzak.doc/fr13320_.htmIn the case of JMS and WMQ v7.0 the MQMD properties have all been exposed as JMS Message Properties and you can set or read them that way.http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzaw.doc/jm25500_.htmThere is another, less simple but MUCH more detailed, approach you may consider. The MA0W SupportPac (http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg24010343&loc=en_US&cs=utf-8&lang=en) is a trace exit. This trace has extremely fine control and you can enable it for a single PID, for specific queues or channels, etc. It will give you API timings so you will be able to see whether the time is being spent between API calls or in the API call itself. In other words, did the program wait 10 seconds between API calls or did the GET take 10 seconds to complete? If you are getting messages rolled back due to filling the transaction log and then re-read this can cause delays that are pretty transparent unless you have a trace.\n"}
+{"text": "### Human: Currently, I faced an issue whereby when trying to runmqsc (queue manager name), I achieved an error of AMQ8157: Security Error. Is there any way I can solve this issue?I am running IBM MQ Version 8.0.0.5 on Windows 7 x64 Edition.AMQ8157 appeared in the command prompt asAMQ8157: Security error.However, This was the error which was displayed in the error log.Error Log Message:AMQ8079: Access was denied when attempting to retrieve group membership\ninformation for user 'userdecim@ddgroup.com'.\n\nEXPLANATION:\n\nWebSphere MQ, running with the authority of user 'admin@dd-pc-002',\nwas unable to retrieve group membership information for the specified user.\nACTION:\nEnsure Active Directory access permissions allow user\n'admin@dd-pc-002' to read group memberships for user\n'userdecim@ddgroup'. To retrieve group membership information for a domain user,\nMQ must run with the authority of a domain user and a domain controller must be\navailable.### Assistant: The ACTION in the error explains the problem. The IBM MQ queue manager is running as alocaluseradminon the hostdd-pc-002. The queue manager is trying to retrieve group membership information for thedomainuseruserdecim@ddgroup.com. Because the queue manager is running under alocalaccount it will not have permission to obtain information on adomainuser.If the IBM MQ queue manager will interact withdomainusers and groups, the account which the queue manager processes run under on Windows must be adomainaccount that hasRead group membershipandRead groupMembershipSAMpermissions.See the IBM MQ v8 Knowledge Center page \"Creating and setting up domain accounts for IBM MQ\" for more details.\n"}
+{"text": "### Human: I am using 'c-client' api to access theWebsphere IBM MQ 8. Is it possible to identify the source topic from which the message was published ?### Assistant: To inquire on the topic string, use theMQCRTMHAPI call to obtain a message handle, then inquire the properties of the message using theMQINQMPAPI call specifying theMQTopicStringproperty.MQCRTMH- Create message handleMQINQMP- Property NamesSample IBM MQ procedural programsAdmittedly, it can be difficult to track this info down in the IBM MQ reference documentation, especially if you do not already know the way it works and the names of the calls and fields. One approach that can help is to start with the sample programs to get a basic understanding and then work back into the manuals to fill in the missing details. The sample code is available from the install media by selecting the appropriate optional component.On Windows these end up in{MQM Home}/Toolsand on UNIX systems at{MQM Home}/samp. If the samples are installed,AMQSIQMAwill demonstrate how to inquire properties of a message handle, and is an example of the use of theMQINQMPAPI call.\n"}
+{"text": "### Human: I amd trying put a string message in MQ using pymqi, the code is as follows;import xml.dom.minidom as minidom\nimport pymqi\n\nclass PutMQ:\n def put_mq(args1):\n doc = minidom.parse(args1) \n queue_manager = \"NameQueueManager\"\n channel = \"ChannelName\"\n host = \"HostName\"\n port = \"PortNumber\"\n conn_info = \"%s(%s)\" % (host, port)\n\n qmgr = pymqi.QueueManager(None)\n\n qmgr.connectTCPClient(queue_manager, pymqi.cd(), channel, conn_info)\n\n putq = pymqi.Queue(qmgr, 'QueueName')\n\n\n putq.put(doc.toprettyxml())\n\n putq.close()\n qmgr.disconnect()\n put_mq('C://MQ//myMessage.xml')When I run this code, it doesn't throw any error. Hence, I get the feeling that the message has been put successfully on the required Queue.However, I am expecting to see a record in one of my application screen after I send the above message to the Queue, and this is not happening.If I put the same message through AppWatch (web interface), it works and I see the expected record on the application UI too.On the AppWatch (web interface), when I do the 'Put Message', I mention the message type as : \"String Format (MQFMT_STRING)\".How can I specify in my code that the message format is 'MQFMT_STRING'?Appreciate your help on this.### Assistant: According to thePyMQI Docsthis is the definition of the put call:put(msg[, mDesc, putOpts])Put the string buffer \u2018msg\u2019 on the queue. If the queue is not already open, it is opened now with the option \u2018MQOO_OUTPUT\u2019.mDesc is the pymqi.md() MQMD Message Descriptor for the message. If it is not passed, or is None, then a default md() object is used.putOpts is the pymqi.pmo() MQPMO Put Message Options structure for the put call. If it is not passed, or is None, then a default pmo() object is used.If mDesc and/or putOpts arguments were supplied, they may be updated by the put operation.So in order to set the format you need to supply an MQMD Message Descriptor, themDescparameter on the put call.I haven't tried this out myself, but your code should look something like:md = pymqi.MD()\nmd.Format = CMQC.MQFMT_STRING\nputq.put(doc.toprettyxml(), md, None)\n"}
+{"text": "### Human: I encountered a really wired problem. I have successfully installWebsphere MQon my windows machine and want to createQManagerand Queue to connect to a remoteQmanagerserver. I have already created a QManager as you can see in the picture below. However, when I tried to create a queue for thisQManager, I could not find any expand button as the IBM tutorial mentioned. \nI have already tried to create a queue with MQSC but when I runrunmqscin the command prompt with administrator user, it showsAMQ8135: Not Authorizederror!### Assistant: Check your error logs (AMQERR01.LOG) for an explanation of why AMQ8135 was returned to the client - for security reasons clients aren't given more information and so you have to go to the logs to get the detail.I suspect the user you're running MQ Explorer and runmqsc as isn't in the 'mqm' group, or is otherwise not authorised to connect to the queue manager.\n"}
+{"text": "### Human: I am writing an application in Delphi to connect to remote MQ Server and get messages.I installed a MQ Server on my comp and wrote a test application.All well Connect,Open,Put,Get,.. all works well.Then I tried to connect to remote MQ by changing address, it works but not correctly, it works with local MQ still and get info from local. not switched to other remote server!!!!My source is as bellow, What I should do? Thanksvar\n QMgrName : MQCHAR48;\n ConnectOpts : TMQCNO;\n ClientConn : TMQCD;\n Compcode : MQLONG;\n Reason : MQLONG;\nbegin\n StrPCopy(QMgrName, AQueueManager+#0);\n ConnectOpts.StrucId := MQCNO_STRUC_ID;\n ConnectOpts.Version := MQCNO_VERSION_1;\n ConnectOpts.Options := MQCNO_STANDARD_BINDING;\n ConnectOpts.ClientConnOffset := 0;\n ConnectOpts.ClientConnPtr := @ClientConn;\n\n with ClientConn do begin\n StrPCopy(ClientConn.ConnectionName, format('%s(%s)'#0, [AIP,APort]));\n Version := MQCD_VERSION_6;\n ChannelType := MQCHT_CLNTCONN;\n TransportType := MQXPT_TCP;\n Desc := '';\n QMgrName := '';\n XmitQName := '';\n ShortConnectionName := '';\n MCAName := '';\n ModeName := '';\n TpName := '';\n BatchSize := 50;\n DiscInterval := 6000;\n ShortRetryCount := 10;\n ShortRetryInterval := 60;\n LongRetryCount := 999999999;\n LongRetryInterval := 1200;\n SecurityExit := '';\n MsgExit := '';\n SendExit := '';\n ReceiveExit := '';\n SeqNumberWrap := 999999999;\n MaxMsgLength := 4194304;\n PutAuthority := MQPA_DEFAULT;\n DataConversion := MQCDC_NO_SENDER_CONVERSION;\n SecurityUserData := '';\n MsgUserData := '';\n SendUserData := '';\n ReceiveUserData := '';\n UserIdentifier := '';\n Password := '';\n MCAUserIdentifier := '';\n MCAType := MQMCAT_PROCESS;\n ConnectionName := '';\n RemoteUserIdentifier := '';\n RemotePassword := '';\n MsgRetryExit := '';\n MsgRetryUserData := '';\n MsgRetryCount := 10;\n MsgRetryInterval := 1000;\n HeartbeatInterval := 1;\n BatchInterval := 0;\n NonPersistentMsgSpeed := MQNPMS_FAST;\n StrucLength := MQCD_LENGTH_6;\n ExitNameLength := MQ_EXIT_NAME_LENGTH;\n ExitDataLength := MQ_EXIT_DATA_LENGTH;\n MsgExitsDefined := 0;\n SendExitsDefined := 0;\n ReceiveExitsDefined := 0;\n MsgExitPtr := nil;\n MsgUserDataPtr := nil;\n SendExitPtr := nil;\n SendUserDataPtr := nil;\n ReceiveExitPtr := nil;\n ReceiveUserDataPtr := nil;\n ClusterPtr := nil;\n ClustersDefined := 0;\n NetworkPriority := 0;\n LongMCAUserIdLength := 0;\n LongRemoteUserIdLength := 0;\n LongMCAUserIdPtr := nil;\n LongRemoteUserIdPtr := nil;\n// MCASecurityId := MQSID_NONE_ARRAY;\n// RemoteSecurityId := MQSID_NONE_ARRAY;\n end;\n MQCONNX(@QMgrName, ConnectOpts, HConn,Compcode,Reason);\n if CompCode <> MQCC_OK then\n raise Exception.Create(format('MQCONNX Fail, Completion Code: %d, Reason: %d',[CompCode,Reason]));### Assistant: The code snippet doesn't show theusesstatement. According tothe MA7Q docs,The SupportPac contains two files called 'MQI.PAS' and 'MQIC.PAS'.\n These are Pascal sources that should be placed somewhere in the Search\n Path of Delphi to be included in your Pascal program. The way to\n include it is like using any unit in Pascal:uses MQI;oruses MQIC;TheMQIis the bindings mode (shared memory) connection and theMQICis the client connection over the network stack.It is possible to have both available and let the application determine which to use at run-time. According to theWMQ Infocenter:If you are linking to the mqm library, then a standard server\n connection using the default bind type is attempted first. If the\n underlying server library failed to load, a client connection is\n attempted instead.This suggests to me that you have both libraries in the path and the connection is finding the local QMgr first and ignoring the client connection parameters, or perhaps that you are using the MQI library where you want the MQIC library. Make sure the MQIC library is in the path and change yourusesstatement.If switching the library does not alone solve the problem, consider specifyingMQCNO_CLIENT_BINDINGinstead ofMQCNO_STANDARD_BINDING.\n"}
+{"text": "### Human: Is Extended Transactional Client installed by default? How do I verify if this is installed or not? How do I get this installed?### Assistant: In previous versions of the MQ client, it certainly wasn't included with the standard client (the Transactional Client had cost / licensing implications).However from the date of the announcement of WMQ v7.5 onwards it is now included with the Standard clients at v7.0.1 and up.From theIBM Websphere siteWith the availability of WebSphere MQ V7.5 the capability previously\n delivered within the Extended Transactional Client is incorporated\n into the standard WebSphere MQ client.And in more detail,hereWider access to the Extended Transactional Client for all customers\n The Extended Transactional Client enables customers to configure their\n WebSphere MQ client to participate in a transactional unit of work\n when exchanging messages to an MQ server. Use of this client without\n charge was previously restricted to customers using WebSphere\n Application Server, WebSphere Enterprise Service Bus, or WebSphere\n Process Server as the Transaction Manager. With the announcement of\n WebSphere MQ V7.5, the Extended Transactional Client is available for\n use in all client deployments without additional entitlement. This\n includes all supported versions of WebSphere MQ client connecting to\n any supported version of WebSphere MQ queue manager.With the availability of WebSphere MQ V7.5 the capability previously\n delivered within the Extended Transactional Client is incorporated\n into the standard WebSphere MQ client. Customers using WebSphere MQ\n V7.0.1 and WebSphere MQ V7.1 gain the benefit of use of the Extended\n Transactional Client without charge from the date of this\n announcement. IBM is making available refreshed code including updated\n License Information. Customers can realize this benefit through the\n download and acceptance of this new License Information.\n"}
+{"text": "### Human: My current task in the company is to implement IVY dependency management.\nNow I hit the following libraries that I couldn't find in usual Maven repositories, such ashttp://mvnrepository.com:com.ibm.mq.jarcom.ibm.mq.pcf.jar\n...and so forth (they are all with the prefix: com.ibm.mq).I could found them on a separated website:http://www.java2s.com/But it's not Maven compatible.So, where could I found those? What's the best solution to overcome this?I'm thinking, uploading them manually to the team nexus. But is this the usual procedure in such cases?Thanks a lot in advance.### Assistant: Best place to find those is directly from IBM. Please seethis answerfor the different versions of the WMQ Java/JMS client available.As for the best way to package these, please be aware that if you want IBM to support them you need to install the client code rather than just bundling in the jar files. The reason IBM is reluctant to support non-standard installs should concern you as well if the app is to be installed in Production. The full client includes considerable additional functionality such as diagnostics, trace functions, crypto libs, JSSE, etc. In addition, it is the only install against which you can apply IBM's maintenance.If you install the jars from a 3rd party site such as the one linked above, do you even know what version they are? Has any of the maintenance been applied? Have the latest patches been applied? Since IBM only distributes the full client, and OEMs are not authorized to distribute the jar files except as part of their application, any site offering the WMQ jar files is by definition pirating them.I realize that requiring you to do the full client install is considered burdensome when you are used to being able to just grab some jars and go. On the other hand, if you don't need support then you might install the WMQ Client on a VM somewhere, keep it up to date and grab the jar files from there. That way you have a known-good set of files that are all in sync and to which you canapply maintenance.If you'd like to suggest to IBM that they need a lighter-weight Java solution, feel free to raise the requirement (or vote on it if it already exists) at theIBM Request For Enhancement (RFE) Community.\n"}
+{"text": "### Human: I'm trying to understand how common is the usage of MQ Topics in the industry.\nAnd MQ with SSL?Thanks,\nGuy### Assistant: Pub/SubPrior to v7 of WMQ, Pub/Sub was available either as a separate component of WMQ or as part of the functionality of WebSphere Message Broker. Now in v7 pub/sub is integral to WMQ and allows topic-level security. There is a certain amount of pub/sub adoption that is occurring just because it is now baked into WMQ as native functionality.Another factor influencing uptake on WMQ pub/sub is that more people are being exposed to it through WMQ File Transfer Edition. WMQ FTE makes status of file transfers available as publications and many people with this product are writing applications that monitor these topics to provide a variety of custom functionality. Once they start using pub/sub, many of these shops begin to see other uses for it.Pub/Sub also solves some common problems with messaging such as an application that currently writes to a queue and a new requirement comes up to get a copy of that message to another consumer. Prior to v7, switching an app from writing to a queue to writing to a topic was somewhat invasive and required configuration changes for JMS apps or code changes for other types of code. The simplest way to address the problem was to intercept the message with an application or exit that wrote copies to two or more queues. As of v7 an application that was written for queues can be provided with an alias over a topic. The producer still thinks it is writing to a queue but WMQ is publishing the messages to a topic instead. Consumers can then either subscribe directly or, in the case of legacy code that requires a queue, an administrative subscription can cause the messages on the topic to be delivered to a queue. I am seeing a lot of uptake on pub/sub to address these kinds of requirement.There are also the cases where pub/sub is the appropriate solution and it is used for that reason alone. In the past the requirement for separate components, administrative skill or a WMB license were barriers to adoption that caused a certain portion of pub/sub apps to be reworked as point-to-point. With pub/sub built into WMQ, these barriers are eliminated or at least significantly reduced which leads to more uptake simply because it is the right architecture for the problem at hand.In general, I would say that WMQ pub/sub has gone mainstream with v7. Since v6 end-of-life has been announced for September 2011, there will be a mass migration to v7 this year and subsequently even more adoption of pub/sub as a result.SSL/TLSAs for SSL, WMQ security is approaching mainstream. I wouldn't say SSL is the norm - just yet - but over the last two or three years it is in enough demand that myWMQ Hands-On Security Labsessions at the IMPACT and European WebSphere Technical conferences have had overflow attendance. Irecently wrote...The term \"trusted internal network\"\n was coined to differentiate that part\n of the network that was internal from\n destinations outside the firewall. But\n the term \"trusted\" as used in this\n context is relative. It was not\n supposed to indicate that the internal\n network was trusted implicitly, only\n that it was more trusted than things\n outside the firewall. Unfortunately,\n the term is sometimes interpreted\n quite literally. I have had clients\n quite earnestly tell me by definition\n we trust everything on the \"trusted\n internal network\", that's why we call\n it that. Of course, this overstates\n the case, because even the staunchest\n believers in trusting the internal\n network still enforce password-based\n login to servers, databases, and\n applications. So the internal network\n is trusted, but only up to a point,\n and even on the internal network\n authentication and authorization are\n essential.Although SSL (TLS, actually) channels encrypt, they also authenticate. As more people realize that they need to authenticate WMQ connections on the \"trusted\" internal network, SSL has been a common method of achieving that. Of course, there is also a growing requirement for privacy (encryption) and integrity services on the WMQ channels for both internal and external connections and this is driving adoption of WMQ SSL channels as well.Now that SSL is more common, there are a number of secondary challenges that pop up when people do not fully understand WMQ security. The fact that these are now common topics on theWMQ listserveand onMQSeries.netattests to the level of SSL adoption. Some of these secondary issues are the inclusion of unused Certificate Authority root certs in the QMgr's keystore, or lack of QMgr channel settings like SSLPEER (which filters connections by distinguished name) or MCAUSER (which maps authorizations to a specific user account). Frequently people enable SSL but overlook one or more of these other settings and do not achieve the level of security they had intended. Since you must have enabled SSL for these things to present an issue, it is as a friend of mine says \"a luxury problem.\" It is much better to be challenged by SSLPEER settings than not to have applied SSL at all.In summary...So I suppose the short answer to both of these questions is that use of pub/sub and SSL in WMQ is quite common. Both are on a sharp upward trend right now and if I were writing new applications I would definitely use SSL and would not hesitate to use WMQ pub/sub where called for.\n"}
+{"text": "### Human: How do i convert/lookup a reason code of IBM Websphere MQseries to its explanation (for logging etc)?### Assistant: Please seeSupportPac MA0Kwhich has C and Visual Basic code to perform this task.\n"}
+{"text": "### Human: I am running a simple Java client to connect to a remote MQ queue.When I run the Java code to read write messages with Alias queue name, it works fine.When i try to run the code on the same queue but witha a physical queue name (Because i wish to invoke getQueueDepth), I get a 2035 error at the point when the code tries to establish a connectionThe authority on the queue are:\nbrowse +dsp +get +inq +put +set +setallThe java code is as underimport com.ibm.mq.MQC;\nimport com.ibm.mq.MQEnvironment;\nimport com.ibm.mq.MQException;\nimport com.ibm.mq.MQGetMessageOptions;\nimport com.ibm.mq.MQMessage;\nimport com.ibm.mq.MQPutMessageOptions;\nimport com.ibm.mq.MQQueue;\nimport com.ibm.mq.MQQueueManager;\npublic class MQSniffer {/**\n * @param args\n */\n/**\n * @param args\n */\npublic static void main(String[] args) {\n String hostname = \"XXXX\"; \n String channel = \"CHANNEL\"; \n String qManager = \"qmgr\"; \n\n MQQueueManager qMgr; \n\n\n MQEnvironment.hostname = hostname; \n MQEnvironment.channel = channel; \n MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);\n\n try { \n qMgr = new MQQueueManager(qManager); \n\n int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE | MQC.MQOO_OUTPUT ;\n\n MQQueue system_default_local_queue = \n qMgr.accessQueue(\"PHYSICAL_QUEUE_NAME\", // *****Get an exception on this call*****\n openOptions, \n null, \n null, \n null); \n\n System.out.println(\"****Current Depth is \"+ system_default_local_queue.getCurrentDepth());\n\n MQMessage hello_world = new MQMessage(); \n hello_world.writeUTF(\"Hello World!\"); \n\n\n MQPutMessageOptions pmo = new MQPutMessageOptions(); \n\n\n system_default_local_queue.put(hello_world,pmo); \n System.out.println(\"Put the message\");\n\n\n system_default_local_queue.close(); \n\n // Disconnect from the queue manager \n\n qMgr.disconnect(); \n\n } \n\n catch (MQException ex) \n { \n System.out.println(\"An MQSeries error occurred : Completion code \" + \n ex.completionCode + \n \" Reason code \" + ex.reasonCode); \n\n ex.printStackTrace();\n } \n catch (java.io.IOException ex) \n { \n System.out.println(\"An error occurred whilst writing to the message buffer: \" + ex); \n } \n\n\n\n}}om.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2035\n at com.ibm.mq.MQQueueManager.accessQueue(MQQueueManager.java:2858)\n at org.ku.benchmarkos.MQSniffer.main(MQSniffer.java)Any help is appreciated!Thanks\nJ### Assistant: WMQ checks permissions on the first object encountered. So if you open an alias, the permissions are checked on the alias and not the base queue. If you open a base queue, the permissions are checked on the base queue and not on any aliases that may point to it. There is no expectation that the ability to open an alias implies an ability to open the base queue. One would need to run setmqaut against both the alias and the base queue with the appropriate permissions.I have a longer explanation posted here:Understanding WebSphere MQ authorization and the setmqaut command.\n"}
+{"text": "### Human: I have an application that uses WebSphere MQ Java API along with a configuration (xml) file to access MQ. I would like to migrate to WebSphere JMS API. For this i try creating \n1) WebSphere MQ Queue Connection factory and 2) WebSphere MQ Queue destinations from my local WAS. When i configure my Queue destinations and try to set my MQ Config parametes i get an error message like \"WMSG0316E: You tried to view a Queue that was not a local Queue. Only administration of local Queues is supported.\"The message is correct in the sense that i am trying to connect to a remote queue. Now, cant i configure my WAS as an MQ client trying to connect to a remote Queue ? The MQ Client has the necessary MQ JMS jars in the server classpath.Would appreciate if anyone could throw some light into this.### Assistant: I'm working on this same issue - I've found articles where the authors confirm that WebSphere has to be told that \"client to remote queue\" mode is desired, but I have yet to find details on how to do that, beyond one author mentioning an environment variable.Still searching ... I'll post the solution if I find one.\n"}
+{"text": "### Human: We are trying to set up a jms connection from tomcat toward IBM MQSeries, with the concern to make connection pooling.We have followed the link below, with the solution suggested :WebSphere MQ connection pooling with TomcatI don't know how we can manage the different jms connections with the method suggested, we have made tests, and we have noticed that CachingConnectionFactory manage different jms session and not jms connection.I share with you the link below, in which it is explained that CachingConnectionFactory does not allow to manage different jms connection but just jms sessions !https://jira.spring.io/browse/SPR-13586I also share with you , both files context.xml (datasource and services.xml (spring services file)context.xml\n\nservices.xml\n\n \n \n\n\n\n\n \n \n\n\n\n \n \n \n\n\n\n\n\n \n \n \n \n \nBest regards.### Assistant: SummaryYou need to either upgrade to a later version of the MQ classes for JMS or have your MQ admin increase the MAXINST/MAXINSTC settings to allow more channel instances.Note the version you are using has been out of support since 2012 so I would recommend upgrading.Product Version Release End of Service\n============ ======= ========== =================\nWebsphere MQ 6.0 2005-06-24 2012-09-30BACKGROUND INFO FROM COMMENTSBased on what you provided in comments the following information is known about your current setup:IBM MQ Server version: 8.0.0.? (specific maintenance level unknown)\nIBM MQ jar names: mq-7.0.0.jar and mqjms-7.0.0.jar\nIBM MQ jar version: 6.0.2.11\nSVRCONN Channel settings: SHARECNV(10) MAXINST(9) MAXINSTC(9)Note that even though the jar files have names that contain the string 7.0.0, they are actually from IBM MQ v6.0.2.11 (technically it was called Websphere MQ at that time).The other StackOveflow question \"WebSphere MQ connection pooling with Tomcat\" you point to is referencing the fact that the IBM MQ prior to v7.0 (for example v6.0) provided connection pooling, but this was removed at MQ v7.0, and was asking how to get similar functionality at v7.0 and later.The v6 connection pooling was the default in MQ v6.0 JMS as described on page 504 of the \"WebSphere MQ Using Java Version 6.0\" manual:setUseConnectionPoolingpublic void setUseConnectionPooling(boolean usePooling);Chooses whether to use connection pooling. If you set this to true,\n JMS enables connection pooling for the lifetime of any connections\n created through the ConnectionFactory. This also affects connections\n created with usePooling set to false; to disable connection pooling\n throughout a JVM, ensure that all ConnectionFactories used within the\n JVM have usePooling set to false.In the fact that the connection pooling was removed in MQ v7 is documented in the IBM MQ v8.0 Knowledge Center pageDeveloping applications>Developing JMS and Java Platform, Enterprise Edition applications>Using IBM MQ classes for JMS>IBM MQ classes for JMS>Class MQConnectionFactorysetUseConnectionPoolingpublic void setUseConnectionPooling(boolean usePooling)Deprecated. JMS does not use connection pooling anymore.Any connection pooling\n should be done using the facilities provided by the App Server. Set the use of\n ConnectionPooling in earlier versions of the WebSphere MQ classes for\n JMS.This method is retained for compatibility with older MQJMS\n applications, but, because this Connection Pooling functionality has\n been removed from version 7, setting this property will have no\n effect.To explain the behavior you see today you also need to to know about MQ Client channel shared conversations behavior that was added in MQ v7.0, you can read about this in the IBM MQ v8.0 Knowledge Center pageMigrating and upgrading>Introduction to IBM MQ migration>Coexistence, compatibility, and interoperability>MQI client: Default behavior of client-connection and server-connection channels. Quoting a few specifics below:In Version 7.0 the default settings for client and server connection\n channels changed to use shared conversations. This change affects the\n behavior of heartbeats and channels exits, and can have an impact on\n performance.Before Version 7.0, each conversation was allocated to a different\n channel instance. From Version 7.0, the default for client and server\n connections is to share an MQI channel. You use the SHARECNV (sharing\n conversations) parameter to specify the maximum number of\n conversations that can be shared over a particular TCP/IP client\n channel instance. The possible values are as follows:SHARECNV(0)This value specifies no sharing of conversations over a TCP/IP socket. The channel instance behaves exactly as if it was a Version\n 6.0 server or client connection channel, and you do not get the extra features such as bi-directional heartbeats that are available when you\n set SHARECNV to 1 or greater. Only use a value of 0 if you have\n existing client applications that do not run correctly when you set\n SHARECNV to 1 or greater.Putting this all together, you have a SVRCONN channel with the following settings:SHARECNV(10)MAXINST(9)MAXINSTC(9)These settings when used with a MQ v7.0 and later client would mean that you could have 9 channel instances (TCP connections) between the client and queue manager and each of those could have 10 shared conversations for a total max of 90 conversations.Because you are using MQ v6.0 classes for JMS the channel is operating as if the setting were:SHARECNV(0)MAXINST(9)MAXINSTC(9)This means that can have 9 channel instances (TCP connections) between the client and the queue manager and each of those supports only a single conversation.At MQ v6.0 classes for JMS each underlying JMS connection and every JMS session that is created on top of the JMS connection will allocate a channel instance to the queue manager.To understand more about how connection and sessions interact with each other and with the SHARECNV setting look at the IBM MQ v8.0 Knowledge Center pageDeveloping applications>Developing JMS and Java Platform, Enterprise Edition applications>Using IBM MQ classes for JMS>Writing IBM MQ classes for JMS applications>Accessing IBM MQ features>Sharing a TCP/IP connection in IBM MQ classes for JMS:Every JMS connection and JMS session that is created by a JMS application creates its own conversation with the queue manager.In your case because you are using MQ v6.0 classes for JMS each \"conversation\" is a MQ channel instance (TCP connection) to the queue manager.I would recommend you get a current IBM MQ classes for Java version to use, this would then allow you to have up to 90 shared conversations. If contention is an issue you would need to have your MQ admin increase theMAXINST/MAXINSTCsettings and decreaseSHARECNV.ForIBM MQ Classes for JMSyou can find the list of files required on the IBM MQ v9 Knowledge Center page \"What is installed for IBM MQ classes for JMS\":Relocatable JAR filesWithin an enterprise, the following files can be moved to systems that need to run IBM MQ classes for JMS:com.ibm.mq.allclient.jarcom.ibm.mq.traceControl.jarjms.jarfscontext.jarproviderutil.jarThe Bouncy Castle security provider and CMS support jarsThe fscontext.jar and providerutil.jar files are required if your application performs JNDI lookups using a file system context.The Bouncy Castle security provider and CMS support jar files are required. For more information, see Support for non-IBM JREs.Note that onlycom.ibm.mq.allclient.jar,jms.jar, and the Bouncy Castle security provider and CMS support jars are included in the Redistributable client, but all are included in Java All client. You are also running 9.0.0.0 and I would recommend you go to 9.0.0.5. You can find both the Redistributable and Java All clients onFix Central.\n"}
+{"text": "### Human: We have a IBM MQ v8 setup setup with 1 high volume non-persistent queue and many consumers (50+) on that queue. The large number of consumers is needed to be able to process the volume of messages being published on the queue.What we now notice is that the queue manager is not distributing the messages evenly over the X consumers. A few consumers get up to 300 message per minute, while many other consumers only get a few messages per minute (<10). And, there are many messages on the queue and the queue depth is steadily increasing. CPU and memory on the consumer side are not a problem, utilization of both is < 50%.Can someone explain how IBM MQ queue manager is distributing messages over multiple consumers? And is it possible to influence this either on server or on consumer side such that messages are distributed more evenly over the available consumers?Added after Mark Taylors responseThe challenge we face is that there are >10.000 messages added to the queue per minute and we're not able to consume them fast enough. Our current setup is that we have a simple consumer that is running in a Docker container and we scale by running multiple Containers. Running 12 consumers (Docker containers) does increase the overall throughput, running 50+ consumers does not add any throughput. Each consumer is simple:1. connect to queue manager\n2. Connect to queue\n3. While true\n - Get message from queue\n - Process message (commenting this out does not increase overall performance)How can we get achieve more message consume performance? Would it for example help if within one container we connect to the queue manager once and then have multiple threads use that same queue manager to connect to the queue and get the messages? Or should we even reuse the queue over multiple threads?Regards,Gero### Assistant: MQ's default behaviour is to give messages to the MOST RECENT getter. That generally improves performance as that process is most likely to be \"hot\" (in the processor cache). So you should not expect equal distribution of messages. If you are seeing one application getting most messages that implies that it is regularly getting through processing one message before another is available for retrieval. It is rejoining the queue of waiters before the next message is available.There are many aspects that affect overall performance including transactionality, retrieval criteria, contention etc so it's not really possible to say what your problem is, or whether changing that default distribution algorithm (there is an undocumented tuning parm that reverses the queue of waiters) would help. And having client connections where the waiting is really being done by the \"proxy\" svrconn processes and threads makes it more complicated.\n"}
+{"text": "### Human: I am trying to connect to IBM MQ using JMS and client channel definition table (CCDT). I was able to connect successfully to the QueueManager when i specify the MQ properties individually.\nBut when i try to use CCDT file i get the below exception.As client channel definition table (CCDT) is used to determine the channel definitions used by client applications to connect to the queue manager i didnt set QueueManager Name.ERROR> com.ssc.ach.mq.JMSMQReceiver[main]: errorMQJMS2005: failed to create MQQueueManager for ''\njavax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for ''\n at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:586)\n at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2110)\n at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1532)\n at com.ibm.mq.jms.MQQueueConnection.(MQQueueConnection.java:150)\n at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:174)\n at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:1066)Iam using the.setCCDTURL(ccdt);method to set the CCDT URL.private MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n mqQueueConnectionFactory.setCCDTURL(ccdt);\n queueConnection = mqQueueConnectionFactory.createConnection(username, pwd);When i try to connect using below configuration instead of the CCDT file it connects to the MQ.mqQueueConnectionFactory.setHostName(host);\n mqQueueConnectionFactory.setChannel(channel);\n mqQueueConnectionFactory.setPort(port);\n mqQueueConnectionFactory.setQueueManager(qManager);\n mqQueueConnectionFactory.setTransportType(1);Do i need to set setQueueManager as well along with the CCDT file , as the exception saysfailed to create MQQueueManager for ''### Assistant: The CCDT is not meant to be read in a text editor, it is a binary formatted file. One of the parameters in the CCDT for eachCLNTCONNchannel isQMNAME. Knowing whatQMNAMEis set to and how manyCLNTCONNchannels you have defined in the CCDT and what you want to accomplish will help figure out what value if any should be specified for withsetQueueManager.If there is only oneCLNTCONNchannel then you could specify the following and it will connect using the single channel no matter what the QMNAME property is set to:setQueueManager(\"*\");If there is more than oneCLNTCONNchannel in the file each with a differentQMNAMEspecified, assuming the name matches the actual queue manager name listening on the host and port associated with the channel you would pass the queue manager name:setQueueManager(\"QMGRNAME\");If there is more than oneCLNTCONNchannels in the file each with the sameQMNAMEspecified where this name is not meant to reflect a actual queue manager name listening on the host and port associated with each channel, this is known as a queue manager group, this would be intended where you want the client to connect to any number of different hosts and ports and you do not need to know which queue manager you are connecting to, in this case you would pass the queue manager group name prefixed with a*:setQueueManager(\"*QMGRGROUPNAME\");Another variation of the above is if there is more than oneCLNTCONNchannels in the file each with an all blank (spaces) or NULLQMNAMEspecified, this is known as a queue manager group, this would be intended where you want the client to connect to any number of different hosts and ports and you do not need to know which queue manager you are connecting to, in this case you would pass the queue manager name as either a single spaceor nothing at all ``:setQueueManager(\" \");\n//or\nsetQueueManager(\"\");The last use case above would likely work if you did not use setQueueManager at all.If you want to view the contents of the CCDT, you can use the runmqsc command that comes as part of the MQ v8 and higher client or server install.For Unix ksh/bash shells use the following:export MQCHLLIB=PATH/OF/CCDT\nexport MQCHLTAB=NAME_OF_CCDT\nrunmqsc -nFor Windows use the following:set MQCHLLIB=PATH/OF/CCDT\nset MQCHLTAB=NAME_OF_CCDT\nrunmqsc -nOnce the runmqsc program has started and displayedStarting local MQSC for 'NAME_OF_CCDT'.you can run the following command to see the channel details:DIS CHL(*)Below is a more specific command to narrow the number of fields returned:DIS CHL(*) QMNAME CONNAME\n"}
+{"text": "### Human: How should the following userid/password property expressions translated into blueprint \"bean\" notation?MQQueueConnectionFactory connectionFactory = new MQQueueConnectionFactory();\n\nconnectionFactory.setBooleanProperty(WMQConstants.CAPABILITY_USERNAME_PASSWORD, true); //XMSC_CAPABILITY_USERNAME_PASSWORD\nconnectionFactory.setStringProperty(WMQConstants.USERID, \"admin\"); //\"XMSC_USERID\"\nconnectionFactory.setStringProperty(WMQConstants.PASSWORD, \"passw0rd\"); //XMSC_PASSWORDWhen deploying to JBoss Fuse, the camel-route.xml (blueprint) chokes on the userid, password part...\n\n\n \n \n aaa.bbb.ccc*\n \n \n\n \n\n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n \n \nQUESTION: How should the above user and password properties be written as proper blueprint \"bean\" property notation?please note:the java code, when run in a standalone client works fine. -Apparently, \"WMQConstants.USERID\" resolves to \"XMSC_USERID\"... -at least according to my NetBeans debugger. :-)On deploy getting the following error...org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to find property descriptor XMSC_USERID on class com.ibm.mq.jms.MQQueueConnectionFactorySOLUTION FOUND! :-)NOTE: I did not receive a direct answer as to how to convert the java property setter statements in to blueprint \"beans\". But, thanks to help/postings from generous individuals, I arrived at the working solution, below...:I included relatively full code/context, i.e., to enable others to arrive at the solution more quickly than I did :-)aaa.bbb.ccc.CamelRestRoutes.javapackage aaa.bbb.ccc;\n\nimport org.apache.camel.builder.RouteBuilder;\nimport org.apache.camel.model.rest.RestBindingMode;\n\npublic class CamelRestRoutes extends RouteBuilder {\n\n public CamelRestRoutes() {\n }\n\n @Override\n public void configure() throws Exception {\n\n restConfiguration().component(\"restlet\")\n .host(\"localhost\")\n .port(8182)\n //.bindingMode(RestBindingMode.json_xml);\n .bindingMode(RestBindingMode.json);\n\n rest(\"/service\")\n //.bindingMode(RestBindingMode.json_xml)\n .bindingMode(RestBindingMode.json)\n .get(\"/getAll\")\n .produces(\"application/json\")\n .to(\"direct:thingX\");\n\n from(\"direct:thingX\")\n .to(\"bean:camelRestService?method=getAll\")\n .log(\"---------------------- (AAA) ----------------------> direct:thingX...:\" + body().toString())\n .to(\"direct:thingY\");\n\n from(\"direct:thingY\")\n .log(\"---------------------- (BBB) ----------------------> direct:thingY...:\" + body().toString())\n .to(\"direct:thingZ\");\n\n from(\"direct:thingZ\")\n .log(\"---------------------- (CCC) ----------------------> direct:thingZ...:\" + body().toString())\n .to(\"wmq:queue:mylocalqueue?jmsMessageType=Text&exchangePattern=InOnly\"); \n }\n}aaa.bbb.ccc.CamelRestService.javapackage aaa.bbb.ccc;\n\nimport aaa.bbb.ccc.model.CamelRestPojo;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.ws.rs.core.MediaType;\n\n@Path(\"/service/\")\npublic class CamelRestService {\n\n Map itemMap = new HashMap<>();\n\n public CamelRestService() {\n init();\n }\n\n @GET\n //@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})\n @Produces({MediaType.APPLICATION_JSON})\n @Path(\"/getAll/\")\n public Collection getAll() {\n System.out.println(\"====================== (getAll) ---------------------->\");\n return itemMap.values();\n }\n\n final void init() {\n System.out.println(\"---------------------- (init) ---------------------->\");\n CamelRestPojo o = new CamelRestPojo();\n o.setName(\"JOE BLOW\");\n o.setId(100);\n itemMap.put(o.getId(), o);\n }\n}aaa.bbb.ccc.model.CamelRestPojopackage aaa.bbb.ccc.model;\n\nimport java.io.Serializable;\npublic class CamelRestPojo implements Serializable {\n\n private long id;\n private String name;\n\n public long getId() {\n return id;\n }\n public void setId(long id) {\n this.id = id;\n }\n\n public String getName() {\n return name;\n }\n public void setName(String name) {\n this.name = name;\n }\n\n @Override\n public String toString() {\n return \"CamelRestPojo{\" + \"id=\" + id + \", name=\" + name + '}';\n }\n}camel-route.xml\n\n \n \n aaa.bbb.ccc\n \n \n\n \n\n \n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n\n \n \n \npom.xml\n\n 4.0.0\n\n aaa.bbb.ccc\n camelRest\n 1\n bundle\n camelRest\n camelRest\n\n \n UTF-8\n true\n 8.0.0.7\n \n\n \n \n org.slf4j\n slf4j-log4j12\n 1.7.25\n provided \n \n \n org.slf4j\n slf4j-api\n 1.7.25\n provided \n \n \n org.apache.camel\n camel-core\n 2.17.0\n provided\n \n \n org.apache.camel\n camel-restlet\n 2.17.0 \n provided \n \n \n org.apache.camel\n camel-cxf\n 2.17.0\n provided \n \n \n com.ibm.mq\n allclient\n ${mq.version}\n provided \n \n \n com.ibm.mq\n jms\n ${mq.version}\n provided\n \n\n \n\n \n ${project.artifactId}-${project.version}\n\n \n \n src/main/resources\n true\n \n \n\n \n \n org.apache.maven.plugins\n maven-compiler-plugin\n 3.1\n \n 1.8\n 1.8\n true\n \n \n \n org.apache.felix\n maven-bundle-plugin\n 3.3.0\n true\n \n \n ${project.groupId}.${project.artifactId}\n aaa.bbb.ccc* \n * \n \n \n \n \n \nhere is the contents of the jboss fuse \"deploy\" folderC:\\tools\\jboss-fuse-6.3.0.redhat-187\\deploy>dir\n Volume in drive C is OSDisk\n Volume Serial Number is D89B-75DE\n\n Directory of C:\\tools\\jboss-fuse-6.3.0.redhat-187\\deploy\n\n08/17/2017 01:49 PM .\n08/17/2017 01:49 PM ..\n08/17/2017 01:49 PM 7,975 camelRest-1.jar\n06/29/2017 01:00 AM 159,649 com.ibm.mq.osgi.allclientprereqs_8.0.0.7.jar\n06/29/2017 01:00 AM 8,011,749 com.ibm.mq.osgi.allclient_8.0.0.7.jar\n06/29/2017 01:00 AM 4,088,715 com.ibm.mq.osgi.java_8.0.0.7.jar\n06/29/2017 01:00 AM 171,064 com.ibm.msg.client.osgi.commonservices.j2se_8.0.0.7.jar\n06/29/2017 01:00 AM 48,715 com.ibm.msg.client.osgi.jms.prereq_8.0.0.7.jar.DISABLE\n06/29/2017 01:00 AM 639,807 com.ibm.msg.client.osgi.jms_8.0.0.7.jar\n06/29/2017 01:00 AM 216,218 com.ibm.msg.client.osgi.nls_8.0.0.7.jar\n06/29/2017 01:00 AM 279,861 com.ibm.msg.client.osgi.wmq.nls_8.0.0.7.jar\n06/29/2017 01:00 AM 92,406 com.ibm.msg.client.osgi.wmq.prereq_8.0.0.7.jar\n06/29/2017 01:00 AM 7,963,226 com.ibm.msg.client.osgi.wmq_8.0.0.7.jar\n09/15/2016 04:19 AM 873 README\n 12 File(s) 21,680,258 bytes\n 2 Dir(s) 143,871,660,032 bytes free\n\nC:\\tools\\jboss-fuse-6.3.0.redhat-187\\deploy>other notes...fwiw, I had add following features: \n\n -camel-jackson\n -camel-restlet\n\n(I'm sure your \"mileage will vary\" as you tinker to make your IBM MQ app work, etc)\n\nAlso, fwiw, running: \n features:list | grep \"jms\" \nyields....\n\n JBossFuse:karaf@root> features:list | grep \"jms\"\n [installed ] [2.4.0.redhat-630187 ] jms karaf-enterprise-2.4.0.redhat-630187 JMS service and commands\n [installed ] [2.17.0.redhat-630187 ] camel-jms camel-2.17.0.redhat-630187\n [uninstalled] [2.17.0.redhat-630187 ] camel-sjms camel-2.17.0.redhat-630187\n [uninstalled] [3.1.5.redhat-630187 ] cxf-transports-jms cxf-3.1.5.redhat-630187\n [uninstalled] [2.1.0.redhat-630187 ] switchyard-jms switchyard-2.1.0.redhat-630187\n [uninstalled] [2.1.0.redhat-630187 ] switchyard-quickstart-bpel-jms-binding switchyard-2.1.0.redhat-630187\n [uninstalled] [2.1.0.redhat-630187 ] switchyard-quickstart-camel-jms-binding switchyard-2.1.0.redhat-630187\n [uninstalled] [2.1.0.redhat-630187 ] switchyard-demo-security-propagation-jms switchyard-2.1.0.redhat-630187\n [uninstalled] [1.1 ] jms-spec activemq-core-5.11.0.redhat-630187 JMS spec 1.1 libraries\n [installed ] [2.0 ] jms-spec activemq-core-5.11.0.redhat-630187 JMS spec 2.0 libraries\n [uninstalled] [1.1 ] jms-spec-dep activemq-core-5.11.0.redhat-630187 JMS spec 1.1 dependency\n [installed ] [2.0 ] jms-spec-dep activemq-core-5.11.0.redhat-630187 JMS spec 2.0 dependency\n [uninstalled] [5.11.0.redhat-630187 ] activemq-jms-spec-dep activemq-core-5.11.0.redhat-630187 ActiveMQ broker libraries\n [installed ] [3.2.16.RELEASE_1 ] spring-jms spring-2.4.0.redhat-630187 Spring 3.2.x JMS supportSpecial thank you to all who helped me on the pain-staking journey that landed this solution! :-)### Assistant: XMSis IBM's implementation of a JMS like interfaces in non-Java languages like C# and C++. XMS constants would not be present in the IBM MQ Classes for JMS libraries.I took your sample and changed the names of some of the beans and wrapped theMQQueueConnectionFactorywithorg.springframework.jms.connection.UserCredentialsConnectionFactoryAdapterto pass the credentials.UPDATE:In reading the source for Apache Camel'sorg.apache.camel.component.jms.JmsComponentit appears that if it is provided with a username and password it will wrap the connection factory with UserCredentialsConnectionFactoryAdapter automatically.Try with the following changes:\n \n \n \n \n \n \n\n\n \n \n\n\n\n \n \n \n\n"}
+{"text": "### Human: As part of the installation of our application, I need to put a bunch of xml messages into an MQ queue. To make it more complicated, the messages need to have the usr-folder of the RFH2-header set.I found thatmqput2.exefrom the IBM RFHUtil is an ideal tool for this task. Unfortunately, I have been unable to make setting of the usr-folder work, the documentation is too vague. What am I doing wrong? Or, is there another command-line tool available that works better?My prop. file formqput2looks like this:[header]\n.....\n*\n* message type\n*\n* Allowed values for message type\n* 1 - request\n* 2 - reply\n* 4 - report\n* 8 - datagram\n* 112 - MQE fields from MQE\n* 113 - MQE fields\n* 65536 to 999,999,999 - user\nmsgtype=8\n.....\n*\n* rfh usage\n* rfh = N for No rfh\n* rfh = A for Automatic (look for RFH at beginning of data file)\n* rfh = 1 or V1 for Version 1 rfh from parameters in parm file\n* rfh = 2 or V2 for Version 2 rfh from parameters in parm file\n* rfh = X for special V2 rfh with fixed portion only and format=xml\n*\n* only first character checked, except for V when second character is also checked\n*\nrfh=X\n\n\n RDS.Codebook.Changes\n\n.....\n[filelist]\nfile1.xmlmqput2simply ignores thesection and doesn't include it with the message. I've also triedrfh=Aand put thesection at the beginning of thefile1.xmlfile, but then I get MQPUT errorreason=2142(invalid MQ header structure).### Assistant: Also dmpmqmsg utility, which is part of the WMQ8 installation, can be used for sending the messages from command-line. A message can be exported from a queue including the headers viadmpmqmsg -m queue_manager> -I -f -aand then submitted again via (I think, consult the docs)dmpmqmsg -m queue_manager> -o -f This utility is however not part of WMQ 7.5.\n"}
+{"text": "### Human: I'm using simple Spring JmsTemplate to send messages onto a MQ.\n \n \n \n \n false\n \n \n 1000\n \n\n\n This works fine, however, My client application isn't able to process the message as the message format is in 'MQHRF2' by default.\nHow can I alter my MQ headers so as to send explicitly MQSTR format.Thanks in advance.### Assistant: You must set the property targetcllient=1 to send the msg as MQSTR.\nTo do this in sending part of java code, change the queue name as belowString senderQ = \"queue:///MYQUEUENAME?targetClient=1\";\njmsTemplate.send(senderQ, new MessageCreator() {\n public Message createMessage(Session session) throws JMSException {\n TextMessage message = session.createTextMessage(text);\n message.setJMSReplyTo(replyToQ);\n return message;\n }\n});Alternatively you can try setting this in jmstemplate bean\n \n \n \n\n"}
+{"text": "### Human: I have a MQ spring jms application that has been working fine using SSL channel. However after a recent java security patch that was applied the application stopped working with below error.Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2397' ('MQRC_JSSE_ERROR').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209) ~[com.ibm.mqjms-7.5.0.0.jar:7.5.0.0 - p000-L120604]\n ... 45 common frames omitted\nCaused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)\n at sun.security.ssl.Handshaker.activate(Handshaker.java:438) ~[na:1.6.0_34]\n at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1414) ~[na:1.6.0_34]I notice that the new java security file has this line added that is causing this failure in SSL connection to MQ.jdk.tls.disabledAlgorithms=SSLv3I can not get this line removed as this is shared environment, what are my options to make this work. I am using MQQueueConnectionFactory configured and injected into my spring JMS components.Thank you### Assistant: Can you not use this -java.security.Security.setProperty(\"jdk.tls.disabledAlgorithms\",\"\")This change was introduced in JDK8.\n"}
+{"text": "### Human: we have a major problem with many of our Applications making improper connections (SVRCONN) with queue manager and not issuing MQDISC when connection not required. This causes lot of idle stale connections and prevents Application from making new connections and fails with CONNECTION BROKEN (2009) error. We have been restricting Application connections with clientidle parameter in our Windows MQ on version 7.0.1.8 but when we migrated to MQ v7.5.0.2 in Linux platform we are deciding on the best option available in the new version. We do not have clientidle anymore in ini file for v7.5 but has DISCINT & KAINT in SVRCONN channels. I have been going through the advantages and disadvantages of both for our scenario of Application making connections through SVRCONN channels and leave connections open without issuing a disconnect. Which of these above channel attributes is ideal for us. Any suggestions? Does any of these take precedence over the other??### Assistant: First off,KAINTcontrols TCP functions, not MQ functions. That means for it to take effect, the TCPKeepalivefunction must be enabled in theqm.iniTCP stanza. Nothing wrong with this, but the nativeHBINTandDISCINTare more responsive than delegating to TCP. This addresses the problem that the OS hasn't recognized that a socket's remote partner is gone and cleaned up the socket. As long as the socket exists and MQ's channel is idle, MQ won't notice. When TCP cleans the socket up, MQ's exception callback routine sees it immediately and closes the channel.Of the remaining two,DISCINTcontrols the interval after which MQ will terminate an idle butactivesocket whereasHBINTcontrols the interval after which MQ will shut down an MCA attached to anorphansocket. Ideally, you will have a modern MQ client and server so you can use both of these.TheDISCINTshould be a value longer than the longest expected interval between messages if you want the channel to stay up during the Production shift. So if a channel should have message traffic at least once every 5 minutes by design, then aDISCINTlonger than 5 minutes would be required to avoid channel restart time.TheHBINTactually flows a small heartbeat message over the channel, but only will do so ifHBINTseconds have passed without a message. Thsi catches the case that the socket is dead but TCP hasn't yet cleaned it up.HBINTallows MQ to discover this before the OS and take care of it, including tearing down the socket.In general, really low values forHBINTcan cause lots of unnecessary traffic. For example,HBINT(5)would flow a heartbeat every five second interval in which no other channel traffic is passed. chances are, you don't need to terminate orphan channels within 5 seconds of the loss of the socket so a larger value is perhaps more useful. That said,HBINT(5)would cause zero extra traffic in a system with a sustained message rate of 1/second - until the app died, in which case the orphan socket would be killed pretty quick.For more detail, please go to theSupportPacs pageand look for the Morag's \"Keeping Channels Running\" presentation.\n"}
+{"text": "### Human: I am having a ongoing problem trying to create a topic publisher from seemingly simple java code. My WMQ is administered separately in the company so I have no direct control of it.I try to connect to the topic by creating aTopicConnection, then aTopicSessionand then aTopicPublisher, using fairly standard Java code albeit over SSL so setting some additional system props. However I have the same problem with or without SSL I am fairly certain.On the linethis.topicPublisher = this.topicPublisherSession.createPublisher(this.topic);a WMQ exception is raised as followsCaused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').\nat com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209)The WMQ administrator can provide a \"fix\" for me by granting auths on theSYSTEM.BASE.TOPIC. However this is disallowed by company risk policy.I have been asked why do I need access to the base topic, but of course I do not need that access. I just simply need to publish to my topic.Any WMQ experts got any other ideas please?\nThanks so much.### Assistant: MQ maintains a Topic Tree for managing publish/subscribe. By default access for non-admin users to the topic tree is not allowed. The root of the topic tree resolves attributes from SYSTEM.BASE.TOPIC.When an application attempts to create a publisher with a topic, MQ makes authority checks using the topic string specified. MQ searches the topic tree for a node that matches the given topic string. If a match is found, authority to publish or subscribe is determined. If the user has enough authority, then create publisher call will succeed. If no nodes match, then MQ goes up to the root of the topic tree to determine authority.In your case, your application has specified a topic string that does not match any of the nodes defined in the topic tree. MQ attempted to determine authority at the root. Since you do not have the publish authority, the call is failing with 2035 reason code.So what can be done? Instead of providing access to SYSTEM.BASE.TOPIC, ask your administrator create a topic with topic string your application is using and provide youpublishauthority.\n"}
+{"text": "### Human: Getting below error with MQ(Message Queue), how to resolve this?Message : com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ1107: A problem with\nthis connection has occurred. An error has occurred with the WebSphere MQ JMS\nconnection. Use the linked exception to determine the cause of this error.Caused by [1] -->Message : com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with\ncompcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN').Caused by [3] -->Message : com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009;AMQ9208: Error on receive\nfrom host '/xx.xx.xx.xx:xxxx\n(emb701t7.dci.bt.com)'. [1=-1,2=ffffffff,3=/xx.xx.xx.xx:xxxx\n(emb701t7.dci.bt.com),4=TCP]Please take me forward.### Assistant: I faced the same error and its resolved now!As Magic Wand mentioned in the comment, below error comes up if you have a lower version of MQ jar i.e if your MQ jar version is 7.0.1.5 or belowCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009;AMQ9208: Error on receive from hostThis bug has been fixed in IBM MQ version 7.0.1.6 or higher as mentioned here:http://www-01.ibm.com/support/docview.wss?uid=swg1IV00348Add the newer version of below ibm.mq jars and make sure you have the additional jars too mentioned below:com.ibm.mq.commonservices.jar \ncom.ibm.mq.jar \ncom.ibm.mq.jmqi.jar \ncom.ibm.mqbind.jar \ncom.ibm.mqjms.jar \nfscontext.jar \njms-1.1-20020430.jar\nproviderutil.jar\n"}
+{"text": "### Human: I have a Java client that connects to MQ with 10 connections. These remain open for the duration that the Java client runs. For each thread we create a message, create a session, send the message and close the session. We are using the Spring CachingConnectionFactory and have a sessionCacheSize of 100. We have been told by our MQ engineering team is that that our queue manager has a max connections of 500 and that we are exceeding this. The QM.ini file has:maxChannels=500\nmaxActiveChannels=256\nmaxHandles=256What I have observed in MQ explorer is that the open output count on the queue remains static at 10, however if we load balance across 2 queues it's 10 on each, even though we still only have 10 connections. So what I'd like to know is what do jms connections and sessions equate to in MQ terminology?I did think that a connection equates to an active channel and a session is a handle, so it was the handles that we were possibly exceeding as the amount of sessions we open (and close) run into hundreds or thousands, whereas we only have 10 connections. Although going against this, the snippet below from IBM's Technote \"Explanation of connection pool and session pool settings for JMS connection factories\", suggests that the max channels should be greater than the max sessions, however we never know this as it depends on the load (unless this should be greater than the sessionCacheSize?).Each session represents a TCP/IP connection to the queue manager.\n With the settings mentioned here, there can be a maximum of 100 TCP/IP\n connections. If you are using WebSphere MQ, it is important to tune\n the queue manager's MaxChannels setting, located in the qm.ini file,\n to a value greater than the sum of the maximum possible number of\n sessions from each JMS connection factory that connects to the queue\n manager.Any assistance on how best to configure MQ would be appreciated.### Assistant: Assuming that your maximum number of conversations is set to 1 on the MQ Channel (the default is 10 in MQ v7 and v7.5) then a JMS Connection will result in a TCP connection (MQ channel instance) and a JMS Session will result in another TCP connection (MQ channel instance).From your update it sounds like you have 10 JMS Connections configured and the sessionCacheSize in Spring set to 100, so 10 x 100 means 1000 potential MQ channel instances being created. The open output count will show how many 'active' JMS Sessions are attempting send a message and not necessarily how many have been 'cached'.The conversation sharing on the MQ channel might help you here as this defines how many logical connections can be shared over one TCP connection (MQ channel instance). So the default of 10 conversations means you can have 10 JMS Sessions created that operate over just one TCP connection.\n"}
+{"text": "### Human: public class PtpReceiver {public static void main(String[] args) {\n // TODO Auto-generated method stub\n try {\n MQEnvironment.hostname = \"192.168.120.28:1415\";\n MQEnvironment.channel = \"SFMS.TO.CBS\";\n MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,\n MQC.TRANSPORT_MQSERIES);\n System.out.println(\"Q manager\");\n MQQueueManager qMgr = new MQQueueManager(\"GSCBBRQM\");\n System.out.println(\"Q manager11\");\n\n }\n\n catch (MQException ex) {\n System.out.println(ex.completionCode+ ex.reasonCode);\n }\n}}I got the error following:MQJE001: Completion Code '2', Reason '2538'.Can any one help me for solve this error### Assistant: That is JMS code for doing a connection via for WMQ for JMS. Bhaumik is using WMQ for Java (non JMS).Bhaumik, you do not specify the port number in the hostname but rather as follows:public static void main(String[] args) {\n try {\n MQEnvironment.hostname = \"192.168.120.28\";\n MQEnvironment.port = 1415;\n MQEnvironment.channel = \"SFMS.TO.CBS\";\n MQQueueManager qMgr = new MQQueueManager(\"GSCBBRQM\");\n }\n\n catch (MQException ex) {\n System.out.println(\"CC=\"+ex.completionCode + \" : RC=\"+ ex.reasonCode);\n }\n}\n"}
+{"text": "### Human: This is one of those brain-dead things that I need to do for most the new development servers I set up at work. We used to have the steps documented on our wiki, but that got wiped out recently and so I had to figure this out again.Without the MQ client packages installed, I was seeing the following error when trying to install a Python MQ client library:In file included from mqclient.c:2:0:\n\nmodule.h:6:18: fatal error: cmqc.h: No such file or directory\n\ncompilation terminated.\n\nerror: command 'gcc' failed with exit status 1### Assistant: For future reference, here are the steps that worked for me. These assume you are logged in asrooton theDebian server. These are forversion 7.0.1.10, but I imagine can be more or less easily adapted to other versions.1. InstallalienforrpmpackagesIf not yet installed on your server:apt-get install alien2. Download IBM Websphere packageI believe the 7.0.1 versions can be foundhere, along with links to other versions.3. Unzip package in/tmp/mqclientdirectory and accept licensemkdir /tmp/mqclient\ncp mqc7_7.0.1.10_linuxx86.tar.gz /tmp/mqclient\ntar zxvf mqc7_7.0.1.10_linuxx86.tar.gz\n./mqlicense.shSelect the appropriate option to accept the license.4. Set up mqm useradduser mqm\nusermod -m -d /var/mqm mqm5. Install MQSeries packagesalien --scripts --to-deb MQSeriesRuntime-7.0.1-10.i386.rpm\nalien --scripts --to-deb MQSeriesClient-7.0.1-10.i386.rpm\nalien --scripts --to-deb MQSeriesSDK-7.0.1-10.i386.rpm\ndpkg -i mqseriesruntime_7.0.1-10_i386.deb\ndpkg -i mqseriesclient_7.0.1-10_i386.deb\ndpkg -i mqseriessdk_7.0.1-10_i386.debAnd, voila, hopefully that does it. Remember to double check the paths in these steps against the ones you are actually using for your particular package and best of luck.\n"}
+{"text": "### Human: Is there a good best practice about what kind of messages an application is allowed to reject?My understanding is that all messages which can't be handled should be rejected to the dead letter queue - no matter if the problem is a syntax error or a semantic error in the message or if the application is temporarily not able to handle the message (for instance because the db just went down).Of course - if the app already knows upfront that it will not be able to handle a message (DB down), it should stop accepting messages.So what's the common understanding / best practice?### Assistant: My response is with respect to WebSphere MQ:A Dead Letter Queue (DLQ for short) is a place where messages that could not be delivered to their destination are put. Messages can be put on the DLQ by queue managers, message channel agents (MCAs), and applications. All messages on the DLQ must be prefixed with a dead-letter header structure, MQDLH. The MQDLH header is automatically fixed when queue manager or MCAs put messages whereas applications must prefix the MQDLH explicitly.As far applications are concerned, if they are unable to handle the message, say for example the message format is not understood, they can put the message to a BACKOUT queue instead of a DLQ. A BACKOUT queue is just like any normal queue where messages rejected by applications can be put. The advantage of BACKOUT queue is that you can specify a BACKOUT queue on a per queue basis and the messages put there need not have MQDLH header prefixed.An application can be written to read the messages from BACKOUT and route them back to the target queue as it is. However the messages in a DLQ require additional processing to remove the MQDLH before they are put onto a target queue.\n"}
+{"text": "### Human: I have few hundreds of messages in my MQ server(using MQ .NET).I am trying to read those one by one, however i am having issue in looping thro' that. I don't have any count/length property that i can use in this regard.mqQueue - MQQueue\nmqQMgr - MQ QueueManagermqQueue = mqQMgr.AccessQueue(queueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_BROWSE);\n mqQueue.Get(mqMsg, mqGetMsgOpts); \n string readMessage = mqMsg.ReadString(mqMsg.MessageLength);How can i loop thro' all the messages in the queue and if there is no message i want exit out. Thanks in advance.### Assistant: Have a look at the sample programs that installed with the WMQ code. By default, these will live inC:\\Program Files (x86)\\IBM\\WebSphere MQ 7.5\\tools\\dotnet\\samples\\cs\\base\\and the one I think you want isSimpleGet.cs.The problem you are having is that you are opening the queue repeatedly. That resets the rowse pointer to the head of the queue eac time. The sample program shows how to open the queue once, then loop through messages until reaching a certain number or until the queue is empty, whichever comes first.// create connection\n Console.Write(\"Connecting to queue manager.. \");\n queueManager = new MQQueueManager(queueManagerName, properties);\n Console.WriteLine(\"done\");\n\n // accessing queue\n Console.Write(\"Accessing queue \" + queueName + \".. \");\n queue = queueManager.AccessQueue(queueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);\n Console.WriteLine(\"done\");\n\n // getting messages continuously\n for (int i = 1; i <= numberOfMsgs; i++)\n {\n // creating a message object\n message = new MQMessage();\n\n try\n {\n queue.Get(message);\n Console.WriteLine(\"Message \" + i + \" got = \" + message.ReadString(message.MessageLength));\n message.ClearMessage();\n }\n catch (MQException mqe)\n {\n if (mqe.ReasonCode == 2033)\n {\n Console.WriteLine(\"No message available\");\n break;\n }\n else\n {\n Console.WriteLine(\"MQException caught: {0} - {1}\", mqe.ReasonCode, mqe.Message);\n break;\n }\n }\n }The IBM install media with the code samples is downloadable asSupportPac MC75. If for some reason you need a back-level client, they are available from the SupportPacsmain page. However, keep in mind that there has been a lot of engineering in the later releases and you are MUCH better off with the latest version. Any version of MQ client can work with any version of QMgr, but obviously the functionality you get is either that only on the client side (such as the client.ini file) or on the server side, whatever that level of QMgr gives you. In other words, using a V7.5 client with a v7.0 QMgr works fine, but it doesn't give you CHLAUTH rules because the v7.0 QMgr doesn't have those.\n"}
+{"text": "### Human: For the following codepublic class JMSSamplePut \n {\n private static String initialContextUrl = null;\n private static String connectionFactoryFromJndi = \"UM_QMGR_QCF\";\n private static String queueFromJndi = \"BCUFXW.EXB.ATHENA.FX.IN\";\n private static String outString = \"A sample text message \" +\n \"from JMSSampleput\";\n private static int retryInterval = 10;\n private static int retryCount = 3;\n private static int connStatus = 1;\n\n\n /**\n * @param args\n */\n public static void main( String[] args ) \n {\n\n // Variables\n Queue ioQueue = null;\n QueueSession session = null;\n QueueSender queueSender = null;\n QueueConnection connection = null;\n QueueConnectionFactory factory = null;\n boolean transacted = false;\n int i = 0;\n\n try { \n // Instantiate the initial context for JNDI\n String contextFactory =\"com.sun.jndi.fscontext.RefFSContextFactory\";\n Hashtable environment = new Hashtable();\n environment.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);\n environment.put(Context.PROVIDER_URL, \"file:/c:/jndi\"); \n Context context = new InitialDirContext(environment);\n System.out.println(\"Initial context found!\");\n\n // Create a Queue ConnectionFactory\n factory = (QueueConnectionFactory) context.lookup(connectionFactoryFromJndi);\n\n ...........The last line is failing withcaught JMSException: com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2013: The security authentication was not valid that was supplied for QueueManager '' with connection mode 'Client' and host name 'NATMIB1.hostname.net(1414)'. Please check if the supplied username and password are correct on the QueueManager you are connecting to\nlinked exception: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').\nFinishedJVM args-Djavax.net.ssl.keystore=c://keystore//a_dev.jks \\\n-Djavax.net.ssl.keyStorePassword=******** \\\n-Djavax.net.ssl.trustStorePassword=******** \\\n-Djavax.net.ssl.trustStore=c://keystore//cacerts.jks \\\n-Djavax.net.debug=allAny pointers? Why is the following line?security authentication was not valid that was supplied for QueueManager '' with connection mode 'Client' and host name 'NATMIB1.hostname.net(1414)'Looks like the JNDI agent is not able to find the name of the QueueManager? \nI have the following line in .bindings file and the queue manager name is NATMIB1UM_QMGR_QCF/RefAddr/3/Content=NATMIB1.xyz.netThanks in AdvanceSundar### Assistant: Debugging WMQ security errors is dead-simpleifyou have the right tools. First, go getSupportPac MS0Pand install into WMQ Explorer according to the instructions. If you do not have a modern version of WMQ Explorer, you can download it fromSupportPac MS0T.Next, enable authorization events on the QMgr and recreate the error.At this point, right-click on the event queue in WMQ Explorer and select Format Event Messages. This will show you all aspects of the error including:The User ID that generated the error. Depending on the channel setup, exits and the client settings, the ID used may not be the one you expect.The API call that was made. Probably Connect in this case, but sometimes this is also not what you expect. For example, the IBM JMS classes will always inquire on the QMgr to get the DLQ name and if you didn't grant inquire, it fails.The exact options used for the call.The object against which the call was issued.Once you know these elements of the error, you can identify whether it is a problem with the ID itself, the channel, the authorizations for the ID, etc.UpdateIn response to a question in the comments, to enable Authorization Events use MQ Explorer or runmqsc as follows:For the MQ Explorer version, first right-click on the QMgr and select Properties.Then select Events in the nav panel, set the events as required and clickOK.\n"}
+{"text": "### Human: I have one MQ cluster environment. At some point, one of the partial repository qmgr broke down while the queueSYSTEM.CLUSTER.REPOSITORY.QUEUE's depth in another qmgr keeps increasing.I kind of don't undersatnd why this happened. I walked through the technote from this linkhttp://www-01.ibm.com/support/docview.wss?uid=swg21193012but I don't understand it. Can someone help explain in more detail and more clearly?Thanks### Assistant: The repository queue contains messages that represent the state of the cluster. The full repository tracks state of all objects and QMgrs in the cluster while the cluster member QMgrs track only the objects they need to know about. Since this is usually a subset, ordinary cluster QMgrs are sometimes referred to as \"partial repositories\" because that is what they contain - a partial subset of the full repository info.The actual format of the messages on the repository queue is not publicly documented. What the Technote explains is that the information is frequently rearranged and compressed so that you should not expect a linear relationship between the number of cluster objects and the depth of the repository queue. Depending on the timing, one message on the repository queue might represent the state of multiple cluster objects or just one. There might even be repository messages representing the state of deleted cluster objects. Generally, partial repositories have fewer messages on the repository queue than do full repositories but if not it usually is not any indication of a problem.What the Technote doesn't explain is that the messages on the repository queue are held under syncpoint and that this distorts the QDepth. For example, the QMgr will read all the cluster repository messages at startup. If it needs to make a change, it performs a GET under syncpoint for the relevant message(s). During the time when these messages are under syncpoint, the queue depth is reduced even though the messages are still there. The apparent and actual depths will match only after aCOMMITorROLLBACK. As the cluster state changes, new messages are put to the queue to reflect the new state. These increase the apparent QDepth immediately, even while the transaction is pendingCOMMITorROLLBACK. Also, the number of messages written may be significantly more or less than the number gotten for any update of the queue.So the upshot of the Technote and my advice is to accept that the SYSTEM.CLUSTER.REPOSITORY.QUEUE is volatile and not to worry to much about its depth. Instead, if you have a monitoring agent, monitor that there is always an open input handle on the queue or that the cluster repository manager process (amqrrmfa) is running, or both.\n"}
+{"text": "### Human: Currently I have a queue manager that no matter I do just fails to go away. I am trying to end it and delete it. This is in one of our development servers. Not sure what happened, our server went through host name changes. Currently when I dodspmq, I get:QMNAME(QM_MIT) STATUS(Status not available)endmqmsays:AMQ8146: WebSphere MQ queue manager not available.dltmqmsays:AMQ8041: The queue manager cannot be restarted or deleted because processes,\nthat were previously connected, are still running.\nAMQ7018: The queue manager operation cannot be completed.I googled and found that listener needs to be killed, which I did. I am running WebSphere MQ v7.1 on Linux.What else can I do?### Assistant: Do aps-ef | grep qmgrnameto find any remaining processes that were running as part of the QMgr or that were attached to the QMgr.Next, do a/opt/mqm/bin/amqiclen -x -F -m qmgrnameto get rid of any shared memory segments. The command will fail if you do not provide a fully-qualified path name and try to run it from your$PATHor a relative path.SeeWebSphere MQ utility amqiclen usage and descriptionfor more details.\n"}
+{"text": "### Human: I found that PERSISTENT message have much slower performance than NON_PERSISTENT message.\nI sent and received non_persistent messages and the performance is as follows.Method Number of Msg Elapsed Time\n\n Sending - 500 messages - 00:00:0332\n Receiving - 500 messages - 00:00:0281I sent and received persistent messages and the performance is as follows.Sending - 500 messages - 00:07:0688\n Receiving - 500 messages - 00:06:0934This behavior happens in both MQMessage and JMSMessage.Thank all people helping me out the problem.Special thanks to Shashi, T.Rob and Pangea.### Assistant: Given the new title, I find I now have a response to this question.Yes, persistent messages will always take longer than non-persistent messages with all other aspects being equal. The degree to which they are slower is highly tunable, though. In order to get the results that you are seeing it is likely that the queue manager has many of the worst-case tunings. Here are some of the factors that apply:Whether the disk is local or networked. For 100MBS and slower connections talking to NFS mounted over spinning disks, a local drive is almost always much faster. (Mounts to SAN with fiber channel and battery-backed cached controllers are nearly always faster than local spinning drives, however.) A common example is use of consumer-grade NAS drives. As great as home NAS units are, throughput is always slower than local disk.For local drives, the speed of the drive. Newer 'green' drives vary rotational speed to conserve power. Even 7200RPM disks can exhibit performance degredation compared to a 10k RPM drive.For local drives, the degree of fragmentation. Even though the messages are small, they are placed into pre-allocated log files that may be highly fragmented.Putting disk and log files on the same local volume. This causes head contention because a single message is written to both files before control returns to the application.Linear versus circular logs. Linear are slower because the log formatter must allocate them new each time.Whether syncpoint is used or not. If many messages are written in a single unit of work, WMQ can use cached writes and optimize the sector put operations. Only the COMMIT need ever be a blocking call.Since non-persistent messages are handled entirely in memory, or overflowed to at most one disk file, then they are not affected by most of these issues.\n"}
+{"text": "### Human: What is the best way to startup automatically Websphere MQ v7.1 queue managers during system startup? I see that there is aSupportPacfor it, just want to make sure this is the right one. We have MQ running over 64-bit Linux. Thanks.### Assistant: Yes,SupportPac MSL1is the correct one for Linux.Some other UNIX flavors can use this SupportPac as-is or with modifications. For Windows, specify the QMgr to be started automatically and the WMQ service will start it.Update 26 Sep 2017Responding to comments from byteborg, I checked and it seems IBM have removed SupportPac MSL1 for some reason, even from the list of withdrawn SupportPacs.As it happens I'm atMQTCthis week and lots of IBMers from Hursley Lab are here so I'll ask then to restore it or put it on Github. If they are able to do so, the internal review process to make that happen is extensive so it won't happen soon. If that doesn't work, I'll see about getting permission to host it myself. Stay tuned.Update 1 Oct 2017While at MQTC, Mark Taylor, the MQ Architect from IBM Hursley Labs, explained the removal of MSL1. Basically, \"it didn't work\" according to Mark. Instead, IBM have provided guidance in the form of an MQDev blog postManaging queue manager startup and shutdown on Linux with systemd. The post does pretty much what the headline says, and describes how to use systemd to start/stop MQ. Please refer to that post for details.\n"}
+{"text": "### Human: How can you create a durable architecture environment using MQ Client and server if the clients don't allow you to persist messages nor do they allow for assured delivery?Just trying to figure out how you can build a salable / durable architecture if the clients don't appear to contain any of the necessary components required to persist data.Thanks,S### Assistant: Middleware messaging was born of the need to persist data locally to mitigate the effects of failures of the remote node or of the network. The idea at the time was that the queue manager was installed locally on the box where the application lives and was treated as part of the transport stack. For instance you might install TCP and WMQ as a transport and some apps would use TCP while others used WMQ.In the intervening 20 years, the original problems that led to the creation of MQSeries (Now WebSphere MQ) have largely been solved. The networks have improved by several nines of availability and high availability hardware and software clustering have provided options to keep the different components available 24x7.So the practices in widespread use today to address your question follow two basic approaches. Either make the components highly available so that the client can always find a messaging server, or put a QMgr where the application lives in order to provide local queueing.\n"}
+{"text": "### Human: Now I use the websphere MQ client connect to remote MQ Server(7.0 version) using c#, and occurs a problem of authority,Which is the user running the MQ client application have insufficient authority to access qmgr.Then I use the 'setmqaut' command to grand the user sufficient authority and it works.I think it's not very convenient and must be a better way.May via adding user's IP in MQ Server? But I have no idea how to do it.Any suggestions would be greatly appreciated.\nThanks### Assistant: WebSphere MQ does not perform any authentication. Local applications are authenticated by the operating system and so their ID can be trusted. (By definition, if you cannot trust the local OS authentication then the entire server is compromised.) Just as with local connections, WMQ trusts that the ID connecting remotely is genuine. It is up to the WMQ administrator to determine what level of authentication to employ. In WMQ v7 there are two choices - authenticate with SSL/TLS channels, or use a channel exit to authenticate.In either case, it is the channel's MCAUSER value that decides what ID is used for authorization. If the MCAUSER is left blank then the channel will use the user ID that the client sends. In your case you received a 2035 error because the client sent an ID that was not in the administrative (mqm) group. Had your client sent the ID 'mqm' (or on Windows 'MUSR_MQADMIN'), the connection would have succeeded. If your program is Java or JMS, the ability to select the ID presented is part of the API. Just tell the QMgr who you want to be.If you are willing to allow remote connections to execute OS commands on the server, then just put the administrative ID in the channel's MCAUSER. (For example, MCAUSER('mqm') on UNIX/Linux or typically MCAUSER('MUSR_MQADMIN') for Windows.) However, be aware that remote users with admin rights can remotely execute arbitrary OS command-line code using the QMgr. This is a feature of WMQ and not a bug, hence we NEVER recommend this in Production. In fact, I personally recommend that development environments enable security. Waiting until Production to figure out how to authenticate connections and what authorizations are needed often leads to unnecessary deployment delays.If you want to use IP filtering to mitigate that threat, you can either move to WMQ v7.1 which includes this feature natively, or use an exit such asBlockIP2. Either of these solutions will allow you to create rules that filter incoming connection requests by IP address, user ID, etc.Note that on a v7.0 QMgr all the channels are unprotected by default. So even if you filter incoming requests on one channel, if the others are left in their default state, anyone can still connect and execute commands as the administrator. For a comprehensive review of all this, please take a look at the Hardening WebSphere MQ presentation att-rob.net. Scroll down to the v7.0 presentations.\n"}
+{"text": "### Human: Using JMS & WebSphere MQ, if I use a message selector to selectively dequeue, and there are several messages with the same selection criteria, am I guaranteed to dequeue the first message that matches?e.g. given a queue with messages{color: pink, name: alice}{color: blue, name: bob}{color: red, name: charlie}{color: blue, name: doug}if I dequeue with the selectorcolor='blue', am I guaranteed to dequeue{color: blue, name: bob}? Or is there a chance I could get{color: blue, name: doug}instead, even though it is further into the queue depth?### Assistant: Please refer to theRESCANINTproperty of the different WMQ Connection Factory implementations. From the manual:When a message consumer in the point-to-point domain uses a message\n selector to select which messages it wants to receive, the WebSphere\n MQ JMS client searches the WebSphere MQ queue for suitable messages in\n the sequence determined by the MsgDeliverySequence attribute of the\n queue. When the client finds a suitable message and delivers it to the\n consumer, the client resumes the search for the next suitable message\n from its current position in the queue. The client continues to search\n the queue in this way until it reaches the end of the queue, or until\n the interval of time in milliseconds, as determined by the value of\n this property, has expired. In each case, the client returns to the\n beginning of the queue to continue its search, and a new time interval\n commences.The idea is that in a very busy queue with priority delivery, some messages of a higher priority may appear higher in the queue then the current position of the selector. Theoretically a higher priority message should be consumed first but the consumer won't see it unless it seeks from the head of the queue. The cursor is reset to the head of the queue either when it gets to the end or when RESCANINT is reached. The setting of RESCANINT allows for tuning of how responsive you want the selector to be in finding these higher priority messages.RESCANINT isn't specific to FIFO delivery. The other case in which this can happen is if there are multiple threads with overlapping selection criteria. In this case one thread can hold a message under lock and then release it. Although the message may be eligible for the second thread, if that thread has already passed that position in the queue then it takes hitting the end of the queue or RESCANINT elapsing to restart the cursor to find the message.Rescan interval is in milliseconds and defaults to 5000. Any positive integer value is accepted, although too low a value will cause thrashing as the cursor is continually reset before any messages can be consumed.As a practical matter, you will receive the messages in order if the queue is FIFO and you have only one reader on the queue for which the messages are eligible, regardless of what RESCANINT is set to. If message order is to be strictly preserved, there are some additional considerations as described inSequential retrieval of messages. These boil down to messages having only one path from producer to consumer when considering channels, syncpoints, etc.\n"}
+{"text": "### Human: Is there an API to connect to a Websphere MQ queue from an SQL Server stored procedure and put a message onto a queue?If not, what would be the best way to achieve this?### Assistant: The solution I am going to use for this is to write a CLR stored procedure and deploy this onto SQL Server.Inside the CLR stored proc I will use the MQ .NET api.Update:I created a stored proc using the following code:using System;\nusing System.Data;\nusing System.Data.SqlClient;\nusing System.Data.SqlTypes;\nusing Microsoft.SqlServer.Server;\nusing IBM.WMQ;\n\npublic partial class StoredProcedures\n{\n [Microsoft.SqlServer.Server.SqlProcedure]\n public static int MQStoredProc(String queueManager, String queueName, String messageText)\n {\n //MQEnvironment.Hostname = \"localhost\";\n //MQEnvironment.Port = 1414;\n //MQEnvironment.Channel = \"SYSTEM.DEF.SVRCONN\";\n\n MQQueueManager mqQMgr = null; // MQQueueManager instance\n MQQueue mqQueue = null; // MQQueue instance\n\n try\n {\n mqQMgr = new MQQueueManager(queueManager);\n mqQueue = mqQMgr.AccessQueue(queueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING); // open queue for output but not if MQM stopping\n\n if (messageText.Length > 0)\n {\n // put the next message to the queue\n MQMessage mqMsg = new MQMessage();\n mqMsg.WriteString(messageText);\n mqMsg.Format = MQC.MQFMT_STRING;\n MQPutMessageOptions mqPutMsgOpts = new MQPutMessageOptions();\n mqQueue.Put(mqMsg, mqPutMsgOpts);\n }\n\n return 0;\n }\n catch (MQException mqe)\n {\n return ((int)mqe.Reason); \n }\n finally\n {\n if (mqQueue != null)\n mqQueue.Close();\n if (mqQMgr != null)\n mqQMgr.Disconnect();\n }\n }\n};This is not production ready but is inserting messages successfully on a queue manager running on the same server as the SQL server in bindings mode.\n"}
+{"text": "### Human: I am using IBM.XMS 2.0.0.5 and MQ Client 7.0.1.5 and have created a connection, set the exception listener, started the connection and started listening for messages using a message listener. This works fine, except that theExceptionListenerdoes not fire when I disable the network connection. Instead I get an unhandled socket exception.I have gone back to the example given on the IBM site and recreated the error:If I disable the network connetion I get the unhandled socket exception and the exceptionListener does not get fired.using System;\nusing System.Threading;\nusing IBM.XMS;\n\npublic class Sample\n{\n public static void Main()\n {\n XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n\n IConnectionFactory connectionFactory = factoryFactory.CreateConnectionFactory();\n connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, \"**********\");\n connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, \"*****\");\n connectionFactory.SetIntProperty(XMSC.WMQ_PORT, 1414);\n connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\n connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"*********\");\n\n //\n // Create the connection and register an exception listener\n //\n\n IConnection connection = connectionFactory.CreateConnection();\n connection.ExceptionListener = new ExceptionListener(OnException);\n\n ISession session = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n IDestination queue = session.CreateQueue(\"queue://***********\");\n\n //\n // Create the consumer and register an async message listener\n //\n\n IMessageConsumer consumer = session.CreateConsumer(queue);\n consumer.MessageListener = new MessageListener(OnMessage);\n\n connection.Start();\n\n while (true)\n {\n Console.WriteLine(\"Waiting for messages....\");\n Thread.Sleep(1000);\n }\n }\n\n static void OnMessage(IMessage msg)\n {\n Console.WriteLine(msg);\n }\n\n static void OnException(Exception ex)\n {\n Console.WriteLine(ex);\n }\n}### Assistant: I'll put the answer up in the hope that it saves someone the time it wasted for me.You need to use an unmanaged client connection in order to connect up an exception listener to your connection.connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);\n"}
+{"text": "### Human: Are Websphere MQ messages stored in a database or filesystem?\nCan I configure it to use MySQL?### Assistant: WebSphere MQ persistence is always a local filesystem for distributed platforms. On the mainframe there is the possibility of using a DB2 database in a Sysplex with a Coupling Facility but for everything else it is a filesystem.Also, there is no local persistence for WebSphere MQ clients. Only the queue manager will persist messages.In the WebSphere family, WebSphere Application Server's System Integration Bus has the ability to use a database for it's message persistence. SIBus is a JMS implementation provided with WAS for exchanging messages in the WAS cell and between WAS instances.\n"}
+{"text": "### Human: There is a built in limitation of 2 MB for the IBM WebSphere MQ JMS interface.http://www-01.ibm.com/support/docview.wss?uid=swg21221260Is there a way to bypass that limitation?### Assistant: The limitation applied to WMQ versions distributed with WAS back at V5.1.1 many years ago. If this is the problem, upgrading to current version of WMQ will resolve it. The current version of WMQ is V7.0.1. V6.0.2 is also still current but will be out of service in September of 2012. V6 & V7 can send and receive messages up to 100MB but WMQ itself defaults to 4MB out of the box. It is necessary to tune parameters of the QMgr, queues and channels if messages larger than 4MB are required but JMS is not a limitation at modern versions.The WMQ Java/JMS manuals do not specifically mention a maximum size because it is the same as the native WMQ max length of 100MB. However, theWMQ V6 Performance Reportprovides benchmarks for JMS messages up to 64MB.Whatever is preventing you from putting a 3MB message isn't a limitation of WMQ's JMS implementation as regards message size. If you have checked MAXMSGL on all of the channels and queues and the QMgr then it's something less obvious but itisconfiguration.\n"}
+{"text": "### Human: Today if we build an application using the JMS API (using MDBs as message listeners, host it on lets say GlassFish or Weblogic 10) and tomorrow lets say the traffic goes crazy, can we port this application without code changes to some product like Websphere MQ... coz theoretically MQ is more like a dedicated JMS provider ...### Assistant: Yes and no. (The answer to all the best questions is always \"it depends.\")If the application adheres to the JMS specification then it should run unchanged on any JMS compliant provider. That's the good news.The bad news is that it really does matter how the provider implemented JMS. For example, Section 6.5 of the JMS 1.1 specification says this about topics:Many Pub/Sub providers group topics\n into hierarchies and provide various\n options for subscribing to parts of\n the hierarchy. JMS places no\n restrictions on what a Topic object\n represents. It might be a leaf in a\n topic hierarchy, or it might be a\n larger part of the hierarchy (for\n subscribing to a general class of\n information).The organization of topics and the\n granularity of subscriptions to them\n is an important part of a Pub/Sub\n application\u2019s architecture. JMS does\n not specify a policy for how this\n should be done. If an application\n takes advantage of a provider-specific\n topic grouping mechanism, it should\n document this. If the application is\n installed using a different provider,\n it is the job of the administrator to\n construct an equivalent topic\n architecture and create equivalent\n Topic objects.What this means is that certain parts of the specification are open to interpretation of the JMS transport provider. It will be up to the application owner to determine how to map these differences when porting applications.Another aspect of this question is that even when the specification is followed strictly by two transport providers, the behavior behind the API may differ. An example of this is connection management. Some providers fail connections over transparently to the client, others ask the client to re-drive the connection sequence after a failure. Both approaches can be 100% JMS compatible and yet both require different application logic.So the answer is that adhering to the JMS API gets you very close to fully portable and the amount of porting that is required depends on the differences in how the transport provider interprets parts of the spec and/or implemented features that are ambiguous in the spec.\n"}
+{"text": "### Human: My Python is worse than my Chinese (I have never seen so many smiling faces than when I try to speak Mandarin), so I need a little help:I want something to listen to MQ (for topics specified in a configuration) and relay the message to dBus and in return listen to dBus (for topics specified in a configuration) and relay them back to the MQ. From poking around my conclusion is Python would be suitable. I found:MQTT.orgPYMQiandMosquitto.So the approach seems to be valid. Now I'm looking for code samples. My main concern is to make the code efficient. Since it seems that the routine needs to run in a polling loop how do I do that in Python without bogging down my system.### Assistant: PYMQi has sample code here:http://packages.python.org/pymqi/examples.htmlIn order not to poll you might want to look at MQ Triggers. They enable an application to be launched when a message is put on a queue.\n"}
+{"text": "### Human: The documentation refers toconfiguring information with stanzas, but what is a stanza?Is it just a fancy name for a sub-section of configuration?### Assistant: You are correct, in this context a stanza refers to a sub-section of a IBM MQ configuration file.For example MQ clients come by default with a config file calledmqclient.ini, in this file you may see something like the following:TCP:\n ClntSndBuffSize=0In this example thestanzaisTCPand it has a singleattributeClntSndBuffSizeset to the value0.\n"}
+{"text": "### Human: I'm running two(2) client tests.Presumably they should both work. But, one does not, and I do not know why.(1) This one works...package aaa.bbb.ccc;\n\nimport com.ibm.mq.MQEnvironment;\nimport com.ibm.mq.MQQueueManager;\nimport com.ibm.mq.MQQueue;\nimport com.ibm.mq.MQMessage;\nimport com.ibm.mq.MQPutMessageOptions;\nimport com.ibm.mq.constants.CMQC;\nimport com.ibm.mq.constants.MQConstants;\n\npublic class MQCheck {\n public static void main(String args[]) {\n try {\n int openOptions = CMQC.MQOO_INQUIRE | CMQC.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;\n MQEnvironment.hostname = \"localhost\";\n MQEnvironment.port = 1414;\n MQEnvironment.channel = \"DEV.APP.SVRCONN\";\n MQEnvironment.properties.put(CMQC.USER_ID_PROPERTY, \"admin\");\n MQEnvironment.properties.put(CMQC.PASSWORD_PROPERTY, \"passw0rd\"); \n MQEnvironment.properties.put(CMQC.TRANSPORT_PROPERTY, CMQC.TRANSPORT_MQSERIES);\n MQQueueManager qMgr;\n qMgr = new MQQueueManager(\"QM1\");\n MQQueue destQueue = qMgr.accessQueue(\"mylocalqueue\", openOptions);\n MQMessage hello_world = new MQMessage();\n hello_world.writeUTF(\"Blah...blah...bleah...test message no.1...!\");\n MQPutMessageOptions pmo = new MQPutMessageOptions();\n destQueue.put(hello_world, pmo);\n destQueue.close();\n qMgr.disconnect();\n System.out.println(\"------------------------success...\"); \n } catch (Exception e) {\n System.out.println(\"Exception: \" + e);\n e.printStackTrace();\n }\n }\n}(2) This one does NOT work...package aaa.bbb.ccc;\n\nimport com.ibm.mq.jms.MQQueueConnection;\nimport com.ibm.mq.jms.MQQueueConnectionFactory;\nimport com.ibm.mq.jms.MQSession;\nimport com.ibm.msg.client.wmq.WMQConstants;\nimport javax.jms.Connection;\nimport javax.jms.JMSException;\nimport javax.jms.MessageProducer;\nimport javax.jms.Queue;\nimport javax.jms.QueueSession;\nimport javax.jms.Session;\nimport javax.jms.TextMessage;\n\npublic class MQCheck3 {\n\n public static void main(String args[]) {\n\n Connection qconn = null;\n QueueSession qsess = null;\n MQSession mqsess;\n Queue queue = null;\n\n try {\n MQQueueConnectionFactory connectionFactory = new MQQueueConnectionFactory();\n connectionFactory.setHostName(\"localhost\");\n connectionFactory.setChannel(\"DEV.APP.SVRCONN\");//communications link\n connectionFactory.setPort(1414);\n connectionFactory.setQueueManager(\"QM1\");\n connectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n connectionFactory.setBooleanProperty(WMQConstants.CAPABILITY_USERNAME_PASSWORD, true);\n connectionFactory.setStringProperty(WMQConstants.USERID, \"admin\");\n connectionFactory.setStringProperty(WMQConstants.PASSWORD, \"passw0rd\"); \n qconn = (MQQueueConnection) connectionFactory.createConnection();\n qconn = connectionFactory.createQueueConnection();\n qconn.start();\n mqsess = (MQSession) qconn.createSession(false, Session.AUTO_ACKNOWLEDGE); //.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n queue = mqsess.createQueue(\"mylocalqueue\");\n TextMessage textMessage = mqsess.createTextMessage(\"Bleah...bleah...blech...test message no.2...!\");\n MessageProducer mc = mqsess.createProducer(queue);\n mc.send(textMessage, 0, 0, 0);\n System.out.println(\"------------------------success...\"); \n } catch (JMSException e) {\n System.out.println(\"Exception: \" + e);\n e.printStackTrace();\n } finally {\n try {\n qsess.close();\n qconn.close();\n } catch (JMSException e) {\n System.err.print(e);\n }\n }\n }\n}NOTE: \nRunning the code in (2) gets the following exception...Exception: com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2013: The security authentication was not valid that was supplied for QueueManager 'QM1' with connection mode 'Client' and host name 'localhost(1414)'.\nPlease check if the supplied username and password are correct on the QueueManager to which you are connecting.\ncom.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2013: The security authentication was not valid that was supplied for QueueManager 'QM1' with connection mode 'Client' and host name 'localhost(1414)'.\nPlease check if the supplied username and password are correct on the QueueManager to which you are connecting.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:514)\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:214)\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:408)\n at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6398)\n at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:5740)\n at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:293)\n at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:234)\n at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6016)\n at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:111)\n at aaa.bbb.ccc.MQCheck3.main(MQCheck3.java:35)\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:202)\n ... 8 more\nException in thread \"main\" java.lang.NullPointerException\n at aaa.bbb.ccc.MQCheck3.main(MQCheck3.java:48)*QUESTION: can anyone explain to me why the 2nd example does not work?: *-Is there something that is incorrect and/or missing from the code that would enable it to work?FYI - running MQ server from Docker image:C:>docker exec mq dspmqverC:\\>docker exec mq dspmqver\nName: IBM MQ\nVersion: 9.0.3.0\nLevel: p903-L170517.DE\nBuildType: IKAP - (Production)\nPlatform: IBM MQ for Linux (x86-64 platform)\nMode: 64-bit\nO/S: Linux 4.9.31-moby\nInstName: Installation1\nInstDesc:\nPrimary: Yes\nInstPath: /opt/mqm\nDataPath: /var/mqm\nMaxCmdLevel: 903\nLicenseType: Developer\n\nC:\\>pom.xml\n\n 4.0.0\n\n aaa.bbb.ccc\n mqcheck\n 1\n jar\n mqcheck\n mqcheck\n\n \n 8.0.0.2\n \n\n \n \n ibm.mq\n fscontext\n ${mq.version}\n \n \n ibm.mq\n jms\n ${mq.version}\n \n \n ibm.mq\n com.ibm.mq\n ${mq.version}\n \n \n ibm.mq\n com.ibm.mqjms\n ${mq.version}\n \n \n ibm.mq\n com.ibm.mq.jmqi\n ${mq.version}\n \n \n ibm.mq\n com.ibm.mq.headers\n ${mq.version}\n \n \n ibm.mq\n com.ibm.mq.commonservices\n ${mq.version}\n \n \n\n \n ${project.artifactId}-${project.version}\n \n \n org.apache.maven.plugins\n maven-compiler-plugin\n 3.1\n \n 1.8\n 1.8\n true\n \n \n \n \nas per the suggestion in the post below (thx, joshmc), here is the AMQERR01.logit appears to provide a clue... -now, the quest to determine how to I unblock the 'admin' user :-)----- cmqxrmsa.c : 1347 -------------------------------------------------------\n08/11/17 17:32:09 - Process(1847.6) User(root) Program(amqrmppa)\n Host(bd069b8075db) Installation(Installation1)\n VRMF(9.0.3.0) QMgr(QM1)\n Time(2017-08-11T17:32:09.967Z)\n\nAMQ9776: Channel was blocked by userid\n\nEXPLANATION:\nThe inbound channel 'DEV.APP.SVRCONN' was blocked from address '172.17.0.1'\nbecause the active values of the channel were mapped to a userid which should\nbe blocked. The active values of the channel were 'MCAUSER(admin)\nCLNTUSER(admin)'.\nACTION:\nContact the systems administrator, who should examine the channel\nauthentication records to ensure that the correct settings have been\nconfigured. The ALTER QMGR CHLAUTH switch is used to control whether channel\nauthentication records are used. The command DISPLAY CHLAUTH can be used to\nquery the channel authentication records.\n----- cmqxrmsa.c : 1347 -------------------------------------------------------running following command (as suggested)...C:\\>docker exec --tty --interactive mq runmqsc\n5724-H72 (C) Copyright IBM Corp. 1994, 2017.\nStarting MQSC for queue manager QM1.DIS CHL(DEV.APP.SVRCONN) MCAUSERDIS CHL(DEV.APP.SVRCONN) MCAUSER\n 1 : DIS CHL(DEV.APP.SVRCONN) MCAUSER\nAMQ8414: Display Channel details.\n CHANNEL(DEV.APP.SVRCONN) CHLTYPE(SVRCONN)\n MCAUSER(app)\n :DISPLAY CHLAUTH(DEV.APP.SVRCONN) MATCH(RUNCHECK) ALL ADDRESS(172.17.0.1)DISPLAY CHLAUTH(DEV.APP.SVRCONN) MATCH(RUNCHECK) ALL ADDRESS(172.17.0.1) CLNTUSER('admin')\n 5 : DISPLAY CHLAUTH(DEV.APP.SVRCONN) MATCH(RUNCHECK) ALL ADDRESS(172.17.0.1) CLNTUSER('admin')\nAMQ8878: Display channel authentication record details.\n CHLAUTH(DEV.APP.SVRCONN) TYPE(ADDRESSMAP)\n DESCR( ) CUSTOM( )\n ADDRESS(*) USERSRC(CHANNEL)\n CHCKCLNT(ASQMGR) ALTDATE(2017-08-11)\n ALTTIME(19.23.31)DIS QMGR CONNAUTHDIS QMGR CONNAUTH\n 1 : DIS QMGR CONNAUTH\nAMQ8408: Display Queue Manager details.\n QMNAME(QM1) CONNAUTH(DEV.AUTHINFO)DIS AUTHINFO(DEV.AUTHINFO)DIS AUTHINFO(DEV.AUTHINFO)\n 2 : DIS AUTHINFO(DEV.AUTHINFO)\nAMQ8566: Display authentication information details.\n AUTHINFO(DEV.AUTHINFO) AUTHTYPE(IDPWOS)\n ADOPTCTX(YES) DESCR( )\n CHCKCLNT(REQDADM) CHCKLOCL(OPTIONAL)\n FAILDLAY(1) AUTHENMD(OS)\n ALTDATE(2017-08-14) ALTTIME(13.57.29)DISPLAY CHLAUTH(DEV.APP.SVRCONN) allDISPLAY CHLAUTH(DEV.APP.SVRCONN) all\n 1 : DISPLAY CHLAUTH(DEV.APP.SVRCONN) all\nAMQ8878: Display channel authentication record details.\n CHLAUTH(DEV.APP.SVRCONN) TYPE(ADDRESSMAP)\n DESCR( ) CUSTOM( )\n ADDRESS(*) USERSRC(CHANNEL)\n CHCKCLNT(ASQMGR) ALTDATE(2017-08-16)\n ALTTIME(13.43.26)DISPLAY CHLAUTH() all*DISPLAY CHLAUTH(*) all\n 2 : DISPLAY CHLAUTH(*) all\nAMQ8878: Display channel authentication record details.\n CHLAUTH(DEV.ADMIN.SVRCONN) TYPE(USERMAP)\n DESCR(Allows admin user to connect via ADMIN channel)\n CUSTOM( ) ADDRESS( )\n CLNTUSER(admin) USERSRC(CHANNEL)\n CHCKCLNT(ASQMGR) ALTDATE(2017-08-16)\n ALTTIME(13.43.26)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(DEV.ADMIN.SVRCONN) TYPE(BLOCKUSER)\n DESCR(Allows admins on ADMIN channel) CUSTOM( )\n USERLIST(nobody) WARN(NO)\n ALTDATE(2017-08-16) ALTTIME(13.43.26)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(DEV.APP.SVRCONN) TYPE(ADDRESSMAP)\n DESCR( ) CUSTOM( )\n ADDRESS(*) USERSRC(CHANNEL)\n CHCKCLNT(ASQMGR) ALTDATE(2017-08-16)\n ALTTIME(13.43.26)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(MY.ADMIN.SVRCONN) TYPE(ADDRESSMAP)\n DESCR( ) CUSTOM( )\n ADDRESS(127.0.0.1) USERSRC(CHANNEL)\n CHCKCLNT(ASQMGR) ALTDATE(2017-08-11)\n ALTTIME(20.17.14)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(MY.ADMIN.SVRCONN) TYPE(BLOCKUSER)\n DESCR( ) CUSTOM( )\n USERLIST(*NOBODY) WARN(NO)\n ALTDATE(2017-08-11) ALTTIME(20.17.51)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(SYSTEM.ADMIN.SVRCONN) TYPE(ADDRESSMAP)\n DESCR(Default rule to allow MQ Explorer access)\n CUSTOM( ) ADDRESS(*)\n USERSRC(CHANNEL) CHCKCLNT(ASQMGR)\n ALTDATE(2017-08-03) ALTTIME(17.22.22)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(SYSTEM.*) TYPE(ADDRESSMAP)\n DESCR(Default rule to disable all SYSTEM channels)\n CUSTOM( ) ADDRESS(*)\n USERSRC(NOACCESS) WARN(NO)\n ALTDATE(2017-08-03) ALTTIME(17.22.22)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(*) TYPE(ADDRESSMAP)\n DESCR(Back-stop rule - Blocks everyone)\n CUSTOM( ) ADDRESS(*)\n USERSRC(NOACCESS) WARN(NO)\n ALTDATE(2017-08-16) ALTTIME(13.43.26)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(*) TYPE(BLOCKUSER)\n DESCR(Default rule to disallow privileged users)\n CUSTOM( ) USERLIST(*MQADMIN)\n WARN(NO) ALTDATE(2017-08-03)\n ALTTIME(17.22.22)### Assistant: Thereason '2035' ('MQRC_NOT_AUTHORIZED')can be caused by quite a few issues.IBM Support Technote \"WMQ 7.1 / 7.5 / 8.0 / 9.0 queue manager RC 2035 MQRC_NOT_AUTHORIZED or AMQ4036 or JMSWMQ2013 when using client connection as an MQ Administrator\" has a good write up on diagnosing and resolving issues like this.If you want more specific help, to start with please provide the following details by editing and adding them to your question.Version of IBM MQ Classes for JMS used by the client application.Version of IBM MQ installed on the IBM MQ queue managerErrors in the queue manager's AMQERR01.LOG that happen at the same time as the error you receive in the IBM MQ Classes for JMS client application.Based on the error you have in theAMQERR01.LOGyou have aCHLAUTHrule that is blocking you. Run the following command to see which rule this is:DISPLAY CHLAUTH(DEV.APP.SVRCONN) MATCH(RUNCHECK) ALL ADDRESS(172.17.0.1) CLNTUSER('admin')If it is the default rule that blocks MQ administrative users from connecting, then this is a good thing from a security standpoint. It is much better to have an application connect to the queue manager as a USERID that is low privileged and does not have MQ administrative authority. To do this you need to grant the user authority to connect to the queue manager as well as toPUTorGETfrom the queues required.After looking at the output so far I think what is happening is this.The IBM MQ Classes for Java program is not actually authenticating as the admin user and is being defaulted to the MCAUSER(app) on the SVRCONN channel which is not a MQ Administrative user so does not get blocked. The issue is that theMQEnvironment.propertiesis meant to hold the value of a Hash table of properties not individual properties. Check out @Roger's answer to \"Java program to connect WMQ with User Id instead of channel\" for examples of using the Hashtable which is thread safe compared to the MQEnvironment which is not. But in fixing this issue the IBM MQ Classes for Java app should be blocked the same as the JMS app.The IBM MQ Classes for JMS program is properly authenticating as the admin user and ADOPTCTX(YES) is set and the admin user is a MQ Administrative user so is blocked by the following default CHLAUTH rule:CHLAUTH(*) TYPE(BLOCKUSER)\n DESCR(Default rule to disallow privileged users)\n CUSTOM( ) USERLIST(*MQADMIN)\n WARN(NO)Please validate by running the following:DIS QMGR CONNAUTHThen run the following command replacing the valueSYSTEM.DEFAULT.AUTHINFO.IDPWOSwith the value found in output of the above command if it is different:DIS AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS)Note I'm not sure why theRUNCHECKis not returning theBLOCKUSERrule, I don't have a 9.0.3 to try this on but with a similarADDRESSMAPrule to the one that is being returned for you I still get theBLOCKUSERrule on both 8.0.0.5 and 8.0.0.6.\n"}
+{"text": "### Human: I have JMS Messages that are sent to an IBM MQ Queue, if the remote Client (I have not control over the remote client) does not consume the message in a given time (Say 1 minute) The message should Expire (I have the Expire part working, \"MQ deletes the message\" using setExplicitQosEnabled and setTimeToLive on the JMSTemplate) and the message sender (My SI Code) should be notified that the message was not delivered to the remote client so that the expired message can be reroute to another Queue.I am not sure how to implement this pattern using Spring Integration especially as the messages are sent asynchronously and only correlated upon return (MessageID -> CorrelationID).I thought I could have some form of:1) ErrorMessageExceptionTypeRouter, but I need the payload so I can resend the message and I am not sure how to implement this (How to call back from MQ to JMSTemplate or Route to another Queue on Time out, and have a secondary route listening to that queue and rerouting)2) WireTap, but I think this would mean blocking threads on the sender (Request/Response model) with timer that watches for the msg to be removed by the remote client. Again I am not sure how to implement this.Any help with how best to implement the above greatly appreciated.Progress report:I have tried to Query MQ by using the methodJMSTemplate.receiveSelected(destination, messageSelector);that Artem Bilan suggested. The plan was to manually find messages that have not been consumed by the Client in the given time. (The Provider would have to track all messages and attempt to retrieve each message using its messageID once the timer had expired, instead of using TimeToLive message expiry) This solution places the onus on the Provider to track and time every message sent and attempt to retrieve each message (most which should not be available) making it inefficient but a workable solution. Unfortunately IBM MQ does not like the it when I call:JMSTemplate.receiveSelected(destination, messageSelector);I get the following error:org.springframework.jms.InvalidSelectorException: JMSWMQ2008: Failed to open MQ queue \u2018MY.TEST.IN'.; nested exception is com.ibm.msg.client.jms.DetailedInvalidSelectorException: JMSWMQ2008: Failed to open MQ queue 'MY.TEST.IN'.\nJMS attempted to perform an MQOPEN, but WebSphere MQ reported an error.\nUse the linked exception to determine the cause of this error. Check that the specified queue and queue manager are defined correctly.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2459' ('MQRC_SELECTOR_SYNTAX_ERROR').however usingJMSTemplate.receive(destination);with the same destination does read a message off the queue.### Assistant: The following code causes IBM MQ V8 to automagicaly reroute an expired message to the JMSReplyTo queue, (Thanks to JoshMc for his suggestion in the comments above)jmsTemplate.setTimeToLive(3000l);\njmsTemplate.setExplicitQosEnabled(true);\njmsTemplate.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);\njmsTemplate.setDeliveryMode(DeliveryMode.PERSISTENT);\njmsTemplate.setPriority(Message.DEFAULT_PRIORITY);\njmsTemplate.send(destinationName, session -> {\n TextMessage toSend = session.createTextMessage(message)\n toSend.setIntProperty(\"JMS_IBM_Report_Expiration\", 14680064);\n Queue queue = session.createQueue(\u201cTEST.EXPIRE.REPORT\u201d);\n toSend.setJMSReplyTo(queue);\n\n return toSend;\n});The JMS_IBM_Report_Expiration value of 14680064 I found here:https://www.ibm.com/support/knowledgecenter/en/SS7K4U_8.0.0/com.ibm.websphere.javadoc.doc/web/apidocs/constant-values.html#com.ibm.websphere.sib.api.jms.ApiJmsConstants.MQRO_EXPIRATION_WITH_FULL_DATAI need to find this JAR and add it to my project, however MQ Removes the expired message and deposits it on my specified reply to queue.\n"}
+{"text": "### Human: I have MQ V8.0.0.2 installed in my system and I am applying the fix pack to upgrade it to 8.0.0.5 using the silent install method. It runs successfully and finishes butdspmqverstill says the version as 8.0.0.2.It is on a Windows 7 machine 64 bit. The exe file I am using to apply the fix pack isWS-MQ-8.0.0-FP0005.exe.I am not getting any errors in the command prompt. I followed the installation instructions IBM suggested while downloading the fix pack. I stopped the MQ manager and then ran the command WS-MQ-8.0.0-FP0005.exe -f silent_install.resp \nI gave the response file name along with its path. But its still not working.UpdateOn a multi-installation setup the update was being applied properly but to a different installation. To fix the problem, runamqicsdn.exeas described inApplying maintenance level updates on IBM MQ serversin the Windows maintenance Tasks section of the Knowledge Center.amqicsdn MQPINSTALLATIONNAME=name MQPSILENT=1This invocation sets a pointer to the installation that is to be updated.### Assistant: The response file tells the installer what to do and what to install. Depending on what is set there, what you are seeing is what would be expected.Specifically, theMQPREBOOTandMQPINUSEOKparms tell the installer whether or not to continue if a file it needs to update is in use. There are two likely outcomes here.1) The maintenance was applied correctly but because files were in use it will not show up until after a reboot.\n2) TheMQPINUSEOKparm told the installer to bail out if the files were in use.On Windows, even though the QMgr is stopped, the service continues running. Depending on theMQPINUSEOKsetting that would either cause the install to fail or to complete pending a reboot.It is worth noting that installinganythingon Windows requires a couple of reboots. The very first thing before running the install or upgrade is to reboot. That ensures that the registry is saved at the current values. It also ensures that if someone else's app has gone rogue with a memory leak or other issue, it gets cleared before your MQ install proceeds.After the install, reboot again to ensure the registry with the new MQ settings is saved. That's because if the server crashes, you want the last known good registry entry to be the one with your install or upgrade reflected in it. That also ensures the services still start as expected.Finally, I'm unsure what \"the installation instructions IBM suggested while downloading the fix pack\" are but the official instructions are in the Knowledge Center sectionWindows: Applying maintenance level upgrades on IBM MQ servers. Among the other information you will find there is that the location for the installation log is either specified in the response file or defaults toamqicsdn.txtin your TEMP directory (%TEMP%).\n"}
+{"text": "### Human: I am new to Message Queue. I am attemting to get messages from MQ Queue by using below code.I am creating one connection and getting every message from the queue using that connection. Is it right way of doing like this and whether i need to commit the connection.Infinite for-loop is right way to receive messages all the times from the queue, is it right?\nKindly advice me.try {\n createMQConnection(); // getting mq connection\n createMQSession(); // getting mq session\n createMQDestination(); // getting mq destination\n\n for ( ; ; ) { // infinite loop to receive message from Queue\n consumer = session.createConsumer(mqQueue);\n jmsTextMessage = (JMSTextMessage) consumer.receive(100);\n // Calling application method to process the requested message from queue\n }\n} catch (Exception e) {\n throw e;\n} finally {\n // closing consumer\n // closing session\n // closing connection\n}### Assistant: Is it right way of doing like thisDefine \"right.\" Depending on the business requirement, this could be right or it could be horrible. For example, with a 100ms wait time and a depth of zero messages the code will time out, throw a 2033 error (MQRC_NO_MSG_AVAILABLE), close the session, and exit. Is that what you want?Generally there is atry/catchblock enclosing theGETand that handles transient errors likeRC=2033if the intent is that the program remains running even when the queue is empty. In that case though, it's customary to set the timeout to 10 seconds or so. With 100ms timeout, the app as written would absolutely hammer the listener if it were modified to stay running.Also, the exception handling does not show any code for printing the linked exception. JMS exceptions are multi-level data constructs in which the transport provider's native error code is in the linked part of the exception. If the error handling doesn't look at the linked exception it cannot even tell the difference betweenMQRC=2033(no messages) versusMQRC=2035(authorization error). One of these is transient and should be survived by the program, the other is always fatal. At the very least, the code should either print the linked exception or else print a message stating no linked exception was found.So with regard to the loop and processing design, it's not possible to answer for values of \"right\" without knowing requirements. With regard to exception handling, definitelynotright as no linked exception processing is present....and whether I need to commit the connection.Depends. Is it OK to lose or duplicate messages? If so then transactions are not needed. Use of transacted sessions protects against loss of messages but not dupes. Use of XA 2-Phase Commit protects against both loss of messages and against dupes. The idea is to pick the class of service (generally referred to as \"At most once,\" \"At least once,\" or \"Once and only once\") that meets the business requirement and code accordingly.Infinite for-loop is right way to receive messages all the times from the queue, is it right?That's one way to do it. For high availability and high throughput, typically there are two or more instances of the application listening on the same queue. That way if one app server instance goes down (whether planned or unplanned) the other instance(s) continues to serve the queue. In general all of these instances listen on the queue with about a 10-second timeout.Also customary is that theGETon the queue specifiesMQGMO_FAIL_IF_QUIESCINGwhich allows the QMgr to interrupt the application when the MQ Admin tries to shut the QMgr down. If this option is not specified, the only to shut the QMgr down is to ask it to forcibly break the outstanding connections and this should only be done as a last resort.It's also possible to cause MQ to trigger the app to start when a message arrives on the queue. That's not typically done when the app runs on a JEE server but is very useful for stand=-alone apps.\n"}
+{"text": "### Human: I am using IBM MQ WebSphere client v 7.5 installed on an application server.To securely connect to the MQ queue manager I have to pass certificate whose Name should beibmwebspheremq + \"userid\". I put my code on the APP SERVER to test the MQ connectivity. If I specify domain user id it works fine for me but not for other domain users. So what certificate name should be used so that it works for all domain users??Certificate Label : ibmwebspeheremq.kdb located on the local pathcertificate Name: using strmqikm.exe, open above certificate and check the name\nAs of now this CN is \"ibmwebspheremq\" + 111111(domain userid) and it works fine for the domain user 111111 ,but for domain user 222222 it is throwing SSL errors.P.S. Security must be maintainedUpdate from OP comments on 11 Sept 2015I am using the .NET Application and done code through the help of IBM.WMQ interface provided with the dllamqmdnet. I have KDB certificates and I have just provided the local certificate's path in the configuration. I am able to access the MQ Server for the particular user on APP Server (where MQ client resides) but if I want to access for all users then how to? because in my case certificate label name (using strmqikm.exe) should be like ibmwebspheremq + userid. For individual users I am able to access the certificate by doing individual login to app server but not for all users at a time. There is only one certificate and as mentioned earlier it is non-JAVA application.### Assistant: The MQ client either uses IBM's C code or it uses Java and the JRE's JSSE provider. Each of these have different behaviors and requirements.The Java EE App Server will use the JSSE Provider and its rules for selecting a personal cert from the JKS. That may or may not include searching for a particular label. Anything using IBM's compiled C code APIwillrequire a specific label for the personal certificate in the KDB. Furthermore, the behavior has changed from version to version, as explained in IBM's TechnoteSpecifying the userid in the SSL certificate label for an MQ client.As explained in the Technote, the Java client uses standard Java methods for finding the personal certificate and is not dependent on the label at all. That requirement isonlyfor the non-Java client. The App server uses a JKS and the non-Java clients use a KDB. Since you did not mention converting certificates between JKS and KDB, I will assume that your testers are not using the C client or a KDB.Presumably then, your testers are using the same JKS as the app server. If they have the right path and the password to access it, and if it has a personal cert, they will be able to find and present the personal cert. If it has more than one personal cert, MQ has no control over how it selects which one it will present. That's a Java thing. If this is the problem the answer is simple - either use one personal cert and one keystore, or else each tester has their own JKS, each with its own personal cert.Security must be maintainedIn that case, the latter approach is preferred. Each tester should have their own JKS and their own personal cert.The other possibility is that you have a variety of certs, each of which is being found by the client and properly presented to the server, but that there's a cert exchange problem. If each developer has their own cert and those are all self-signed, the public portionmustbe in the QMgr's KDB to be accepted.If you want a more precise answer, you will need to providea lotmore detail such as what code, keystore, and certificate the testers are using to test with, whether these are self-signed certs, whether the testers are using the same app channel and testing from the same node, whether you are usingSSLCAUTH, etc. I would also recommend using the debugging procedure I outlined inthis answer.\n"}
+{"text": "### Human: How can i add new user to my queue in WebSphere 7.5 MQ Explorer?\nI have a 90 day trial version and I don't have a administrator console :/ I don't know why...I would like to connect to a queue that is placed on my server, but I can't connect with Administrator account.### Assistant: First off, go get the non-expiring version for which the product name isMQ Advanced for Developers. As of this writing, it is available in v7.5 and v8.0 and it is free. If you want support, IBM will let you throw money at them for that but the full-function, non-expiring product is free.MQ now ships secure by default. When you first create a queue manager it rejects administrative connections over client channels. It would allow non-admin channels overSYSTEM.ADMIN.SVRCONNexcept that until you explicitly authorize them non-administrators have no rights on the QMgr.(As of v8.0, the QMgr is also set by default to require ID and password but you needen't worry about this with MQ v7.5.)If you are using a Linux or Windows QMgr and can start MQ Explorer on the host where the QMgr is installed, connect to the QMgr using bindings mode rather than a channel. If you are using an administrative user ID (one in the mqm group or on Windows also the Administrators group) then bindings mode will work.If you must connect over a client channel, you will need to set up MQ to allow your administrative connection and/or low-privileged user connections. You can do this by disabling theCHLAUTHrules but that approach isstronglydiscouraged. Much better to learn how MQ security works than to disable it.You can also define newCHLAUTHrules that permit the connection. The defaultCHLAUTHrules look like this:dis CHLAUTH(*) all\n 1 : dis CHLAUTH(*) all\nAMQ8878: Display channel authentication record details.\n CHLAUTH(*) TYPE(BLOCKUSER)\n DESCR(Default rule to disallow privileged users)\n CUSTOM( ) USERLIST(*MQADMIN)\n WARN(NO) ALTDATE(2015-05-28)\n ALTTIME(15.10.02)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(SYSTEM.ADMIN.SVRCONN) TYPE(ADDRESSMAP)\n DESCR(Default rule to allow MQ Explorer access)\n CUSTOM( ) ADDRESS(*)\n USERSRC(CHANNEL) CHCKCLNT(ASQMGR)\n ALTDATE(2015-05-28) ALTTIME(15.10.02)\nAMQ8878: Display channel authentication record details.\n CHLAUTH(SYSTEM.*) TYPE(ADDRESSMAP)\n DESCR(Default rule to disable all SYSTEM channels)\n CUSTOM( ) ADDRESS(*)\n USERSRC(NOACCESS) WARN(NO)\n ALTDATE(2015-05-28) ALTTIME(15.10.02)Note that the first rule says to block admin users on any channel. You can add a new rule that says to block some non-admin user on the channel you want to use for administrators.runmqsc MYQMGRNAME\n\nDEFINE CHL(MY.ADMIN.SVRCONN) CHLTYPE(SVRCONN) MCAUSER('*NOACCESS') REPLACE\nDEFINE CHLAUTH(MY.ADMIN.SVRCONN) TYPE(ADDRESSMAP) ADDRESS(127.0.0.1) USERSRC(CHANNEL)\nDEFINE CHLAUTH(MY.ADMIN.SVRCONN) TYPE(BLOCKUSER) USERLIST('*NOBODY')TheDEF CHLcommand defines a new channel for administrators, and sets theMCAUSERto a value that insures that channel won't start.The firstCHLAUTHrule tells MQ to replace the badMCAUSERwith the one from the connection requestprovided the request comes from 127.0.0.1 and only forMY.ADMIN.SVRCONN. Fill in your own IP address here. Preferably instead use a certificate instead of an IP address to authenticate the connection.The secondCHLAUTHrule is a bit tricky. There is no 'ALLOW USERS' rule so we have to use a rule of typeTYPE(BLOCKUSER). But when we block users we have to provide a non-empty list of them. What we need is aCHLAUTHrule where the channel name is more specific than the default oneandwith aUSERLISTvalue that doesnotcontain*MQADMINor your actual user ID. I use*NOBODYhere because it makes it obvious that the intent is to not block anybody, and the value canneverbe an actual user ID.Defining a channel just for admins to use is considered a Best Practice. Authenticating administrators based on the IP address or hostname is not. Once you get connected with your admin ID and get your QMgr configured, consider learning enough about MQ certificates to strongly authenticate administrator connections. And/or go to a V8.0 QMgr and client where you can log on using a password.\n"}
+{"text": "### Human: When using MQ Light service in Bluemix, is there an API to delete a Topic / Queue using MQLight? Or mark a Topic / Queue to be auto deleted?### Assistant: When you create a subscription, you can specify the TTL \"time to live\". If time to live counts down to zero, then MQ Light will delete the destination by discarding any messages held at the destination and not accruing any new messages.The default value for this property is0- which means the destination will be deleted as soon as there are no clients subscribed to it.Refer to theIBM MQ Light Client Moduledocumentation for more details about the Node.js API. Here are some various examples for setting TTL:Set it using theclient.subscribe(...)API call:client.subscribe(\"my/replies\", \"shareGroup1\", \n { ttl: 300000, qos: mqlight.QOS_AT_LEAST_ONCE, autoConfirm: true },\n msgArrivedCallback);or set it as an options variable:var options = {\n ttl: 60000 ,\n qos: 1,\n credit: 1,\n autoConfirm: false\n};for methods like inclient.send(...)andclient.unsubscribe(...).\n"}
+{"text": "### Human: I have a cloud server that sits behind the firewall (cloud-server.cat.com).I can RDP into it by creating a firewall rule usingVMware vCloud Director.I checked and the outbound rule has been created forport 1414oncloud-server.cat.comI need to be able to connectcloud-server.cat.comtoIBM WebSphere MQthat's on server here locally (phoenix.cat.com).I can connect using port1414from one of the local test servers, but not fromcloud-server.cat.comserver.I get following error:MQJE001: Completion Code '2', Reason '2059'.\nA WebSphere MQ error occurred : Completion code 2 Reason code 2059\n\ncom.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2059'.\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:\n236)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnecti\non(MQClientManagedConnectionFactoryJ11.java:504)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnectio\nn(MQClientManagedConnectionFactoryJ11.java:545)\n at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.jav\na:95)\n at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConne\nctionManager.java:184)\n at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueMana\ngerFactory.java:870)\n at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:7\n56)\n at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManager\nFactory.java:704)\n at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFac\ntory.java:170)\n at com.ibm.mq.MQQueueManager.(MQQueueManager.java:598)\n at MsgQueue.DPGReceiver.main(DPGReceiver.java:177)\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9204: Connection to ho\nst 'phoenix.cat.com(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;R\nC=2059;AMQ9213: A communications error for occurred. [1=java.net.ConnectExcepti\non[Connection timed out: connect],3=phoenix.cat.com]],3=phoenix.cat.com(\n1414),5=RemoteTCPConnection.connnectUsingLocalAddress]\n at com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiConnect(RemoteFAP.java:\n1689)\n at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:929)\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:\n225)\n ... 10 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9213: A communications\n error for occurred. [1=java.net.ConnectException[Connection timed out: connect\n],3=phoenix.cat.com]\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.connnectUsingLoca\nlAddress(RemoteTCPConnection.java:603)\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.protocolConnect(R\nemoteTCPConnection.java:938)\n at com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.connect(Remot\neConnection.java:1065)\n at com.ibm.mq.jmqi.remote.internal.system.RemoteConnectionPool.getConnec\ntion(RemoteConnectionPool.java:392)\n at com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiConnect(RemoteFAP.java:\n1407)\n ... 12 more\nCaused by: java.net.ConnectException: Connection timed out: connect\n at java.net.DualStackPlainSocketImpl.connect0(Native Method)\n at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)\n at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)\n at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)\n at java.net.AbstractPlainSocketImpl.connect(Unknown Source)\n at java.net.PlainSocketImpl.connect(Unknown Source)\n at java.net.SocksSocketImpl.connect(Unknown Source)\n at java.net.Socket.connect(Unknown Source)\n at java.net.Socket.connect(Unknown Source)\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection$2.run(RemoteTCPCo\nnnection.java:588)\n at java.security.AccessController.doPrivileged(Native Method)\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.connnectUsingLoca\nlAddress(RemoteTCPConnection.java:579)\n ... 16 moreDoes anyone know if this is onWebSphere'send or it's because mycloud-server.cat.com?### Assistant: That's really hard to say with the information provided. There may be firewall rules inbound onphoenix.cat.com, host-based firewall rules on any of the servers, IPSec or any other number of issues at the network level.At the QMgr level, it's possible that the listener is not running or not listening on the port you expect.Generally, before trying to test the MQ connectivity, it is a good idea to verify the underlying network connectivity. You can do this by telnetting from the client-side to the QMgr side on the desired port. If this works you will get a socket that hangs and after disconnecting you will see an FDC file in the QMgr's global errors directory. Until that low-level test works, it is guaranteed that MQ willnotwork.However, if you are able to telnet from the client box to the QMgr host successfully and still get 2059, it is time to look at MQ's configuration. There are security-related errors that give a very opaque error code to the client because that is just Good Security Practice. In the case that it is an MQ security problem, there will be very detailed error messages on the QMgr side in its error logs and, assuming you have auths events enabled, emitted as event messages.But, as mentioned earlier, it is a waste of time to look for MQ errors until and unless it is possible to connect from the client host to the MQ host using telnet on the MQ port. So do the Telnet thing first, then check for MQ errors.\n"}
+{"text": "### Human: //snippet\nMQEnvironment.properties = GetConnectionProperties(); \n\n_queueManager = new MQQueueManager(QueueManager); \n\n//end of snippet\n\n private Hashtable GetConnectionProperties()\n {\n Hashtable properties = new Hashtable();\n properties.Add(MQC.USER_ID_PROPERTY, Environment.UserName);\n properties.Add(MQC.HOST_NAME_PROPERTY, MQHostname);\n properties.Add(MQC.PORT_PROPERTY, MQPortNumber);\n properties.Add(MQC.CHANNEL_PROPERTY, MqChannel); \n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT); \n\n if (_useSSL)\n {\n properties.Add(MQC.SSL_CIPHER_SUITE_PROPERTY, CipherSuite);\n properties.Add(MQC.SSL_PEER_NAME_PROPERTY, SslPeerName); \n properties.Add(MQC.SSL_CIPHER_SPEC_PROPERTY, CipherSpec);\n properties.Add(MQC.SSL_FIPS_REQUIRED_PROPERTY, FipsRequired);\n properties.Add(MQC.SSL_CERT_STORE_PROPERTY, SslKeyRepository); \n }\n\n return properties;\n }\n\nthrows {\"MQRC_KEY_REPOSITORY_ERROR\"}the sslkeyRepository is just a directory location which contains .tab .arm .crl .crt .jks .kdb .rdb .sth filesAny ideas what i am missing here?### Assistant: SslKeyRepository must point to a .kdb file and not to a directory as you have done. For example a client application will code for certificate store property as:properties.Add(MQC.SSL_CERT_STORE_PROPERTY, \"C:\\\\MyApp\\\\SSL\\\\client_certstore\");Also note that I have not suffixed the file extension to keystore file name. MQ client will automatically add the \".kdb\" extension. Please see thislinkfor more details.Also you need to set only SSL_CIPHER_SUITE_PROPERTY in your application. You don't set SSL_CIPHER_SPEC_PROPERTY. See the tablehere.\n"}
+{"text": "### Human: I am new to the whole WebSphere world, so I dont know how else to ask this.Basically, my app already has a QCF, as well as an inbound and outbound queue set up. I was told a while ago that this environment never had its MQ settings tested properly so its unverified if they work correctly.Currently I am experiencing problems with my service that uses MQ in this environment and I want to somehow test these connections explicitly. Is there a way to do this like there is for testing the database connection in WebSphere, with a simply click of a button or something?As I said, I am new to the WebSphere world so I can probably taking some things for granted.### Assistant: When you are setting up connection factory, you have a test connection button, which tests connection to the queue manager. Unfortunately this button is available only during creation of connection factory. There is no similar 'Test connection' functionality like in Data sources.I usually use my custom very simple application, which takes qcf and queue from jndi, connects, sends and receives test message.To just verify that the network is set up correctly, you could usetelnet qmHost qmPortfrom application server machine.If you are getting some exceptions, provide a stacktrace, it might tell something more about your problem\n"}
+{"text": "### Human: SourceLogPrimaryFiles=3|2-254 (Windows)|2-510 (UNIX systems)The log files allocated when the queue manager is created.LogSecondaryFiles=2|1-253 (Windows)|1-509 (UNIX systems)The log files allocated when the primary files are exhausted.From what I understand, these log files are a part of transaction log.Now, while creating the Queue Manager if I were to use the following settings,LogPrimaryFiles=2 \nLogSecondaryFiles=8 \nLogFilePages=16384 \nLogType=CIRCULAR \nLogBufferPages=0 \nLogPath=/var/mqm/log/QMGRA/ \nLogWriteIntegrity=TripleWriteI would like to know what happens after the 8 secondary log files are exhausted, i.e a scenario where all primary and secondary log files are filled.Next, if I were to use these settings,LogPrimaryFiles=2 \nLogSecondaryFiles=8 \nLogFilePages=16384 \nLogType=LINEAR\nLogBufferPages=0 \nLogPath=/var/mqm/log/QMGRA/ \nLogWriteIntegrity=TripleWriteIn this case I would like to know what happens after,all primary log files are exhausted.all secondary log files are exhausted.Also, when the Queue Manager needs to be restored, a restart of the Queue Manager is required. The queue manager will be restored from the last sync point that is defined in the transaction logs. However, I am confused as to where this sync point is located. Is it in the Primary log file or the secondary log file, or is it such that it may exist in either of them?### Assistant: with either linear or circular logs, once the primary and secondary extents are filled with messages under syncpoint, the QMgr will start rolling back transactions to release some log space. There is a misconception that linear logs can handle any number of messages under syncpoint because they are not reused.With linear logs, all persistent messages are captured in the log and those under syncpoint must fit within primary and secondary extents.With circular logs, only messages under syncpoint are captured in the log.The last point of consistency isalwaysthe oldest active log extent. Please see the Infocenter sectionDetermining superfluous log filesfor more details. Alsop, have a look atMission:Messaging: Circular logs vs. linear logsfor a deeper explanation.\n"}
+{"text": "### Human: I am constructing a messaging system using MQSeries. For some reason, when I perform q.get(...), I am getting an exception thrown (I don't know the specific MQException). Below is the code causing the error:private static MQGetMessageOptions GMO = new MQGetMessageOptions();\nprivate static int GMO_OPTIONS = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_WAIT;\nGMO.options = GMO.options | GMO_OPTIONS;\nGMO.waitInterval = MQC.MQWI_UNLIMITED;\n\nMQEnvironment.hostname = args[0];\nMQEnvironment.channel = args[2];\nMQEnvironment.port = Integer.parseInt(args[1]);\nMQQueueManager queueManager = new MQQueueManager(args[3])\n\nMQMessage msg = new MQMessage();\nMQQueue q = queueManager.accessQueue(\"qName1\",MQC.MQOO_OUTPUT);\nq.get(msg, GMO);My plan is, when this error occurs, skip the message and delete it. To perform the delete I will call the following function:private void deleteMsg(MQQueueManager queueManager, String queueName) throws MQException {\n MQGetMessageOptions tempGmo = new MQGetMessageOptions();\n tempGmo.options |= MQC.MQGMO_WAIT;\n tempGmo.waitInterval = 1000;\n MQQueue remover = queueManager.accessQueue(queueName, MQC.MQOO_INPUT_AS_Q_DEF);\n remover.get(new MQMessage(), tempGmo);\n queueManager.commit();\n}Would the remover.get() in my deleteMsg function also, in this specific scenario, fail for the same reason? Or does the option used to construct the MQQueue(MQC.MQOO_INPUT_AS_Q_DEF vs MQC.MQOO_OUTPUT) prevent it from also failing? If I am having trouble accessing my queue's message, how do I discard the top message and move to the next?To shorten my question:\nIf I am unable to perform a get() on a given queue to retrieve a message, how can we delete that corrupt message on the same queue?Thank you!### Assistant: OMG!MQQueue q = queueManager.accessQueue(\"qName1\",MQC.MQOO_OUTPUT);\nq.get(msg, GMO);Your are opening a queue for output (writing) but you are trying to get a message. You have your shoes on the wrong feet!! Secondly, why aren't you catching the MQException that MQ would be throwing?? The exception would have included the reason code which would have given you the exact explanation to your issue.Here's how you should be opening the queue for reading:try\n{\n int oo = MQC.MQOO_INPUT_SHARED + MQC.MQOO_FAIL_IF_QUIESCING;\n MQQueue q = queueManager.accessQueue(\"qName1\",oo);\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n gmo.options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING;\n q.get(msg, gmo);\n}\ncatch (MQException e)\n{\n System.err.println(e.getLocalizedMessage() );\n System.err.println(\"CC = \" + e.completionCode + \" - RC = \" + e.reasonCode);\n}Also, make sure you use the appropriate \"Fail if quiescing\" option for the particular MQ API call.Finally, look up \"backout queue\". If your application is having an issue with a message then the message should be moved to a backout queue and not simply deleted.\n"}
+{"text": "### Human: I am using the MQ.NET classes of the MQ 7x client, and importing and exporting messages works fine. However, if there is a network disconnect or the remote manager is disconnected, the IBM MQ client doesn't automatically reconnect. I get:Error: Remote host ' not available, retry later.Is there a way to auto-connect and continue processing the message when these kind of issues occur?There is a property to check the connection of the queue manager:mqQMgr = new MQQueueManager(\"My queue manager name\" ,\"my channel name\",\",my connection name\");mqQMgr.IsConnectedreturns true/false, but this doesn't help to auto-connect.This is what i am using:// mq properties\n Hashtable properties = new Hashtable();\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED); \n properties.Add(MQC.CONNECTION_NAME_PROPERTY, \"connectionName\"); \n properties.Add(MQC.CHANNEL_PROPERTY, \"channelName\");\n properties.Add(MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_RECONNECT_Q_MGR);\n\n mqQMgr = new MQQueueManager(\"my queue manager\"), properties); //error thrownI get this error on the above lineIBM MQException caught in send message - reason code - 2046- message -CompCode: 2, Reason: 2046\n{\"MQRC_OPTIONS_ERROR\"}\nbase {System.ApplicationException}:\n{\"MQRC_OPTIONS_ERROR\"}\nCompCode: 2\nCompletionCode: 2\nMessage: \"MQRC_OPTIONS_ERROR\"\nReason: 2046### Assistant: Automatic client reconnection is supported by MQ C# client from v7.1 onwards. You have to useMQCNO_RECONNECTorMQCNO_RECONNECT_Q_MGRorMQCNO_RECONNECT_AS_DEFCNO option to enable automatic reconnection. MQ v7.1 ships couple of samples, SimpleClientAutoReconnectPut.cs is one of them. Please refer to the sample for detail.Simple snippet.mqQMgr = new MQQueueManager(\"QM\", MQC.MQCNO_RECONNECT,\"SVRCONNCHN\",\"localhost(1414)\");\n"}
+{"text": "### Human: How can we browse all the messages in a WebSphere MQ queue in one API call using java?Here is the code which I'm using. Here I'm using this code aforloop until q depth is reached.MQGetMessageOptions gmo=new MQGetMessageOptions();\n gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT ;\n //System.out.println(\"Status: \"+i);\n MQMessage out=new MQMessage(); \n out.format =MQC.MQFMT_XMIT_Q_HEADER;//MQC.MQFMT_REF_MSG_HEADER; \n mqCon.getQue().get(out,gmo);\n System.out.print(i);How can I get all messages without usingforloop? It's taking a long time to browse 10,000 messages.### Assistant: How can I get all messages without using for loop?Use awhileloop. Sorry, could not resist a slightly snarky answer on that one. WMQ does not have an API call analogous to the SQLselectstatement. Messaging and databases share some traits but address fundamentally different requirements.It's taking a long time to browse 10,000 messages.Take a look at the Performance SupportPacs. These are published on theSupportPacs main pageand have names beginning with MP. Find the one for your platform and MQ version and it will list different scenarios for putting and getting messages as well as performance tuning recommendations.I would also ask why a normal app needs to browse 10,000 messages. The QMgr will select messages for you based on MsgID, Correlation ID or property and this ismuchfaster than browsing all the messages in order for the application to find the ones of interest. Occasionally people need to browse all messages on a queue to archive the queue or to debug a problem, but this is the exception rather than the rule. If a Production app regularly browses all messages on a queue, then the queues may have been inappropriately used as a database.\n"}
+{"text": "### Human: How can you create a new queue programmatically using theMQQueueManagerandMQQueueobjects?Is there a guide on how to use these classes? The javadocs don't say much.### Assistant: To create a dynamic queue, you just open a model queue. The dynamic queue is created and you get back a handle to it. The name of the queue is provided as well and you can place that in the Reply-To-Queue field of a request message.If you want to create a permanent queue, have a look atcom.ibm.mq.pcfin the Infocenter. To execute any WMQ admin command from an application, submit a Programmable Command Format (PCF) message to theSYSTEM.ADMIN.COMMAND.QUEUE. The application must be authorized to put a message onto the queue for this to work. Furthermore, the command server will use the user ID in the message header to look up authorizations for the specific command being executed. To create a queue, the submitter must have+crtauthority on queues.Note that any person or app with the ability to create a permanent queue is a defacto administrator. If their ID is not authorized to create authorization control list entries, they need only to create an alias over the command queue and can then spoof the administrative user ID. For this reason, it is rare that any non-administrator would be granted rights to create queues.\n"}
+{"text": "### Human: My app (a spring message listener) reads from a queue and writes to the database in a single transaction. I use Atomikos to provide the XA transaction behaviour. When the app is abruptly terminated with kill statements for example, I see messages are lost. Is there any specific configuration I need to use? Should the queues be persistent? Currently the queues are non-persistent. My MQ version is v7.1.Spring config for listener container looks like:\n \n \n \n \n \n \n \n \n \n \n \n \nAny other info will be given as needed.Thanks.### Assistant: The client you are using must be the Extended Transactional Client if downloaded prior to May of this year. Any of the V7.0.1 and higher clients as of May 2012 have the XA capability built in. If in doubt, go download a current release of the WMQ client and install.Second, the XA transaction manager must have it's own connection to the queue manager independent of the application. This is so that it can connect and reconcile the transactions if the application fails to restart. To do this, the transaction manager must be configured with an XX_OPEN string and a switch file as described in the Infocenter topicConfiguring XA-compliant transaction managers.For what its worth, there is no such thing as a persistent queue in WMQ. It is the messages themselves that are persistent (or not). For more on that, please seemy blog post on the topic. This is a rather important topic because when people assume that the queue itself is persistent they tend to devise solutions that produce unexpected results. Please read the blog post!\n"}
+{"text": "### Human: Below is the related part from a QMGR log file about a WMQ channel issue:-------------------------------------------------------------------------------\n2012-7-23 10:35:25 - Process(340.1) User(MUSR_MQADMIN) Program(runmqchl.exe)\nAMQ9206: Error sending data to host 86.0.223.5(1602) \u3002\n\nEXPLANATION:\nAn error occurred sending data over TCP/IP to 86.0.223.5(1602). This may be due to\na communications failure.\nACTION:\nThe return code from the TCP/IP(send) call was 10054 X('2746'). Record these\nvalues and tell your systems administrator. \n----- amqccita.c : 2612 -------------------------------------------------------\n2012-7-23 10:35:25 - Process(340.1) User(MUSR_MQADMIN) Program(runmqchl.exe)\nAMQ9999: Channel program ended abnormally. \n\nEXPLANATION: \nChannel program 'CZWJNS.CZWJCZ' ended abnormally. \nACTION: \nLook at previous error messages for channel program 'CZWJNS.CZWJCZ' in the \nerror files to determine the cause of the failure. \n----- amqrccca.c : 834 --------------------------------------------------------\n2012-7-23 10:35:35 - Process(3616.1) User(MUSR_MQADMIN) Program(runmqchl.exe)\nAMQ9002: Channel \u201cCZWJNS.CZWJCZ' is starting\u3002\n\nEXPLANATION\uff1a\nChannel \u201cCZWJNS.CZWJCZ' is starting\u3002\nACTION\uff1a\nNone\u3002 \n-------------------------------------------------------------------------------\n2012-7-23 10:40:35 - Process(3616.1) User(MUSR_MQADMIN) Program(runmqchl.exe)\nAMQ9206: Error sending data to host 86.0.223.5(1602) \u3002\n\nEXPLANATION:\nAn error occurred sending data over TCP/IP to 86.0.223.5(1602). This may be due to\na communications failure.\nACTION:\nThe return code from the TCP/IP(send) call was 10054 X('2746'). Record these\nvalues and tell your systems administrator. \n----- amqccita.c : 2612 -------------------------------------------------------\n2012-7-23 10:40:35 - Process(3616.1) User(MUSR_MQADMIN) Program(runmqchl.exe)\nAMQ9999: Channel program ended abnormally. \n\nEXPLANATION: \nChannel program 'CZWJNS.CZWJCZ' ended abnormally. \nACTION: \nLook at previous error messages for channel program 'CZWJNS.CZWJCZ' in the \nerror files to determine the cause of the failure. \n----- amqrccca.c : 834 --------------------------------------------------------\n2012-7-23 10:40:45 - Process(4848.1) User(MUSR_MQADMIN) Program(runmqchl.exe)\nAMQ9002: Channel \u201cCZWJNS.CZWJCZ' is starting\u3002\n\nEXPLANATION\uff1a\nChannel \u201cCZWJNS.CZWJCZ' is starting\u3002\nACTION\uff1a\nNone\u3002\n-------------------------------------------------------------------------------Right now, the situation is that the target channel (CZWJNS.CZWJCZ) can finally run, but only after a few retry attempts. It keeps happening often. All the messages can be delivered to the target queue in the remote QMGR host successfully. However, they're always delayed due to the multiple retry attempts.I've searched through the internet for the return code10054and it means the connection has been reset by the peer.My WMQ version is 6.0.10 on Windows 2003.### Assistant: The \"Connection reset by peer\" means that something between this node and the other node closed the connection. The cause can range from dodgy/noisy network, to firewall timing out, to channel exits that refuse the connection, or many other causes.The key to diagnosis in these cases is to narrow down the cause. This requires looking at the error logs on both QMgrs (or the client and QMgr) for the same event. In the case of a channel exit, a look at the channel definitions on both sides reveals whether such an exit is in place but if it is then you need to look at the exit's configuration and logs as well.If the problem is in the network, the error logs from both QMgrs will show similar errors. However if one QMgr closed the connection intentionally then you will see that in its log files.\n"}
+{"text": "### Human: I'm preparing a test environment to connect to Websphere MQ 7.0 through SSL, so I have to configure SSL on Websphere MQ myself before I startconfiguring the SSL connection from JMS side.So, I'm trying to create SSL certificates for Websphere MQ, followingthesesteps. But when I attempt to add the signed certificate to the repository using the commandgsk7cmd.exe -cert -receive -db key.kdb -pw pass -file QMANAGER_signed.armI get the error:An attempt to receive the certificate has failed.\nAll the signer certificates must exist in the key database.I even tried the C commandgsk7capicmdbut it also fails, with the error:Error: 146\n\nError id: GSKKM_ERR_INVALID_CERT_CHAIN\nDetails: QMANAGER_signed.armUPDATE 1:I used the WMQ SSL Wizard to create the proper configuration. The configuration went smoothly, but when I run the JMS sample included with the SSL Wizard I get the error:MQJE001: Completion Code '2', Reason '2397'the SSL logs (using the option-Djavax.net.debug=all) shows the following error:Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeExcep\ntion[Remote host closed connection during handshake],3=localhost/127.0.0.1:1414 (localhost),4=SSLSocket.startHandshake,5\n=default]\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:995)\n at com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.connect(RemoteConnection.java:989)\n at com.ibm.mq.jmqi.remote.internal.system.RemoteConnectionPool.getConnection(RemoteConnectionPool.java:293)\n at com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiConnect(RemoteFAP.java:1371)\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:331)\n ... 7 more\nCaused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake\n at com.ibm.jsse2.jc.a(jc.java:380)\n at com.ibm.jsse2.jc.g(jc.java:115)\n at com.ibm.jsse2.jc.a(jc.java:240)\n at com.ibm.jsse2.jc.startHandshake(jc.java:54)\n at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:989)\n ... 11 more\nCaused by: java.io.EOFException: SSL peer shut down incorrectly\n at com.ibm.jsse2.a.a(a.java:7)\n at com.ibm.jsse2.jc.a(jc.java:493)\n ... 15 moreUPDATE 2:Using T.Rob's diagnostic technique mentioned in his answer, I'm still stuck at point #3 with the same error as before.### Assistant: The error that you are seeing is because your keystore does not have the signing CA's root and/or intermediate signer certificates. When you get a signed certificate back from the Certificate Authority it must be validated before adding it to the keystore. Pretty much anyone could have intercepted your signing request and signed the certificate. The step of validating it when received insures that it was signed by a CA that you actually trust and not some anonymous man-in-the-middle.The way the cert is validated is by checking the CA signature against the public key of the CA that is in your KDB. For that the CA's certificate must already be in the KDB when you attempt to receive your signed cert. If the CA uses an intermediate signer certificate (and for a variety of reasons any commercial CAwilluse intermediate certs) then you must also have imported the intermediate certandthe root cert. This forms a certificate chain or certificate path from the CA's root cert through any intermediate certs to your signed certificate. Each thing in the chain is authenticated by the thing above it until you get to the root. Your KDBmusthave the entire chain and because each cert is validated by the one above it, youmustimport these beginning with the root and working your way down.Typically your CA will have posted their signer certs on their web site where you retrieve them using SSL. Fetch those and import them and you will be able to receive your signed cert.As it happens, The Sphere Online Journal just published an article that walks you through this process using Verisign as an example, and with screen shots of importing the root and intermediate signer certs. The article is aboutRenewing WebSphere MQ Certificatesbut the first part of the article creates a kdb file and a signing request, then imports the CA certs and the signed cert.Let's also get you to the correct Infocenter. Please look at the WMQ v7.0 Infocenter's section onUsing CA Signed Certificates. The one you were looking at is for Message Broker and quite frankly the article you linked to is a bit of a mess. I'll see about getting it fixed. For starters, that bit about creating the cert in one kdb, getting it signed, then exporting it, deleting it and importing it to the QMgr's KDB is pure rubbish. Just generate the CSR in the QMgr's own KDB file and receive the signed cert directly to it. This is much easier and is the process illustrated in the article mentioned above.Finally, if you go tot-rob.netand download the WMQ Security Lab from IMPACT 2011 you will find there a lab guide and some scripts. These use self-signed certificates but the scripts can easily be converted to use CA signed certificates and then tailored for use in your WMQ network.UPDATE:Responding to he additional questions in the comments:I'm actually planning to use a self-signed certificate, so I guess I only need to extract it and adding it to the client's trust store?Yes, that is correct. But here's a problem in the WMB Infocenter page that was originally linked in that it asks you to create a cert with the labelqmgrnameinstead ofibmwebspheremqqmgrname. The QMgr finds its cert based on the label and so itmustmatch the specified format. So when you create your self-signed cert, mke sure that the label is the literalibmwebspheremqwith the QMgr name folded to lower case appended. If you have made a cert with the wrong label, you can always export it to a P12 file and then import it to a new KDB with the right label.I used the WMQ SSL Wizard mentioned in the WMQ Security Lab to create the proper configuration. The configuration went smoothly, but when I run the JMS sample included with the SSL Wizard I get the errorMQJE001: Completion Code '2', Reason '2397', the SSL logs shows the following errormain, received EOFException: error main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake main, SEND TLSv1 ALERT: fatal, description = handshake_failureThere are a few reasons why that might occur. Rather than going through all of them, I'll suggest some diagnostic techniques. When I set up SSL channels, I always use the following procedure:Get the channel running without SSL. This proves that the basic communication path is working (listener running, ports match, channel object definitions match, etc.).If this is the first time that the QMgr is using SSL, or if the kdb has changed, be sure to issue theREFRESH SECURITY TYPE(SSL)command.Enable SSL by specifying the same ciphersuite at the QMgr and client but be sure that the QMgr's SVRCONN channel is set toSSLCAUTH(OPTINAL) SSLPEER(). This verifies that theclientacceptsthe QMgr'scertificate. Only when this works, go to the next step.Now change the QMgr's SVRCONN toSSLCAUTH(REQUIRED) SSLPEER(). This causes the QMgr to request the client's certificate.If usingSSLPEERset it to the desired value.This process isolates the possible problems so that at any point you know where to look. If the process fails in Step #3 then there is either an issue with the SSL configuration of the application, or it cannot validate the QMgr's cert. If the process fails in Step #4 then we know the application's SSL configuration is sound and that it likes the QMgr's cert bu that the QMgr doesn't like the application cert. If we get to Step #5 then it's just a matter of getting theSSLPEERvalue correct.Because you got a handshake failure that appears to be due to the QMgr closing the TCP connection, I am assuming that you haveSSLCAUTH(REQUIRED)(which is the default, by the way) and that either the QMgr doesn't have the application's certificate or that you were attempting to use an anonymous connection where the client doesn't require a personal cert. If that is the case, settingSSLCAUTH(OPTIONAL)will get you past the point of failure - although possibly to an entirely new point of failure.\n"}
+{"text": "### Human: I need to write a Java client listening to WebSphere MQ Server. Message is put into a queue in the server.I developed this code, but am not sure it is correct or not. If correct, then how can I test it?This is a standalone Java project, no application server support. Which jars I should put into classpath?I have the MQ settings, where I should put into my codes? Standard JMS can skip these settings? confusing ....import javax.jms.Destination;\nimport javax.jms.Message;\nimport javax.jms.MessageConsumer;\nimport javax.jms.MessageListener;\nimport javax.jms.Queue;\nimport javax.jms.QueueConnection;\nimport javax.jms.QueueConnectionFactory;\nimport javax.jms.QueueReceiver;\nimport javax.jms.QueueSession;\nimport javax.jms.Session;\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\n\npublic class Main {\n Context jndiContext = null;\n QueueConnectionFactory queueConnectionFactory = null;\n QueueConnection queueConnection = null;\n QueueSession queueSession = null;\n Queue controlQueue = null;\n QueueReceiver queueReceiver = null;\n\n private String queueSubject = \"\";\n\n private void start() {\n try {\n queueConnection.start();\n\n queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n Destination destination = queueSession.createQueue(queueSubject);\n MessageConsumer consumer = queueSession.createConsumer(destination);\n consumer.setMessageListener(new MyListener());\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n private void close() {\n try {\n queueSession.close();\n queueConnection.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n private void init() {\n try {\n jndiContext = new InitialContext();\n queueConnectionFactory = (QueueConnectionFactory) this.jndiLookup(\"QueueConnectionFactory\");\n queueConnection = queueConnectionFactory.createQueueConnection();\n queueConnection.start();\n } catch (Exception e) {\n System.err.println(\"Could not create JNDI API \" + \"context: \" + e.toString());\n System.exit(1);\n }\n }\n\n private class MyListener implements MessageListener {\n @Override\n public void onMessage(Message message) {\n System.out.println(\"get message:\" + message);\n }\n }\n\n private Object jndiLookup(String name) throws NamingException {\n Object obj = null;\n\n if (jndiContext == null) {\n try {\n jndiContext = new InitialContext();\n } catch (NamingException e) {\n System.err.println(\"Could not create JNDI API \" + \"context: \" + e.toString());\n throw e;\n }\n }\n try {\n obj = jndiContext.lookup(name);\n } catch (NamingException e) {\n System.err.println(\"JNDI API lookup failed: \" + e.toString());\n throw e;\n }\n return obj;\n }\n\n public Main() {\n\n }\n\n public static void main(String[] args) {\n new Main();\n\n }\n}MQ Queue setting\n AAA\n 1423\n ddd\n EEE.CLIENTS.00\n PKIJCExit\n 1\n 1\n \n \n \n GGGG.NY.00\n false\n 1\n 1\n \n### Assistant: There is an article with sample codeRunning a standalone Java application on WebSphere MQ V6.0which walks you through most of your questions, including how you might test with a free WMQ trial install. The main difference (as discussed in the comments) to v7 or v7.1 is that there is no broker component to start if you want to use topics. Other than that, the article should work fine with the current WMQ client and/or server.In addition, please refer to theWebSphere MQ Using Javamanual (v7.0 client) or theUsing WebSphere MQ Classes for Javamanual (v7.1 client) for the appropriateCLASSPATHand other settings for your client. Remember to use the Infocenter appropriate to your client version and not to the server version. You can mix and match client and server version but you get only the features supported by the server. For example, using the WMQ v7.1 client with the WMQ v7.0 server is perfectly valid.Finally, there are a number of sample programs supplied with the free client download that do exactly what you are describing. Some use JNDI to lookup the WMQ resources, others use Java methods and can be populated with standard Java property files. The ones with a-nojndioption show how to initialize your WMQ objects in the code at run time. These are under[WMQ Install path]\\tools\\wmqjava\\samples...in the latest Windows client install (SupportPac MQC71). You can also use the v7.0 client (SupportPac MQC7). I would recommend using the samples to get started rather than starting from scratch. Why reinvent the wheel, right?In addition to the many sample programs, the vendor install includes all of the requisite jar files. Note that what goes in theCLASSPATHchanges by WMQ client version so refer to the Infocenter. The later versions are much simpler and require only a couple of jar files in theCLASSPATH.If you want todownload the WMQ trialfor testing and do not have Administrator rights on your Windows workstation, you can install it easily on a RedHat or SUSE virtual machine. With a bit of massaging you can also easily install on Ubuntu as described in an Andy Piperblog post.\n"}
+{"text": "### Human: I've been trying to get some performance statistics out of IBM WebSphere MQ to monitor with Spring Source's Hyperic HQ.I'm after the message enqueue and dequeue rate along with queue depth of a few local queues to ensure messages are being delivered to and consumed by our local application.Initially attempted to retrieve the data using WMI and windows performance counters however it seems that on one of our servers the counters aren't available for any of the local queues (just a load of temporary queues) and on the other the counters are available but don't always return a value correctly though WMI.I've tried PCF (usingMQIA_MSG_DEQ_COUNT) which wouldn't provide the counter requested. MQSC (UsingDISPLAY QUEUE&DISPLAY QSTATUS) which didn't seem to support the queuing rates - only providing last message get / put date and time.Anyone got an idea how to either get WMI and performance counters working correctly or an alternative to WMI that would provide the statistics I need?### Assistant: RegardingMQIA_MSG_DEQ_COUNT, you should be aware that theRESET_QUEUE_STATISTICScommand which returns this attribute is what I like to call the \"quantum physics property of WMQ\" because the act of observing the value resets the value. This is fine if you are the only one inquiring on the value and you have only one thread of inquiry. But if you have multiple inquiries going at once, they all reset the counter to zero at each inquiry, each one stepping on the other one's numbers. This aspect rendersRESET_QUEUE_STATISTICSof limited use for real-time debugging and not suitable for reliable statistics gathering.An alternative is to use MQ's Accounting and Statistics facility. In order to get the QMgr to produce Accounting and Statistics messages, it is necessary to enable them either at the QMgr or on a per-queue basis. The instructions for how to enable them are in the manual sectionQueue statistics information.Note that the statistics are reported to an event queue and must be fetched and parsed. The documentation reference on parsing the event messages is in theQueue statistics message datasection. There is a sample program in source format namedamqsmonthat shows how to fetch and format the statistics messages. The compiled version is also supplied to provide a human-readable listing of such messages.Once you enable the statistics on the queue(s) of interest and have a way to parse the messages, simply point your parser at the appropriate event queue and collect the stats. An example of the output of amqsmon showing the stats available follows:RecordType: QueueStatistics\n QueueManager: 'saturn.queue.manager'\n IntervalStartDate: '2005-04-30'\n IntervalStartTime: '15.09.02'\n IntervalEndDate: '2005-04-30'\n IntervalEndTime: '15.39.02'\n CommandLevel: 600\n ObjectCount: 3\n QueueStatistics:\n QueueName: 'LOCALQ'\n CreateDate: '2005-03-08'\n CreateTime: '17.07.02'\n QueueType: Predefined\n QueueDefinitionType: Local\n QMinDepth: 0\n QMaxDepth: 18\n AverageQueueTime: [29827281, 0]\n PutCount: [26, 0]\n PutFailCount: 0\n Put1Count: [0, 0]\n Put1FailCount: 0\n PutBytes: [88, 0]\n GetCount: [18, 0]\n GetBytes: [52, 0]\n GetFailCount: 0\n BrowseCount: [0, 0]\n BrowseBytes: [0, 0]\n BrowseFailCount: 1\n NonQueuedMsgCount: 0\n ExpiredMsgCount: 0\n PurgedMsgCount: 0This and other examples are provided in the manual in a section entitled, appropriately enough,amqsmon examples.\n"}
+{"text": "### Human: i am looking to set the MQ Header field 'PutApplName' in my java client and access the same in the JMSXAppID field as a JMS header. The documents on the net talk about the MQ Header Fields getting mapped to JMS ones. Has anyone tried this?### Assistant: You must be using WMQ v7 at the client and the server to do this in a JMS-portable way. Since v6 is end-of-life next year, you are hopefully already on v7 anyway. In v7 all MQMD properties are accessible using message properties. In v6 it was necessary to drop down into WMQ-specific Java classes and it wasn't pretty.That said, please take a look atJMS fields and properties with corresponding MQMD fieldswhich maps all the MQMD fields to the corresponding JMS properties.There is a sample program which writes to MQMD fields and which is installed with the WMQ Client. If you installed the full WMQ client rather than just grabbing the jar files this program will reside at:C:\\Program Files\\IBM\\WebSphere MQ\\tools\\jms\\samples\\simple\\SimpleMQMDWrite.javaThe sample program uses the WMQConstants class rather than coding the string value directly. You can find the WMQConstants documentedhere. Within the constants you should find JMS_IBM_MQMD_PUTAPPLNAMEhere. The JavaDoc for this field says:JMS_IBM_MQMD_PUTAPPLNAMEpublic static final String\n JMS_IBM_MQMD_PUTAPPLNAMEJMS_IBM_MQMD_PUTAPPLNAME property name. Sets or gets the MQ application\n name sending the message. Set using \n setStringProperty(JmsConstants.JMS_IBM_MQMD_PUTAPPLNAME,); Get using\n getStringProperty(JmsConstants.JMS_IBM_MQMD_PUTAPPLNAME);\n Valid on a Message object.Note that the application must be granted +setall authority either by running in the mqm group (NOT recommended) or by using the setmqaut command. The +setall authorization must be applied both at the QMgr and at the specific queue.\n"}
+{"text": "### Human: I'm trying to write a simple tool for monitoring the state of a Queue Manager. One of the things I'd like to monitor is the current queue depth of each queue. I haven't been able to find a way to programmatically enumerate all of the queues on a particular Queue Manager, though. Do any of the MQ APIs provide this functionality? I'd prefer to do this with C, but if it's only possible with another language's bindings, I'd at least like to know that.### Assistant: Several C samples atCapitalware. Look for the ones that use the MQAI interface. Nothing there that enumerates queues but the MQAI programs all use Programmable Command Format (PCF) messages. Enumerating the list of queues is a PCF equivalent of DIS Q(*).You will also want to review the PCF manual in theInfocenterTried to add this as a comment but the links didn't markup as expected:One way or another you end up at PCF commands if you are doing this remotely. You can run MQSC script commands remotely if you install theWMQ clientand useSupportPac MO72to convert them to PCF if you want but at the QMgr it's ultimately PCF. I do a lot of central inquiry and reporting on WMQ with scripts that iterate over a list of QMgrs and execute MO72. I once used CGI and wrote a web front-end over MO72.By the way,SupportPac MO71will do the type of monitoring that you are describing. It's compiled C so it needs the WMQ client installed but it can be set up to monitor depth of queues and even has a mini web server so many people can use the same MO71 instance.\n"}
+{"text": "### Human: I need to implement handling of redelivery of JMS messages in the application that is deployed on the IBM-backed environment, so JMS provider is standalone MQ V6.0.Do you know if it is setting JMSXDeliveryCount property correctly and I can rely on the values of this very property?### Assistant: I've just found the answer for my question :)The IBM WebSphere MQ sets the following JMSX* header properties:JMSXUserIdwill be set by WMQ JMS when you send the message - it looks at\nthe userid running the application and sets JMSXUserId accordingly.JMSXAppIdwill also be set by WMQ JMS when you send the message - to\nsomething like \"WebSphere MQ Client for Java\". There is some debate over\nhow to interpret the JMS Spec on this one - some JMS providers allow an\napplication to set it, others don't. Currently, the WebSphere MQ\nimplementation does not.JMSXDeliveryCountwill be set by WMQ JMS when the message is sent on to a\nreceiving application - it tells that receiving application how many times\nWebSphere MQ has tried to deliver the message to that or other applications.\nNormally, messages should only be delivered once, but in the case of\nfailures or explicit rollback of transactions etc., the delivery count may\nget higher, and applications or JMS providers can use that information to\nspot when things are going wrong and perhaps do something different like\nmoving the message to a dead letter queue, or even discard the message,\ndepending on the nature of the message, the application and the context.\n"}
+{"text": "### Human: We have two connections (as a .NET/Windows client) to an IBM MQ endpoint (let's say non-Windows).We use SSL, which is supported by a pair of certificates (client and server) and correctly labelled in the Windows Certificate Store to ensure we pick the right certificate.Everything in Queue A works fine.Queue B has recently stopped working. We now get a 2538 error. Nothing has changed.We keep both sides of both queues the same as we can.We have Wire-traced both Queue A and Queue B and can confirm SSL negotiation isincompleteon Queue B because of a \"Connection Reset\" by the ClientAll certificates are valid and in dateWe've tried with hard-trusted Self-signed certs between partiesIt feels like there may be a communication error inhibiting successful SSL handshake.The problem is exacerbated by theWebSphereMqClientNuGet package we use (8.0.0.7 - latest version) not giving us anything other than a 2538 error on calling:_mqQueueManager = new MQQueueManager((string)queueManager, (Hashtable)connectionProperties);Connection Properties being (redacted):\n Is there anything an expert could give us a clue on? Is there a way to get any diagnostics out of the NuGet black box?Update 1:The server is running 8.0.0.9.Update 2:@JoshMc suggested I turn on logging.From this, I learn:It couldn't (rightly) find anmqclient.inifile in the binary folder or my personal folder.Errors start during SSL Authentication, specificallySystem.ComponentModel.Win32Exception (0x80004005): The credentials supplied to the package were not recognizedFollowed by the host seemingly disappearing:MQTCPConnection.ConnectSocket(string,string,MQLONG) rc=OK\n00000174 10:29:28.917526 5748.1 CompCode: 2, Reason: 2538\nAMQ9202: Remote host 'x.x.x.x(y)' not available, retry later.Out of which comes the 2538CompCode: 2, Reason: 2538Negotiation seems to continue, using appropriate TLS version, etc.Then when trying to get the client (with our private key) certificate, we getSystem.ComponentModel.Win32Exception (0x80004005): The credentials supplied to the package were not recognizedI have double checked that the userdoeshave permission to the Private Key.Update 3Issue found.The issue was highlighted by the textSystem.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.. On investigation it turns out that the permissions on the Private Key had been removed during a certificate renewal. I know the above says the permissions were confirmed to be there, but for a different certificate. I've left it in to retain history/honesty.### Assistant: The NuGet package is just the stand-aloneamqmdnet.dllthat IBM lets you relocate from a full MQ client install or download via the redistributable client zip file.If you want to have them turn on a trace for a stand-alone Managed .NET MQ Client you need to follow the instructions atDeveloping applications > Developing .NET applications > Writing and deploying IBM MQ .NET programs > Using the stand-alone IBM MQ .NET client.You start by adding the following to your app.config and point the value to a directory that you can create a file in.\n\nYou then create a file calledtrace.configin the above directory with the following contents where theMQTRACEPATHandMQERRORPATHpoint to a directory that the user running your application can write to.\n\n 2\n C:\\MQTRACEPATH\n C:\\MQERRORLOGPATH\nNote that you can toggle theMQTRACELEVELbetween2and0to dynamically turn tracing on or off for a running program.On the MQIPT side of things if you use the stockmqipt.sketo start your MQIPT instance you can set the env variableMQIPT_JVM_OPTIONS=\"-Djavax.net.debug=ssl\"before you start MQIPT, this will cause java to provide TLS debug logging tomqipt.stdout.login thelogsdirectory.\n"}
+{"text": "### Human: In this post , Garry Russell explained how to programmatically create multiple KafkaListeners to listen from multiple topics.. [this setup is actually working successfully for me ]Kafka Spring: How to create Listeners dynamically or in a loop?Now i want to have a similar setup working for JMSListeners as well - where I can have one class with one @JMSListener in it and i can programmatically create multiple instances of that JMSListener each injected with its own queueName.I found this postSpring JMS start listening to jms queues on requestIn the end of this post Gary made a similar comment,If you wish to dynamically create lots of containers, then just create the containers programmatically, call afterPropertiesSet(), then start()I used the setup that i had working from the first post above(related to KafkaListeners), my multiple instances of JMS listeners are starting up but not consuming any messages.Basically i didn't understand where do i do thisthen just create the containers programmatically, call afterPropertiesSet(), then start()I am confused with the word - container, I know there's JMSListener and there's \nJmsListenerContainerFactory, what is a container in this context - i guess JMSListener?i have confirmed there are messages in the queue. also when i don't create the listeners programmatically and just have one listener with hardcoded queue mentioned on it, it consumes the message fine.Basically none of the listeners are consuming the messages when i am creating multiple JMS Listeners programmatically@SpringBootApplication\n@EnableJms\npublic class MqProdConsumerApplication {\n private static Logger logger = LogManager.getLogger(MqProdConsumerApplication.class.getName());\n private static Consumers consumersStatic;\n\n @Autowired\n Consumers consumers;\n\n @PostConstruct\n public void init() {\n consumersStatic = this.consumers;\n }\n\n @Bean\n public Gson gson() {\n return new Gson();\n }\n\n public static void main(String[] args) {\n ConfigurableApplicationContext context = SpringApplication.run(MqProdConsumerApplication.class, args);\n List queueInformationList = consumersStatic.getQueueInformationList();\n Assert.notEmpty(queueInformationList, \"queueInformationList cannot be empty\");\n logger.debug(\"queueInformationList ************\" + queueInformationList.toString());\n for (QueueInformation queueInformation : queueInformationList) {\n AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();\n child.setParent(context);\n child.register(MQConfig.class);\n Properties props = new Properties();\n props.setProperty(\"mqQueueName\", queueInformation.getMqQueueName());\n //\n PropertiesPropertySource pps = new PropertiesPropertySource(\"listenerProps\", props);\n child.getEnvironment().getPropertySources().addLast(pps);\n child.refresh();\n }\n }\n}Here's the MQConfig that has the listenerContainerFactory@Configuration\npublic class MQConfig {\n Logger logger = LoggerFactory.getLogger(this.getClass());\n\n @Value(\"${ibm.mq.user}\")\n private String mqUserName;\n\n @Bean\n public MQListener listener() {\n return new MQListener();\n }\n\n @PostConstruct\n public void afterConstruct() {\n logger.debug(\"************* initialized MQ Config successfully for user =\" + mqUserName);\n }\n\n @Bean\n public JmsListenerContainerFactory> myFactory(ConnectionFactory connectionFactory,\n DefaultJmsListenerContainerFactoryConfigurer configurer) {\n DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();\n configurer.configure(factory, connectionFactory);\n\n // Put the MQ username in the PCF environment.\n // Otherwise, the connection is identified by PCF's default user, \"VCAP\"\n System.setProperty(\"user.name\", mqUserName);\n return factory;\n }\n}Then comes the MQListener which has the actual @JMSListenerpublic class MQListener {\n Logger logger = LoggerFactory.getLogger(this.getClass());\n\n @Value(\"${mqQueueName}\")\n private String mqQueueName;\n\n @PostConstruct\n public void afteConstruct() {\n logger.debug(\"************* initialized MQ Listener successfully, will read from =\" + mqQueueName);\n\n }\n\n @JmsListener(destination = \"${mqQueueName}\", containerFactory = \"myFactory\")\n public void receiveMessage(String receivedMessage) throws JAXBException, ExecutionException, InterruptedException {\n logger.debug(\"***********************************************receivedMessage:\" + receivedMessage);\n }\n}Here's my application.ymlibm.mq.queueManager: ABCTOD01\nibm.mq.channel: QMD00.SERVER\nibm.mq.connName: mqdv1.devfg.ABC.com\nibm.mq.user: pmd0app1\nibm.mq.password:\nconsumers:\n queueInformationList:\n -\n mqQueueName: QMD00.D.SRF.PERSON.LITE.PHONE.LOAD\n -\n mqQueueName: QMD00.D.SRF.PERSON.PHONE.LOAD### Assistant: ok i found another post where Gary has answered what i was looking forAdding Dynamic Number of Listeners(Spring JMS)Essentially here's the working solution for me.\nGreat job @GaryRussell - I am a fan now :)@Configuration\n@EnableJms\npublic class AppConfig implements JmsListenerConfigurer {\n\n @Override\n public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {\n List queueInformationList = consumersStatic.getQueueInformationList();\n int i = 0;\n for (QueueInformation queueInformation :\n queueInformationList) {\n SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();\n endpoint.setId(\"myJmsEndpoint-\" + i++);\n endpoint.setDestination(queueInformation.getMqQueueName());\n endpoint.setMessageListener(message -> {\n logger.debug(\"***********************************************receivedMessage:\" + message);\n });\n registrar.registerEndpoint(endpoint);\n logger.debug(\"registered the endpoint for queue\" + queueInformation.getMqQueueName());\n }\n}See alsohttps://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#jms-annotated-programmatic-registration\n"}
+{"text": "### Human: I tried to verify the speed of using both asyncPut()andCommit()using the code below. The problem is that its speed is ten times slower than either using asyncPut()only orCommit()only, which does not make sense.Am I missing something here?class AsyncProducerWithCommit \n {\n private MQQueueManager _queueManager;\n private MQQueue _queue;\n\n public void Run()\n {\n Produce();\n }\n\n\n void Produce()\n {\n Open(ConnectionMode.Write);\n\n PutMessage(ConvertMessageToByte(message)); \n\n _queue.Close();\n _queueManager.Disconnect();\n }\n\n void PutMessage(byte[] messageString)\n { \n MQMessage _message = new MQMessage();\n _message.Write(messageString);\n _message.Format = MQC.MQFMT_STRING;\n _message.CharacterSet = 1208;// IbmUtf8Encoding;\n _message.Persistence = MQC.MQPER_PERSISTENT;\n\n var putMessageOptions = new MQPutMessageOptions();\n putMessageOptions.Options = MQC.MQPMO_SYNCPOINT //unit of work\n + MQC.MQPMO_ASYNC_RESPONSE; //async\n\n _queue.Put(_message, putMessageOptions); //send message asynchronously\n\n _queueManager.Commit(); \n\n }\n\n void Open(ConnectionMode connectionMode)\n {\n string _queueManagerName = _appSetting.MessagingServerSetting.QueueManagerName;\n\n int openOptions = 0;\n\n switch (connectionMode)\n {\n case ConnectionMode.Read:\n openOptions = MQC.MQOO_INPUT_SHARED + MQC.MQOO_FAIL_IF_QUIESCING;\n break;\n case ConnectionMode.Write:\n openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;\n break;\n }\n\n\n var properties = new Hashtable\n {\n {MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED },\n {MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_RECONNECT },\n { MQC.HOST_NAME_PROPERTY, \"192.168.1.10\" },\n { MQC.PORT_PROPERTY, \"1415\"},\n { MQC.CHANNEL_PROPERTY, \"LOCAL.DEF.SVRCONN\" },\n {MQC.USER_ID_PROPERTY, \"user\" },\n {MQC.PASSWORD_PROPERTY, \"pwd\" } \n };\n\n _queueManager = new MQQueueManager(_queueManagerName, properties);\n _queue = _queueManager.AccessQueue(QUEUE_NAME, openOptions);\n }\n\n\n public enum ConnectionMode\n {\n Read,\n Write\n }\n\n }Update 1Async PutputMessageOptions.Options = MQC.MQPMO_ASYNC_RESPONSE; //async\n_queue.Put(_message, putMessageOptions); //send message asynchronouslyPut with CommitputMessageOptions.Options = MQC.MQPMO_SYNCPOINT; //unit of work \n _queue.Put(_message, putMessageOptions); \n _queueManager.Commit();QueueManager version: 8.0.0.5 on Redhat Linux 7+MQ.NET: 8.0.0.8### Assistant: In the IBM MQ v8 Knowledge center page \"Using asynchronous put in a client application\" it states:Normally, when an application puts a message or messages on a queue,\n using MQPUT or MQPUT1, the application has to wait for the queue\n manager to confirm that it has processed the MQI request. You can\n improve messaging performance, particularly for applications that use\n client bindings, and applications that put large numbers of small\n messages to a queue, by choosing instead to put messages\n asynchronously. When an application puts a message asynchronously,the\n queue manager does not return the success or failure of each call, but\n you can instead check for errors periodically.Async put only impacts the put call which will return right away instead of waiting for the queue manager to confirm it has processed the put.So if you have the following it would be expected to be the fastest since you would not ever be waiting for the message to write to disk._message.Persistence = MQC.MQPER_PERSISTENT;\nputMessageOptions.Options = MQC.MQPMO_ASYNC_RESPONSE; //async\n_queue.Put(_message, putMessageOptions); //send message asynchronouslyIf you have either of these, the commit is going to wait for the message to write to disk so would be as slow as the disk write takes. It is very possible this is slower than the above, but 3sec vs 30sec does not seem reasonable._message.Persistence = MQC.MQPER_PERSISTENT;\nputMessageOptions.Options = MQC.MQPMO_SYNCPOINT //unit of work\n + MQC.MQPMO_ASYNC_RESPONSE; //async\n_queue.Put(_message, putMessageOptions); //send message asynchronously\n_queueManager.Commit();Or_message.Persistence = MQC.MQPER_PERSISTENT;\nputMessageOptions.Options = MQC.MQPMO_SYNCPOINT; //unit of work \n_queue.Put(_message, putMessageOptions); \n_queueManager.Commit();If the call with MQPMO_SYNCPOINT and MQPMO_ASYNC_RESPONSE is 30 seconds and the call with only MQPMO_SYNCPOINT is 3 seconds, then I think there must be some sort of defect and I would suggest you open a PMR with IBM and they will likely ask you for at least a client side .NET trace and likely queue manager trace from the same time.\n"}
+{"text": "### Human: Are the features below supported by IBM Websphere MQ in .NET client? Please provide code example.1. Publisher ConfirmsWhen Publisher sends messages to queue, it receives confirmations from MQ server that messages have been saved to hard disk.Does MQ server save message before sending confirmation?Update 2Is it corrent that when MQQueue.Put() returns, the message has been saved to transaction log? How long does it take to save to disk? What about message persistence in a cluster?void PutMessage(byte[] messageString)\n {\n try{\n\n // creating a message object\n message = new MQMessage();\n message.Write(messageString);\n message.Format = MQC.MQFMT_STRING;\n message.CharacterSet = 1208;// IbmUtf8Encoding;\n message.Persistence = MQC.MQPER_PERSISTENT;\n\n var options = new MQPutMessageOptions\n {\n Options = useSyncPoint ? MQC.MQPMO_SYNCPOINT : MQC.MQPMO_NO_SYNCPOINT\n };\n\n queue.Put(message, options);\n qMgr.Commit();\n\n }catch(Exception e){\n qMgr.Backout();\n }\n }2. Consumer AcknowledgementWhen Consumer receives messages from queue, processes them, then sends acknowledgement to MQ server.Update 3How can Consumer acknowledges to MQ server that messages have been processed successfully, and the messages can be safely deleted from server?public void GetMessages()\n { \n Open(ConnectionMode.Read);\n\n for (int i = 1; i <= numberOfMsgs; i++)\n { \n GetMessage();\n }\n queue.Close();\n queueManager.Disconnect(); \n }\n\n public string GetMessage()\n {\n message = new MQMessage { Format = MQC.MQFMT_STRING };\n var mqMessageOptions = new MQGetMessageOptions\n { \n Options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT\n };\n\n queue.Get(message, mqMessageOptions, MaxMessageSizeInBytes);\n\n var content = message.ReadString(message.MessageLength);\n message.ClearMessage();\n\n return content;\n }\n\n\npublic void Open(ConnectionMode websphereConnectionMode)\n {\n var connectionSettings = new Hashtable\n {\n {MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED },\n {MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_RECONNECT }\n };\n\n int openOptions = 0;\n\n switch (websphereConnectionMode)\n {\n case ConnectionMode.Read:\n openOptions = MQC.MQOO_INPUT_SHARED + MQC.MQOO_FAIL_IF_QUIESCING;\n break;\n case ConnectionMode.Write:\n openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;\n break;\n }\n queueManager = new MQQueueManager(queueManagerName);\n queue = queueManager.AccessQueue(queueName, openOptions);\n }\n\n\n public enum ConnectionMode\n {\n Read,\n Write\n }How to do an explicit ACK when receiving Websphere MQ messages?### Assistant: If the message is persistent, then MQ will write it into the transaction log and wait for the log extent to reach the disk, before put returns.To achieve this, the consumer should read messages under syncpoint, and commit the gets after appropriate processing is done on the client side.\n"}
+{"text": "### Human: Following code snippet has my connection and subscription logic for an IBM MQ Queue. When ever there is a connection failure, I am using IConnection.ExceptionListener delegate to establish a new connection to by queue and resubscribing for the messages. But the problem is, I can see multiple queue handles. How can I make sure I close the previous connection handle and establish a new connection where ever there is a connection break due to network issues or MQ server restarts?private CancellationToken _cancellationToken;\nprivate IConnection _connection;\nprivate IConnectionFactory _connectionfactory;\nprivate IMessageConsumer _consumer;\nprivate IDestination _destination;\nprivate MessageFormat _msgFormat;\nprivate IMessageProducer _producer;\nprivate ISession _session;\n\nprivate void CreateWebsphereQueueConnection () {\n SetConnectionFactory ();\n\n //Connection\n _connection = _connectionfactory.CreateConnection (null, null);\n _connection.ExceptionListener = new ExceptionListener (OnConnectionException);\n\n //Session\n _session = _connection.CreateSession (false, AcknowledgeMode.AutoAcknowledge);\n\n //Destination\n _destination = _session.CreateQueue (\"queue://My.Queue.Name\");\n _destination.SetIntProperty (XMSC.DELIVERY_MODE, 2);\n _destination.SetIntProperty (XMSC.WMQ_TARGET_CLIENT, 0);\n\n //Consumer\n _consumer = _session.CreateConsumer (_destination);\n}\n\nprivate IConnectionFactory SetConnectionFactory () {\n XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance (XMSC.CT_WMQ);\n IConnectionFactory cf = factoryFactory.CreateConnectionFactory ();\n\n // Set the properties\n cf.SetStringProperty (XMSC.WMQ_CHANNEL, ConnectionSettings.Channel);\n cf.SetIntProperty (XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\n cf.SetIntProperty (XMSC.WMQ_FAIL_IF_QUIESCE, XMSC.WMQ_FIQ_YES);\n cf.SetStringProperty (XMSC.WMQ_QUEUE_MANAGER, ConnectionSettings.QueueManager);\n cf.SetStringProperty (XMSC.WMQ_CONNECTION_NAME_LIST, ConnectionSettings.ConnectionList);\n cf.SetIntProperty (XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, ConnectionSettings.ReconnectTimeout);\n cf.SetIntProperty (XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, ConnectionSettings.ReconnectOptions);\n\n cf.SetStringProperty (XMSC.WMQ_PROVIDER_VERSION, XMSC.WMQ_PROVIDER_VERSION_DEFAULT);\n cf.SetBooleanProperty (XMSC.WMQ_SYNCPOINT_ALL_GETS, true);\n return cf;\n}\n\npublic override void Subscribe (Action onMessageReceived) {\n try {\n\n _connection.ExceptionListener = delegate (Exception connectionException) {\n //Using any of these two statements is termination my code. Debugger doesn't move to CreateWebsphereQueueConnection() line of code at all\n //_conection.Stop()\n //_conection.Close()\n CreateWebsphereQueueConnection ();\n Subscribe (onMessageReceived);\n };\n\n MessageListener messageListener = new MessageListener ((msg) => {\n onMessageReceived (message);\n });\n _consumer.MessageListener = messageListener;\n\n // Start the connection\n _connection.Start ();\n } catch (Exception ex) {\n //Log exception details\n }\n}### Assistant: You have already set reconnection option on the connection factory. XMS library will do the reconnection automatically when the connection to queue manager breaks, excepting when the queue manager is shutdown without -r or -s option. So your application does not need to reconnect explicitly. Having exception listener will help in understanding what's going with reconnection process.\n"}
+{"text": "### Human: We are one application in a larger environment and a client for some data interface, using Websphere MQ 8.x. Our application is a Java EE application running on a WildFly 9 which uses a resource adaptor (wmq.jmsra.rar) which is deployed together with the EAR file in the same AS. We interact with the MQ Server in both directions. So we have on the one hand some MDBs (which are due to historical origins still in EJB 2.x format without annotations) listining to some queues and which are configured by theejb-jar.xmldeployment descriptor, containing the activation config propertiesdestinationType, channel, queueManager, hostName, username, password. On the other hand we have a sender which lookups a queue connection factory and a queue via JNDI and creates a connection.Now we have the requirement with a newly established MQ server to communicate via SSL and a client certificate. We got such a certificate from the server people for our machine. So my questions are:What has to be done to make it work with the setup described above?Is this possible purely by configuration and thus transparent for the application or has the application to specifically use SSL, present the certificate or something similar?Does this conflict with any other keystore already used by some other part of the application?Is some additional IBM MQ software needed to make it work? (Our client is just the RAR, no software is installed and no MQ server on our side should be established.)Update:I went for setting the global JSSE properties for the VM as it solved my problem as a start.It was necessary to set the following parameters:-Djavax.net.ssl.trustStore=\n-Djavax.net.ssl.keyStore=\n-Djavax.net.ssl.keyStorePassword=Additionally, since I am using non-IBM VM, there was the following paramter to set:-Dcom.ibm.mq.cfg.useIBMCipherMappings=falseThen, it was necessary to set the cipher suite property on the RAR configuration instandalone-full.xmltogether with the other connection parameters of my WildFly installation:\n...\n \n \n xxx\n...\nAnd finally, the MDBs listining on the queues also had to be configured to use the cipher suite, so in my case I had to add that in the ejb-jar.xml by adding for each MDB:\n sslCipherSuite\n xxx\n### Assistant: OP stated in the comments that they use OpenJDK 8 and are using the IBM MQ v9.0.0.1 resource adapter, both of the following known problems are fixed in that release, but putting this information here for the benefit of others who may not yet be at a release where these are fixed:APARIV66840: TLS cipherspecs in non-IBM JREs were not supported until 8.0.0.2.APARIT10837: WildFly 9 may hit another issue if using a non-IBM JRE in finding the KeyStore that contains the client cert, this is fixed in 8.0.0.5.The resource adapter includes the MQ functionality to support TLS but uses the underlying JSSE for the actual encryption.Based on RFC 5246 it suggests that the TLS Client should only return a cert that is suitable based on the the server sending \"A list of the distinguished names [X501] of acceptable certificate_authorities, represented in DER-encoded format.\", this would mean that if the certs in your keyStore for the different uses (ex: existing non-MQ certs and MQ certs) arenotsigned by the same CA chain, and the various TLS servers you connect to do not accept certs from the CA of other certs in your key store (ex: existing non-MQ certs and MQ certs) then JSSE will return the appropriate cert to each.For example if existing non-MQ certs are signed by a Internal CA and the MQ cert is signed by another company's CA, it is highly unlikely that the MQ company would trust your internal CA certs, conversely it is unlikely that your other non-MQ TLS servers you connect to would trust the other company's CA. Since JSSE would return only a cert that was trusted by the remote server they should not impact each other. You would just need to add the MQ cert to your existing key store.Quotes from the relevant sections of RFC 5246 are at the bottom of this post.@a_cornish_pasty answer to your question \"Use specific keystore for JMS\" is also an alternative as it would allow you to specify a separate key store from what the rest of Wildfly uses, this key store could have ONLY the MQ cert, so no chance of causing an issue with the existing key store and certs.RFC 5246 Section 7.4.4states the following:7.4.4. Certificate RequestWhen this message will be sent:A non-anonymous server can optionally request a certificate from\nthe client, if appropriate for the selected cipher suite. This\nmessage, if sent, will immediately follow the ServerKeyExchange\nmessage (if it is sent; otherwise, this message follows the\nserver's Certificate message).It then goes on to state:certificate_authoritiesA list of the distinguished names [X501] of acceptable\ncertificate_authorities, represented in DER-encoded format.These\ndistinguished names may specify a desired distinguished name for a\nroot CA or for a subordinate CA; thus, this message can be used to\ndescribe known roots as well as a desired authorization space.If\nthe certificate_authorities list is empty, then the client MAY\nsend any certificate of the appropriate ClientCertificateType,\nunless there is some external arrangement to the contrary.RFC 5246 Section 7.4.6states the following:7.4.6. Client CertificateWhen this message will be sent:This is the first message the client can send after receiving a\nServerHelloDone message.This message is only sent if the server\nrequests a certificate.If no suitable certificate is available,\nthe client MUST send a certificate message containing no\ncertificates.That is, the certificate_list structure has a\nlength of zero. If the client does not send any certificates, the\nserver MAY at its discretion either continue the handshake without\nclient authentication, or respond with a fatal handshake_failure\nalert. Also, if some aspect of the certificate chain was\nunacceptable (e.g., it was not signed by a known, trusted CA), the\nserver MAY at its discretion either continue the handshake\n(considering the client unauthenticated) or send a fatal alert.It then goes on to state:If the certificate_authorities list in the certificate request\nmessage was non-empty,one of the certificates in the certificate\nchain SHOULD be issued by one of the listed CAs.\n"}
+{"text": "### Human: What is the proper way, or the popular convention of deciding when to kill a listener? I can't seem to find a solid answer really anywhere. The queues I'm dealing with are IBM's MQ Queues, and I know typically that you would read until you receive a 2033 error code (my company does this in other applications) at which point you can wrap up, but for a SpringBoot Jms application what's the convention here? Once the queue is empty the listener just hangs until more messages come. I know HOW to kill it if I want, but how can I know WHEN?As an example, here is a config for a sample project I threw together@Configuration\n@EnableTransactionManagement\npublic class JmsConfig {\n\n@Bean\nprotected DefaultJmsListenerContainerFactory defaultJmsListenerContainerFactory() throws JMSException {\n DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();\n factory.setConnectionFactory(mqQueueConnectionFactory());\n factory.setConcurrency(\"1\");\n factory.setSessionTransacted(true);\n factory.setAutoStartup(true);\n factory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);\n factory.setErrorHandler(new JmsErrorHandler());\n return factory;\n}\n\n@Bean\npublic MQQueueConnectionFactory mqQueueConnectionFactory() {\n MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n mqQueueConnectionFactory.setHostName(host);\n try {\n mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n mqQueueConnectionFactory.setCCSID(1208);\n mqQueueConnectionFactory.setChannel(channel);\n mqQueueConnectionFactory.setPort(port);\n mqQueueConnectionFactory.setQueueManager(queueManager);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return mqQueueConnectionFactory;\n}and here is the listener@Component\npublic class Consumer {\n\n @JmsListener(id = \"myQueue\", destination = \"queue\")\n public void processMessage(Message message) throws MQException, IOException {\n try {\n String messageString = ((TextMessage) message).getText();\n } catch (JMSException e) {\n e.printStackTrace();\n }\n }\n}Besides the main class and the ErrorHandler, that is literally the whole sample project, and it will process messages. What I have done in other applications is instantiated aMQQueuegiven the queue values and just simple didqueue.getCurrentDepth()and if I get a zero I then call on an instance of a ListenerContainerController that then calls stop from a JmsListenerEndpointRegistry given the queues id.Does Spring have an easy way of communication \"hey your queue is now empty\" or is there a way to end it after x amount of time has passed?### Assistant: AJmsListeneris intended to receive and process messages as they arrive on the destination. It isn't intended to read until the destination is empty and then stop, it is designed to keep running.Instead just use aJmsTemplateand itsreceivemethod to read the messages until they are done. Then process them and write a report.Ultimately you could even create a Spring Batch job using theJmsItemReader, this reader will read until there is nothing more to read and then it will all end. Underneath it also uses aJmsTemplateWhat you could do then is, as you are using Spring Boot, use a cron job to daily trigger this job (which is basically done launching the jar you created). See also the reference guide of Spring Boot on how to work withbatch applications.\n"}
+{"text": "### Human: Looking at the sample codes it seems I needqueue managerandqueue nameto setup MQ through code. What is difference between those and where I can get those values from? Any suggestion?MQTopicConnectionFactory cf = new MQTopicConnectionFactory();\n\n // Config\n cf.setHostName(\"localhost\");\n cf.setPort(1414);\n cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);\n cf.setQueueManager(\"QM_thinkpad\");\n cf.setChannel(\"SYSTEM.DEF.SVRCONN\");\n\n MQTopicConnection connection = (MQTopicConnection) cf.createTopicConnection();\n MQTopicSession session = (MQTopicSession) connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);\n MQTopic topic = (MQTopic) session.createTopic(\"topic://foo\");\n MQTopicPublisher publisher = (MQTopicPublisher) session.createPublisher(topic);\n MQTopicSubscriber subscriber = (MQTopicSubscriber) session.createSubscriber(topic);### Assistant: You connect to a queue manager which may host many different queues. So yes, an application generally needs access to a queue manager and then specific queues on that queue manager. I suggest you can look at the Stack Overflowinfo for the websphere-mq tagto help get you started. The names of those objects should be known by your application architect/developer or can be confirmed with the MQ admin.\n"}
+{"text": "### Human: How to I specify the username and password in a wmq connection string? This is the sample connection string I'm working with.Uri sampleAddress = new Uri(\"wmq://localhost:1414/msg/queue/Q1?connectQueueManager=QM1&replyTo=Q2\");How do I put the userId/password used for authentication to the MQ Manager here?### Assistant: For V8.0 I was successful by making the connection in the following way:Hashtable connectionProperties = new Hashtable(); \nconnectionProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\nconnectionProperties.Add(MQC.HOST_NAME_PROPERTY, _queueServer);\nconnectionProperties.Add(MQC.PORT_PROPERTY, _portNumber);\nconnectionProperties.Add(MQC.CHANNEL_PROPERTY, _channelInfo);\nconnectionProperties.Add(MQC.USER_ID_PROPERTY, \"userid\");\nconnectionProperties.Add(MQC.PASSWORD_PROPERTY, \"password\"); \nqueueManager = new MQQueueManager(_queueManager, connectionProperties);Seehere.\nAlthough for version below 8.0 please see that you will have to use an exit mechanism as for them the client provided id is not used.\n"}
+{"text": "### Human: Closed. This question needs to be morefocused. It is not currently accepting answers.Want to improve this question?Update the question so it focuses on one problem only byediting this post.Closed7 years ago.Improve this questionI just need to know some basic information or the procedure that is followed when migrating from IBM MQ server to ActiveMQ. We are planning to migrate our messaging systems from IBM MQ to Active MQ.To be specific the migration is from MQ V7.0 to ActiveMQ V5.7.0. What would be the object movement from IBM MQ to ActiveMQ i.e., to know the comparison or the relation between MQ objects and ActiveMQ if there are any.( IBM MQ queue->? in ActiveMQ and other major things)It would be greatly appreciable if someone would provide me some insight on this. Thanks in advance for your help### Assistant: It's a large topic depending on the complexity of your setup.Here are some high level topics to consider.ClientsJMSIf you are using IBM WebSphere MQ with JMS clients those clients will need to replace their IBM libraries with ActiveMQ ones and replace the configuration.MQ NativeUsing native MQ clients will require you to rewrite your applications to use any of the client libraries available for ActiveMQ. This might be non straight forward.QMGR ConfigurationQueues and topicsSimple objects in WMQ such Queues and Topics are the same in ActiveMQ, although you do not have to explicitly define them.Cluster ConfigurationWMQ clusters are roughly the same as AMQ Network of Brokers. However, in AMQ message propagation is pretty much automatic and all queues are global (by default). Most features should be possible to migrate, one way or another.HA ConfigurationAMQ uses similar fail-over setups as WMQ, where a shared network disk is the most common.SecurityAMQ and WMQ have different security mechanisms but support users, passwords, authorities, security groups, TLS transport security etc etc. A migration path should be possible but may not be straight forward in some scenarios.\n"}
+{"text": "### Human: I know that MQExplorer GUI could show who connected to some queue by some channel and other information about this connection, but I didn't find anything in PCF to do that from Java.Thanks in advance for commands and examples if they exist!### Assistant: This shows sample snippet shows how to retrieve theconname.// Create the PCF message type for the inquire.\nPCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_Q_STATUS);\n// Add queue name\npcfCmd.addParameter(MQConstants.MQCA_Q_NAME, \"MYQ\");\n// We want Q HANDLE attributes\npcfCmd.addParameter(MQConstants.MQIACF_Q_STATUS_TYPE, MQConstants.MQIACF_Q_HANDLE);\n// We want to retrieve only the connection name\npcfCmd.addParameter(MQConstants.MQIACF_Q_STATUS_ATTRS, MQConstants.MQCACH_CONNECTION_NAME);\n// Execute the command. The returned object is an array of PCF messages.\nPCFMessage[] pcfResponse = pcfCM.agent.send(pcfCmd);\n\ntry{\n for(int i = 0; i < pcfResponse.length;i++){\n String name = (String) pcfResponse[i].getParameterValue(MQConstants.MQCACH_CONNECTION_NAME);\n System.out.println(\"Connection Name: \" + name); \n }\n }catch(Exception ex) {\n System.out.print(ex);\n}You can modify the snippet per your need. Hope it helps.\n"}
+{"text": "### Human: I am trying to send Text messages using IBM XMS for .NET. After sending around 254 messages, I get following error:An unhandled exception of type 'IBM.XMS.XMSException' occurred in IBM.XMS.Client.WMQ.dll\n\nAdditional information: CWSMQ0082E: Failed to send to CompCode: 2, Reason: 2017.There isn't much on google about it. I found one related post atWSMQ Queue LimitThe post suggest that there is some sort of limit in max queues. The links in the post don't seem to work. How do I overcome this error ?### Assistant: MQ has a commandmqrcwhich returns the text for any reason code or message code. The 2017 meansMQRC_HANDLE_NOT_AVAILABLE. A better explanation can be had by going to theKnowledge Centerand searching on 2017. This returns several pages of API calls which can return 2017, along with the page for the reason code itself:2017 (07E1) (RC2017): MQRC_HANDLE_NOT_AVAILABLE.That page provides the following description of the problem:ExplanationAn MQOPEN, MQPUT1 or MQSUB call was issued, but the\n maximum number of open handles allowed for the current task has\n already been reached. Be aware that when a distribution list is\n specified on the MQOPEN or MQPUT1 call, each queue in the distribution\n list uses one handle.We know from the documentation, and can confirm from MQ Explorer's QMgr Extended Properties panel, that by default the maximum handles any process will be allowed to have is 256.Based on all this and that your program is dying after 254 messages, the conclusion is that it is grabbing a fresh handle for every message beingPUTand not ever releasing them.Generally this occurs when there is a loop that should containonlythePUTandCOMMITbut instead also contains theOPEN. I would suggest carefully reviewing your code, possibly also updating your question to post the code here.I would also suggest studying the MQ .Net sample programs or using one of them as the basis for your own code.\n"}
+{"text": "### Human: I was trying to configure my WMQ. \nqueue manager was running until i changed the password of my musr_mqadmin account. \nNow it the local queue manager that i created cannot be start any moreThe pop up says \"The MQ service for installation \"installation1\" must be running\"While i tried to reset the musr_mqadmin account, it says \"mq configuration an error while validating the security credentials \"I am really stuck and helpless. Please kindly advise.### Assistant: MQ Service runs under MUSR_MQADMIN account. You will need to provide the same password for MQ Service also. Go toAdministrative Tools/Servicesconsole. SelectIBM WebSphere MQservice and open the properties by double clicking on the service. On theLog Ontab provide the new password andOKto close the dialog and start the service.HTH/Shashi\n"}
+{"text": "### Human: I want to create a broker to broker connection between ActiveMQ and WebSphere MQ in an embedded broker. I know that exists the network connector in activemq to do that (broker-to-broker), but I don't know how to configure it to connect to WebSphere MQ. Doing a search in the web I found some different ways to do with XML configuration and I noticed that the XML tags used does not refer the network connector, but refers a, so I do a research about this bridge connector by using java code but I wasn't able to find something that points me about how to do that.Is there an explicit way to configure a bridge connector in ActiveMQ to a WebSphere MQ, for an embedded broker by using java code instead to use the XML configuration?I know that is possible by using XML configuration, but, what if I am implementing an embedded broker (as I've mentioned before), and I want to configure the broker instance with a bridge connector to WebSphere MQ with java code, Does ActiveMQ provide a Class or Interface on the API to do this?This is what I have done to connect two activemq brokerstry {\n getBroker().addConnector(\"tcp://localhost:61616\");\n getBroker().addNetworkConnector(\"static:(tcp://remotBroker:61616)\");\n } catch (Exception e) {\n logger.error(\"Unexpected ERROR, connection lost.\");\n e.printStackTrace();\n }One TransportConnector to listen in port 61616 and one Network connector to establish connection from my local broker to the remoteBroker, both brokers are \ninstances of activemq. Now I want a connection from my ActiveMQ local broker to WebSphere MQ broker using java code, no XML.### Assistant: It's pretty simple.\nThe following example will send all messages on the ActiveMQ queue QUEUE42 to a remote WebSphere MQ broker. Change connection settings.This requires you to have some WMQ libs on your classpath: com.ibm.mq.jar and com.ibm.mqjms.jar (at least). The trick is to simply create a JmsQueueConnector with a QueueConnectionFactory (to WMQ) and whatever inbound/outbound bridges you want. The bridges are simply queue names that will be copied.BrokerService broker = new BrokerService();\n broker.setBrokerName(\"amqbroker\");\n broker.setPersistent(false);\n broker.setTransportConnectorURIs(new String[] {\"tcp://localhost:61616\"});\n\n // setup bridge\n JmsQueueConnector qCon = new JmsQueueConnector();\n\n JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\n JmsQueueConnectionFactory cf = ff.createQueueConnectionFactory();\n cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, \"192.168.13.151\");\n cf.setIntProperty(WMQConstants.WMQ_PORT, 1414);\n cf.setStringProperty(WMQConstants.WMQ_CHANNEL, \"SYSTEM.DEF.SVRCONN\");\n cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\n cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, \"SUPERHERO\");\n\n qCon.setOutboundQueueConnectionFactory(cf);\n OutboundQueueBridge outBridge1 = new OutboundQueueBridge(\"QUEUE42\");\n qCon.setOutboundQueueBridges(new OutboundQueueBridge[] {outBridge1});\n broker.setJmsBridgeConnectors(new JmsConnector[] {qCon});\n broker.start();\n"}
+{"text": "### Human: I'm using WebSphere MQ. I have 3 QMs: QM1, QM2, and QM3. QM1 and QM2 form together an MQ Cluster named CLS12, while the QM2 and QM3 form CLS23. In other words, QM2 is in two clusters.I'd like to put a message (actually, it will be IIB to put a message) on QM2, but the target queues will actually be local on QM1 and QM3, but shared in the clusters. However, I would like to be able to choose to which cluster (not QM) the message should be put to.Is that possible?### Assistant: Short answer? No.MQ performs name resolution by queue and queue manager name. At no time during name resolution is the cluster name available to the application putting the message as a way to resolve the destination.It is possible to create QMgr aliases with names that match a particular cluster and get behavior similar to what you seek but it isn't reliable. Clusters are a namespace in which the queues and topics can reside. When clusters overlap, the namespaces overlap. So even though it's possible to fake the routing using aliases, changes in the namespace for either the queue, the alias or the queue manager that cause a name collision or cause cross-contamination of the overlapping cluster namespaces will break the name rresolution.\n"}
+{"text": "### Human: I have created an MQ Service object to run my Trigger Monitor thus:-DEFINE SERVICE('TriggerMonitor') +\n CONTROL(QMGR) +\n STARTCMD('C:\\Program Files (x86)\\IBM\\WebSphere MQ\\bin\\runmqtrm') +\n STARTARG('-m TriggerTest -q InitQueue')Even though I set runmqtrm.exe in \"Start Command\" property it is showing me \"Service Status\" as Stopping. Is there way to make this runmqtmc running as a background service on windows without having to run it in a command prompt?### Assistant: In order to see status of a program running as an MQ Service Object, it must be of typeSERVER. The default is typeCOMMANDwhich allows you to have as many of the program running, but therefore means you can't display status of it. Define the Service Object withSERVTYPE(SERVER)and thenDISPLAY SVSTATUSwill show status of the running program.Read more about this inWorking with ServicesAlso, another helpful hint looking at yourSTARTCMDvalue, did you know that you can use a replaceable insert instead of having to provide the full installation path to the program. Read more about this inReplaceable inserts on service definitions\n"}
+{"text": "### Human: I try connect to WMQ from a simple web service launched on WebSphere app server.On WMQ I have channel with SSL. I use self-signed certificates for now.In the case of glassfish I just add this cert to key store in domain and all works well(off cause I configure my MQQueueConnectionFactory).But on WebSphere this trick don't work:[5/13/13 14:00:25:058 FET] 00000060 SystemOut O %% Invalidated: [Session-94, SSL_RSA_EXPORT_WITH_RC4_40_MD5]\n[5/13/13 14:00:25:058 FET] 00000060 SystemOut O jmsContainer-1, SEND SSLv3 ALERT: fatal, description = certificate_unknown\n[5/13/13 14:00:25:058 FET] 00000060 SystemOut O jmsContainer-1, WRITE: SSLv3 Alert, length = 2\n[5/13/13 14:00:25:058 FET] 00000060 SystemOut O [Raw write]: length = 7\n[5/13/13 14:00:25:058 FET] 00000060 SystemOut O 0000: 15 03 00 00 02 02 2e .......\n\n[5/13/13 14:00:25:058 FET] 00000060 SystemOut O jmsContainer-1, called closeSocket()\n[5/13/13 14:00:25:058 FET] 00000060 SystemOut O jmsContainer-1, handling exception: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.j: PKIX path building failed: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target\n[5/13/13 14:00:25:058 FET] 00000060 DefaultMessag E org.springframework.jms.listener.DefaultMessageListenerContainer refreshConnectionUntilSuccessful Could not refresh JMS Connection for destination 'fromESB' - retrying in 5000 ms. Cause: JMSWMQ0018: Failed to connect to queue manager 'qm1' with connection mode 'Client' and host name '192.168.56.101(1414)'.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2397' ('MQRC_JSSE_ERROR').How do I configure WebSphere app server to use ssl(how to add server(WMQ) certificate to trust store? or where is the trust store?)?### Assistant: Ok. I solve this by myself.Configure WMQ:Create keystorerunmqckm -keydb -create -db \"c:\\dev\\sslqm001\\sslqm001.kdb\" -pw\nserverpass -type cms -expire 365 -stashCreate certificate and add it to keystorerunmqckm -cert -create -db \"c:\\dev\\sslqm001\\sslqm001.kdb\" -pw\nserverpass -label ibmwebspheremqssl_qm001 -dn \"CN=SSL_QM001,OU=IT,O=SomeCompany,L=Minsk,ST=Belarus,C=\nBY\" -expire 365Export this certificate from keystore to file.runmqckm -cert -extract -db \"c:\\dev\\sslqm001\\sslqm001.kdb\" -pw\nserverpass -label ibmwebspheremqssl_qm001 -target SSL_QM001.crt -format asciiIn Queue Manager settings, tab \"SSL\" set path to keystore without.kdband FIPS to No:ALTER QMGR SSLKEYR('c:\\dev\\sslqm001\\sslqm001')\nALTER QMGR SSLFIPS(NO)Create new channelIn channel settings, tab \"SSL\" set cipher to some value(with works for me: DES_SHA_EXPORT), and auth to optionalDEFINE CHANNEL('SSL_CHANNEL') CHLTYPE(SVRCONN) TRPTYPE(TCP) SSLCIPH(DES_SHA_EXPORT) SSLCAUTH(OPTIONAL) REPLACEIn Queue Manager refresh SSL:REFRESH SECURITY TYPE(SSL)Change your appcontex:\n \n \n \n \n \n \nSetup SSL on WASGo To:Security \u2192 SSL certificate and key management \u2192 SSL configurations \u2192\nNodeDefaultSSLSettings \u2192 Key stores and certificates \u2192 NameOfStore \u2192\nSigner certificatesAdd your certificate, that we export instep 3\n"}
+{"text": "### Human: i can see error as below from the error log of my QMGR:- Process(27605.1) User(umts) Program(runmqtrm)\nAMQ6047: Conversion not supported.\n\nEXPLANATION:\nWebSphere MQ is unable to convert string data tagged in CCSID 0 to data in\nCCSID 0.\nACTION:\nCheck the WebSphere MQ Application Programming Reference Appendix and the\nappropriate National Language Support publications to see if the CCSIDs are\nsupported by your system.That shows the CCSID is0; However, my current CCSID used by QMGR is819dis qmgr ccsid\n 1 : dis qmgr ccsid\n QMNAME(QMUMBFEA) CCSID(819)So what's the problem with the CCSID? Is the MQ bug or sth else?BTW, MQ version is6.0.2.9Please help me out, thanks in advance### Assistant: Its not an MQ bug.Its just that your putting application is setting the CCSID of your message equal to zero.\nNow, the queue manager is trying to convert the message to its own CCSID, which fails.You can escape from this conversion by turning off the channel conversion for the channel your application is using to put the message.\n"}
+{"text": "### Human: I am running Weblogic 10.3 on Linux and I have setup a bridge to Webspere MQ. I am sending a TextMesasge from Weblogic and it is being transfered to MQ. But when I am reading the message on MQ side like// Receiver reader - my class\nreader.qMgr = new MQQueueManager(qManager);\nint openOptions = MQOO_INPUT_AS_Q_DEF | MQOO_OUTPUT ;\n\nMQQueue localQueue = reader.qMgr.accessQueue(queueName, openOptions);\nMQMessage msg = new MQMessage();\nMQGetMessageOptions gmo = new MQGetMessageOptions(); \nlocalQueue.get(msg, gmo);\n\nint n = msg.getDataLength();\nSystem.out.println(\"The message is \" + n + \" bytes long\");\nString msgText = msg.readStringOfByteLength(n);\nSystem.out.println(\"The message is: \" + msgText);I am getting:The message is 154 bytes long\nThe message is: RFH \ufffd\ufffdMQSTR \ufffd jms_text Hqueue:///Q113575850399442 ABCDE\"ABCDE\" is my message.Do I have somehow to instruct Websphere MQ to perform JMS->MQ conversion so the message will be read as simple 'ABCDE'?Thanks### Assistant: The program sending the messages should set theTARGCLIENTparm as describedhere.Please bear in mind that all WMQ V6.x is out of support. If you were to use one of the supported versions (all the v7.x) you would be able to set the queue'sPROPCTLattribute to cause the QMgr to strip the JMS headers without little or no code changes.You can get the new version of WMQ through Passport Advantage if your company has a support agreement in place. The new client is available at no charge asSupportPac MQC75.You can mix client and QMgr versions and the new clients have a number of bug fixes and new features (many of which you can use even while connecting to an older QMgr). The newer client and QMgr will also have security patches not present on the V6 code. Please try to get to a supported version at least of the client since its free but preferably of the QMgr as well.\n"}
+{"text": "### Human: I'm trying to read messages of an MQ, I've been followingthis approach from IBMto create \"a WCF custom channel by suppling binding and endpoint information programmatically\".I've got a similar mechanism working with SOAP message which have a header specifying the class and method to be called for each incoming message.I'm now wanting to process messages which are not in SOAP format from another queue, but I get this error;System.ServiceModel.CommunicationException: WCFCH0314E: The recieved message 'ID: ...' could not be de-serialized The message format or contents is not consitent with the selected message encoder and cannot be interpreted as a SOAP/JMS message. Review the linked exceptions for futher details. ---> System.ServiceModel.CommunicationException: Unrecognized message version.This makes sense as the example uses SoapJmsIbmTransportBindingElement. Unfotunately, there doesn't seem to be any alternative binding element in IBM.XMS.WCF.Is it possible to create a WCF custom channel for MQ for non-soap messages?### Assistant: Currently MQ WCF custom channel supports only SOAP messages, no support for non-SOAP messages. The MQ WCF custom channel looks for specific message headers to identify the incoming message as a WCF message. The WCFCH0314E exception will be thrown if those headers are not present.\n"}
+{"text": "### Human: I am using Java API for WMQ.I have seen that RFHUTIL is able to load all queue names in a drop down list for a queue manager.Same way, I wanted to get all queue names for a queue manager in a list.It is being done by RFHUTIL, so definitely it is possible.\nI checked the functions available for MQQueueManager class but could find any solution.Need some advice.### Assistant: Listing queue names in a queue manager is an administrative job. You have to use Programmable Command Format (PCF) classes to do that. There are number of PCF commands to create, delete, list queue, channels, etc. Thislinkdescribes PCF in detail.For listing queues you can use MQCMD_INQUIRE_Q or MQCMD_INQUIRE_Q_NAMES PCF command. There are samples shipped with MQ. There isPCF_DisplayActiveLocalQueues.javais a useful one for you.\n"}
+{"text": "### Human: I am trying to use MQQueueManager with multiple instances\nIn .net, we have IBM MQ jar provided with MQC.CONNECTION_NAME_PROPERTYConnectionName = \"fred.mq.com(2344),nick.mq.com(3746),tom.mq.com(4288)\";\n Hashtable Properties-new Hashtable();\n properties.Add(MQC.CONNECTION_NAME_PROPERTY,ConnectionName);\n MQQueueManager qmgr=new MQQueue Manager(\"qmgrname\",properties);Source:http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/index.jsp?topic=%2Fcom.ibm.mq.doc%2Fun11010_.htmBut, a similar thing where I can use the connection name list on MQQueueManager, using java is not provided.Could you please help me here?\nI am using 7.0.1.6 jars### Assistant: Please refer toUsing a client channel definition table with WebSphere MQ classes for Javain the Infocenter. I've linked to the V7.0 Infocenter since you mentioned that's the version you are using but it works the same in later versions.Before there were Multi-Instance QMgrs and the corresponding multi-instance CONNAME attributes in the channel definitions, there was the Client Channel Definition Table or CCDT as it is more commonly known. The CCDT contains the CLNTCONN definitions for any number of channels to one or more QMgrs. When multiple entries have the same value in the QMName field, they are treated as a group. (Note, the QMName in the CCDT doesnotneed to match the actual QMgr name. That would force you to use non-unique QMgr names which is not a good practice. It is just an index into the CCDT to identify groups of channels.)To better understand the CCDT, please read the topics underConnecting WebSphere MQ client applications to queue managersin the Infocenter and in particular,Examples of channel weighting and affinity,Role of the client channel definition tableandExamples of MQCONN calls. (Access these from the Table of Contents on the left. At the very top right of the frame is a button that will sinc the Table of Contents to whatever page you are on if you get lost.)The one \"gotcha\" with CCDT is that each channel name within it must be unique. This differs from the Multi-Instance CONNAME which looks for the exact same channel at different IP addresses. This is because the CCDT file is maintained using MQSC commands on the QMgr. Within the namespaces managed by the queue manager, all object names must be unique. When defining channels on a QMgr, each channel must have a unique name. In the case of the CCDT the entries are defined using CLNTCONN channels. Although these point to SVRCONN channels defined onotherQMgrs, because all the CLNTCONN channels are defined in the same namespace, they must be unique.To illustrate this further consider provisioning an app called PAYROLL. You might construct the channel names based on the app name combined with the QMgr name. This results in a channel that describes a from-->to relationship reading left to right. For example, to define the CCDT for three QMgrs you would have:* On any QMgr\nDEF CHL(PAYROLL.QMGR1) CHLTYPE(CLNTCONN) QMNAME(PAY) CONNAME(\"qm1host(1414)\")\nDEF CHL(PAYROLL.QMGR2) CHLTYPE(CLNTCONN) QMNAME(PAY) CONNAME(\"qm2host(2414)\")\nDEF CHL(PAYROLL.QMGR3) CHLTYPE(CLNTCONN) QMNAME(PAY) CONNAME(\"qm3host(3414)\")\n\n*On QMgr1\nDEF CHL(PAYROLL.QMGR1) CHLTYPE(SVRCONN) \n\n*On QMgr2\nDEF CHL(PAYROLL.QMGR2) CHLTYPE(SVRCONN) \n\n*On QMgr3\nDEF CHL(PAYROLL.QMGR3) CHLTYPE(SVRCONN)Then the app specifies the QMgr name as*PAYand the WMQ client code chooses among the three entries. Additional parameters are available for weighting the entries and retry order, which you will see in the docs.Note: the examples shown are stripped down to the essential elements that illustrate the concept. The SVRCONN entries for aproductionimplementation would include an MCAUSER and/or a channel exit, possibly SSL parms and, on V7.1 or later, some CHLAUTH rules.\n"}
+{"text": "### Human: We are sending XML text messages via a remote queue definition CLIENT.DATA (transmit queue, send/recv channels etc.) from our queue manager QM_MINE queue manager QM_CLIENT and queue CLIENT.DATA. The message reaches the destination (CLIENT.DATA queue at the client's). The problem at hand is to able to receive acknowledgement messages (exact copy of the message sent) on a local queue CLIENT.DATA.ACK in QM_MINE as soon as messages reaches CLIENT.DATA in QM_CLIENTautomatically.I found couple of resources at WebSphere v7.1 infocenter onreply-to queueandmessage acknowledgementhowever they were not really helpful to me.So far I tried to use the reply to queue way. I created a transmit queue QM_MCT on QM.OCC. Every message I send to the CLIENT.DATA queue, I specified the reply-queue using setJMSReplyTo() method. However I am sure that is not it, there is more I am missing.MQ Objects Summary:QM_MINE: CLIENT_DATA (remoteQ), QM_CLIENT (transmitQ), CLIENT_DATA_ACK(localQ)QM_CLIENT: CLIENT_DATA (localQ), QM_MINE (transmitQ),And, sender/receiver channels at both ends.Source Code Fragements:Client Data Sender (under transaction):public class ClientServiceImpl extends JmsGatewaySupport implements ClientService {\n\n @Override\n public void sendClientData(String dataXML) {\n getJmsTemplate().convertAndSend(dataXML);\n }\n}Message Converter :public Message toMessage(Object o, Session session) throws JMSException, MessageConversionException {\n String dataXML = (String) o;\n TextMessage message = session.createTextMessage();\n message.setJMSReplyTo(replyToQueue);\n message.setText(dataXML);\n return message;\n}Note:Current I don't have any MDP or MDB to listen and consume messages from CLIENT_DATA queue in QM_CLIENT. I merely send it from QM_MINE and it gets moved to QM_CLIENT by MQ. Do I need to consume the messages to get this working?I use java, JMS , Spring and WebShere MQ v7.1 on Linux. Any more information will be provided upon request.### Assistant: Please see the section on theMQMD.Reportfield. Yes, you do need to set the reply-to fields so that the acknowledgement can find its way back to you. However you also need to tell WMQ that you want it to generate the report message. For what you want, set the field toMQRO_COA_WITH_FULL_DATA.\n"}
+{"text": "### Human: This is in Cluster Environment. Queue Manager lost its identity in cluster and it is unable to connect to other servers. All channels to repository and others were retrying state.CPU usage is optimal in this server. This is a UNIX box.When I checked the logs below is it,AMQ9532: Program cannot set queue\n attributes.EXPLANATION: The attempt to set the\n attributes of queue\n 'SYSTEM.CLUSTER.TRANSMIT.QUEUE' on\n queue manager 'QMGR.SERVER6A' failed\n with reason code 2102.ACTION: Ensure\n that the queue is available and retry\n the operation.----- amqrmssa.c : 690 --------------------------------------------------------AMQ9999: Channel program ended\n abnormally.EXPLANATION: Channel program\n 'Channel.Coord00' ended abnormally.ACTION: Look at previous error\n messages for channel program\n 'Channel.Coord00' in the error files to\n determine the cause of the failure.----- amqrccca.c : 883 --------------------------------------------------------03/06/11 08:24:26 AMQ9544: Messages\n not put to destination queue.EXPLANATION: During the processing of\n channel 'Channel.Server6A' one or more\n messages could not be put to the\n destination queue and attempts were\n made to put them to a dead-letter\n queue. The location of the queue is\n 1, where 1 is the local dead-letter\n queue and 2 is the remote dead-letter\n queue.ACTION: Examine the contents of\n the dead-letter queue. Each message\n is contained in a structure that\n describes why the message was put to\n the queue, and to where it was\n originally addressed. Also look at\n previous error messages to see if the\n attempt to put messages to a\n dead-letter queue failed. The program\n identifier (PID) of the processing\n program was '1372200'.----- amqrmrca.c : 1318 -------------------------------------------------------Then I did recycled the queue manager it is now fine?My question here is how did the MQ resource problem occurr? CPU usage of this server is not more than 15%. Please advise.### Assistant: There are three different and unrelated problems shown in the log.AMQ9532: Program cannot set queue\n attributes.EXPLANATION: The attempt to set the\n attributes of queue\n 'SYSTEM.CLUSTER.TRANSMIT.QUEUE' on\n queue manager 'QMGR.SERVER6A' failed\n with reason code 2102.The 2102 is MQRC_RESOURCE_PROBLEM and presumably the resource issue referred to in the posting. The 2102 can be any kind of scarce resource, including semaphores, user processes, queue handles, etc. Since the QMgr was attempting to set an attribute of the queue, it would have already had a thread instantiated but it would have required additional queue handles. When something like this occurs, use your admin tool (WMQ Explorer, mqmon or one of the many 3rd party tools) to look into the number of open queue handles, open channels, etc. Note that for a resource error, it will be necessary to maintain an open connection to the QMgr or else the tool will be unable to make a new connection when the resource shortage occurs.AMQ9999: Channel program ended\n abnormally.EXPLANATION: Channel program\n 'Channel.Coord00' ended abnormally.ACTION: Look at previous error\n messages for channel program\n 'C00.US.MP00' in the error files to\n determine the cause of the failure.This error appears to actually be two different errors since it references two different channels. One of these appears to be an outbound cluster channel and the other appears to be a point-to-point channel. Neither channel mentioned in this error are associated with the first and last error message.03/06/11 08:24:26 AMQ9544: Messages\n not put to destination queue.EXPLANATION: During the processing of\n channel 'Channel.Server6A' one or more\n messages could not be put to the\n destination queue and attempts were\n made to put them to a dead-letter\n queue. The location of the queue is 1,\n where 1 is the local dead-letter queue\n and 2 is the remote dead-letter queue.ACTION: Examine the contents of the\n dead-letter queue. Each message is\n contained in a structure that\n describes why the message was put to\n the queue, and to where it was\n originally addressed. Also look at\n previous error messages to see if the\n attempt to put messages to a\n dead-letter queue failed. The program\n identifier (PID) of the processing\n program was '1372200'.The last error appears to be an inbound cluster channel. Since the first error was trying to set attributes of the cluster transmit queue, it could only have been associated with an outbound channel. Therefore the first and last error messages are unrelated. This error message appears to show an inbound message that was destined for a queue and that queue was full, PUT-disabled, or otherwise unable to accept the message. The message was therefore routed to the dead letter queue.For the resource error, I would suggest reviewing the performance report appropriate to your platform. Go to theSupportPacs pageand look for those SupportPacs named MP* and then look for the one for your platform. The Performance Reports give you specific tuning advice.You may also want to review theProblem Determinationchapter in the System Administration manual for additional advice on how to identify resource issues.TheWebSphere MQ cluster design and operationarticle in the developerWorks Mission:Messaging series has specific advice about keeping clusters healthy.Last but not least, theWebSphere MQ MustGatherpage has sections on troubleshooting for all major platforms and categorized by problem area.\n"}
+{"text": "### Human: My setup is Spring 3 JMS, MVC + Websphere MQ + Websphere 7\n\n\n\n\n \n \n \nWhen I start up the server, the listener seems to start correctly since it receives the messages that are on the queue as I put them.However, once I run any simple controller/action that doesn't even have anything to do with JMS it gives me the message below over and over...DefaultMessag W org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure Setup of JMS message listener invoker failed for destination 'queue:///ABCDEF.EFF.OUT?persistence=-1' - trying to recover. Cause: MQJMS2008: failed to open MQ queue ''.; nested exception is com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2042'.\nDefaultMessag I org.springframework.jms.listener.DefaultMessageListenerContainer refreshConnectionUntilSuccessful Successfully refreshed JMS Connection\n\nConnectionEve W J2CA0206W: A connection error occurred. To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source.\n\nConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$XXXQCF$JMSManagedConnection@2. The exception is: javax.jms.JMSException: MQJMS2008: failed to open MQ queue ''.\n\nConnectionEve W J2CA0206W: A connection error occurred. To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source.\n\nConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource jms/XXXQCF. The exception is: javax.jms.JMSException: MQJMS2008: failed to open MQ queue ''.The original listener seems to be still running correctly...but I think the controller is somehow triggering off another connection?\nDoes anyone know what I should check for or what might cause this issue?thanks### Assistant: The 2042 means \"Object in use\". Since there is no concept of exclusive use of queues for message producers, then one of your consumers is locking the queue.This behavior is controlled by thequeue definition's DEFSOPT attribute. This is at the queue manager itself and not in the managed object definitions or your factory options. From the command line while signed on as mqm (or the platform equivalent if the QMgr is on Windows, iSeries, z/OS, etc.) you would need to start runmqsc and issue the following commands to verify and then fix the problem. In my example, the QMgr is PLUTO and the example queue is SYSTEM.DEFAULT.LOCAL.QUEUE./home/mqm: runmqsc PLUTO\n5724-H72 (C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.\nStarting MQSC for queue manager PLUTO.\n\ndis q(system.default.local.queue) defsopt\n 1 : dis q(system.default.local.queue) defsopt\nAMQ8409: Display Queue details.\n QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE) TYPE(QLOCAL)\n DEFSOPT(EXCL)\nalter ql(system.default.local.queue) defsopt(shared)\n 2 : alter ql(system.default.local.queue) defsopt(shared)\nAMQ8008: WebSphere MQ queue changed.\ndis q(system.default.local.queue) defsopt\n 3 : dis q(system.default.local.queue) defsopt\nAMQ8409: Display Queue details.\n QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE) TYPE(QLOCAL)\n DEFSOPT(SHARED)If you display the queue and find that it is already set for DEFSOPT(SHARED) then something must be specifying exclusive use of the queue through the API. That typically means a C or base Java program since these non-JMS APIs have access to low-level WMQ functionality. Those can be a little trickier to diagnose and I usually use a trace or theSupportPac MA0Wexit to display the API calls and options used. If this is the case, I'd want to know more about what is meant by \"simple controller/action\" as noted in the original post.Finally, if the queue that you are accessing is a remote queue then it will resolve to a transmit queue. The channel will always set a transmit queue to GET(INHIBITED) and acquire an exclusive lock on it. This is consistent with WMQ functionality in that an application can only GET messages from a local queue.\n"}
+{"text": "### Human: Our code runs in weblogic and we MQ 6.0. No matter if I use the defaultcreateQueueConnection()orcreateQueueConnection(\"myuserid\",\"mypassword\")it always seems to use useridmqm. See code below.When I connect from version 6.0 to an older mq installion 5 it seems to throw the following errorjavax.jms.JMSSecurityException: MQJMS2013: invalid security authentication supplied for MQQueueManagerusing the defaultcreateQueueConnection()unless I send a blank userid/password as increateQueueConnection(\"\",\"\")How can I get myuserid to be send instead ?Hashtable properties = new Hashtable(2);\nproperties.put(Context.PROVIDER_URL,context);\nproperties.put(Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.fscontext.RefFSContextFactory\");\n\nInitialContext ctx = new InitialContext(properties);\nQueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup(\"QCF\");\nQueueConnection qc = qcf.createQueueConnection();\njavax.jms.Queue q = (javax.jms.Queue) ctx.lookup(\"MYQUEUE\");\nQueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\nTextMessage tm = qs.createTextMessage();\ntm.setText(outString);\nQueueSender sender = qs.createSender(q);\nsender.send(tm);\nsender.close();\nqs.close();\nqc.close();### Assistant: If you are setting the ID in the createQueueConnection, rest assured, itisbeing presented to the queue manager. The problem you are seeing is that the SVRCONN channel definitionon the QMgrhas the value MCAUSER('mqm') hard coded. This overrides any value presented by the client app.A couple of things to note here.Although you can send the ID and password, WMQ accepts these at face value. The fields exist to make the credentials available for a channel exit that can validate them. Without such an exit the channel just runs as whatever ID the app claims to be and the password is ignored.For the reason stated above, I always tell people not to trust the credentials presented unless they have such an exit. The administrator must code the appropriate value into the MCAUSER.The administrative ID ('mqm' on UNIX flavors) is NOT the appropriate value. It confers administrative authority to anyone connecting on that channel.For a LOT more on this topic and pointers to the WMQ security presentation and WMQ Security Lab guide from IMPACT, please seethis SO question.\n"}
+{"text": "### Human: I am trying to write to an IBM MQSeries host with:public void WriteMessage(string message)\n{\n queueMessage = new MQMessage();\n queueMessage.WriteString(message);\n queueMessage.Format = MQC.MQFMT_STRING;\n queuePutMessageOptions = new MQPutMessageOptions();\n\n queue.Put(queueMessage, queuePutMessageOptions);\n}My errorcatch gives me an error however:Error in the applicationWhich doesn't show much of course. So I checked the event log on the server and this showed me the error:An error occurred receiving data from\n stx041774 (192.168.225.51) over\n TCP/IP. This may be due to a\n communications failure.The return code from the TCP/IP (recv) call was 10054 (X'2746').Record these values and tell the\n systems administrator.I looked up 10054 and means:An existing connection was forcibly\n closed by the remote host.Does anyone have any idea what I can do to make this work? Is there perhaps an MQC option I have to set for writing? Because I have no idea what to do with the options, I'm not even sure if this is the issue.### Assistant: I solved this issue with an option mqc.mqoo_output:queue = qManager.AccessQueue(QueueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);\n"}
+{"text": "### Human: Is there any standard way of controlling concurrency and consumption in an MDB? Every suggestion I've been able to find seem to be application server or resource-adapter specific (e.g.maxSession@ActivationConfigProperty).The Problem\u2122We run some relatively heavy analysis jobs on a two-node JBoss setup (EAP 6.3), and want to parallelise jobs as well as impose an upper limit on the number of concurrent jobs so we don't swamp the database server. Jobs are started from a web front-end, and should be started whenever there's a free processing slot - there's no prioritisation or ordering constraints. We use a message queue (IBM WMQ, because of politics) to distribute \"start analysis\" messages to the nodes.Current progressAfter a lot of fiddling following various suggestions that turned out to be Non-Working Resource-Adapter-Specific Cargo-Cult Misinformation\u2122 :), Ithoughtthe problem was solved by defining an EJB pool for the MDB. This does solve the concurrency issue, but unfortunately it seems like a node with no free MDBs still pulls messages of the queue - which can leave one node underutilised and the other fully loaded with a backlog.If I understand theIBM documentationcorrectly, this behaviour should be controllable with thereadAheadAllowedconfiguration option, but this doesn't seem to influence my results at all.So, is there:A Java EE-standard way to control message consumption?A (working) IBM WQ specific configuration option?A JBoss specific way to fix it?Some other smart solution that I haven't thought of?Alternatively I could probably rework the architecture to use a topic queue, and let each node attempt something along the lines ofUPDATE Projects SET Status='inprogress' WHERE Id=42 AND Status='inqueue';- but I'd rather not go there if I don't have to, mostly because of the Change Requests required for getting the queue changed :)### Assistant: MQ, and indeed JMS, is designed and optimized to get the message as far down the pipe as possible, as fast as possible. The state of each message is tracked by the queue manager but a concurrency requirement would require the QMgr to track the state of messages in relation to one another. MQ does not do that.There is some granularity in tuning the Activation Spec connection pool and some in the transaction scoping, but these are intended to influence the dynamic behavior of the server and not specify it precisely.Managing application state across multiple messages is exactly what the ESB products such as IBM Integration Broker are designed to do. Whereas MQ is a transport that looks only at message headers to perform routing and delivery, the ESB looks at message relationships and content. Unless the JMS spec defines a concurrency management API, this division of responsibility with MQ doing transport and the ESB doing processing is not likely to change.Whether it is implemented in the ESB or JEE code, what you are describing is theMessage Dispatcher Patternfrom theEnterprise Integration Patternsbook, one ofthedefinitive architectural references in the messaging world. There are a couple ways to write this, depending on preferences for instrumentation.TokenizationApplication instances perform aGETwith wait on a token queue and under syncpoint.On receipt of a token message, the appPUTs the same message back on the token queue, again under syncpoint.The app performs aGETwith wait on the application queue under syncpoint.On receipt of an application message, the app processes it then performs aCOMMITorROLLBACKas appropriate.The app instances compete for the token messages before processing an app message. The result is that app messages are generally processed as fast as they arrive but under load the max concurrency equals the number of token messages.Generally the token messages are informational, for instance containing a counter that is incremented with each iteration and possibly instance info of the last app to write the token message. This provides some diagnostic insight as to what's going on. In some cases a monitoring app also listens on the token queue to sample that information and write to a dashboard. In that case an extra token message is added to the queue to account for the activity of the monitoring app.Standalone dispatcherThe dispatcher application listens on the advertised destination queue for messages and on an ACK queue for acknowledgement messages.A counter compares messages outstanding to{max outstanding message limit}set in the dispatcher app's configuration.If outstanding messages < limit, messages are moved to the application's input queue and the outstanding message counter incremented.When the business applicationGETs a message, it also puts a message to the dispatcher'sACKqueue, both actions under syncpoint.When the business application issuesCOMMITthe dispatcher receives the ACK and decrements the outstanding messages counter.The dispatcher app can request Confirmation on Delivery messages but these do not always correlate to the business app successfully processing the transaction. If the business app explicitly puts the ACK messages in the same unit of work as the business message that was consumed the result is rock solid.\n"}
+{"text": "### Human: I'm having problem usingMQSeriesPerl module in multi-threading environment. Here what I have tried:create two handle in different thread with$mqMgr = MQSeries::QueueManager->new(). I thought this would give me two different connection to MQ, but instead I got return code 2219 on the second call toMQOPEN(), which probably means I got the same underling connection to mq from two separate call to new() method.declare only one $mqMgr as globalsharedvariable. But I can't assign reference to an MQSeries::QueueManager object to$mqMgr. The reason is\"Type of arg 1 to threads::shared::share must be one of [$@%] (not subroutine entry)\"declare only one$mqMgras global variable. Got same 2219 code.Tried to passMQCNO_HANDLE_SHARE_NO_BLOCKintoMQSeries::QueueManager->new(), so that a single connection can be shared across thread. But I can not find a way to pass it in.My question is, with Perl module MQSeriesHow/can I get separate connection to MQ queue manager from different thread?How/can I share a connection to MQ queue manager across different thread?I have looked around but with little luck, Any info would be appreciated.related question:C++ - MQ RC Code 2219Update 1: add a example that two local MQSeries::QueueManager object in two thread cause MQ error code 2219.use threads;\nuse Thread::Queue;\nuse MQSeries;\nuse MQSeries::QueueManager;\nuse MQSeries::Queue;\n\n# globals\nour $jobQ = Thread::Queue->new();\nour $resultQ = Thread::Queue->new();\n\n# ----------------------------------------------------------------------------\n# sub routines\n# ----------------------------------------------------------------------------\n\nsub worker {\n # fetch work from $jobQ and put result to $resultQ\n # ...\n}\n\nsub monitor {\n # fetch result from $resultQ and put it onto another MQ queue\n my $mqQMgr = MQSeries::QueueManager->new( ... );\n\n # different queue from the one in main\n # this would cause error with MQ code 2219\n my $mqQ = MQSeries::Queue->new( ... );\n\n while (defined(my $result = $resultQ->dequeue())) {\n # create an mq message and put it into $mqQ\n my $mqMsg = MQSeries::Message->new();\n $mqQ->put($mqMsg);\n } \n}\n\n# main\nunless (caller()) {\n # create connection to MQ\n my $mqQMgr = MQSeries::QueueManager->new( ... );\n my $mqQ = MQSeries::Queue->new( ... );\n\n # create worker and monitor thread\n my @workers;\n for (1 .. $nThreads) {\n push(@workers, threads->create('worker'));\n }\n my $monitor = threads->create('monitor');\n\n while (True) {\n my $mqMsg = MQSeries::Message->new ();\n\n my $retCode = $mqQ->get(\n Message => $mqMsg,\n GetMsgOptions => $someOption,\n Wait => $sometime\n );\n\n die(\"error\") if ($retCode == 0);\n next if ($retCode == -1); # no message\n\n # not we have some job to do\n $jobQ->enqueue($mqMsg->Data);\n }\n}### Assistant: There is a very real danger when trying to multithread with modules that the module is not thread safe. There's a bunch of things thatcanjust break messily because of the way threading works - you clone the current process state, and that includes things like file handles, sockets, etc.But if you try andusethem in an asynchronous/threaded way, they'll actreallyweird because the operations aren't (necessarily) atomic.So whilst I can't answer your question directly, because I have no experience of the particular module:Unless you know otherwise, assume youcan'tshare between threads. It might be thread safe, it might not. If it isn't, it might stilllookok, until one day you get a horrifically difficult to find bug as a result of a race condition in concurrent conditions.A shared scalar/list is explicitly described inthreads::sharedas basically safe (and even then, you can still have problems with non-atomicity if you're not locking).I would suggest therefore that what you need to do is either:have a 'comms' thread, that doesallthe work related to the module, and make the other threads use IPC to talk to it.Thread::Queuecan work nicely for this.treat each thread as entirely separate for purposes of the module. That includes loading it (withrequireandimport- notusebecause that acts earlier) and instantiating. (Youmightget away with 'loading' the module before threads start, but instantiating does things like creating descriptors, sockets etc.)lock stuff when there's any danger of interruption of an atomic operation.Much of the above also applies toforkparallelism too - but not in quite the same way, asforkmakes \"sharing\" stuff considerably harder, so you're less likely to trip over it.Edit:Looking at the code you've posted, and crossreferencing against theMQSeriessource:There is aBEGINblock, that sets up some stuff with the MQSeries at the point at which youuseit.Whilst I can't say for sure that this is your problem, it makes me very wary - because bear in mind that when it does that, it sets up some stuff - and then when your threads start, they inherit non-shared copies of \"whatever it did\" during that \"BEGIN\" block.So in light of what I suggested earlier on - I would recommend youtry(because I can't say for sure, as I don't have a reference implementation):require MQSeries; \nMQSeries->import;Put this in your code - in lieu ofuse-afterthread start. E.g. after you do thecreatesandwithinthe thread subroutine.\n"}
+{"text": "### Human: I am usingJNDI lookupfor the getting the connection object forWebsphere MQBroker on tomcat server. I am usingJmsTemplatefor sending the messages to the Queue on WMQ Broker and trying to avoid the Spring Xml based configuration and for that reason i have configured the Spring boot's application.properties file to specify theJNDI lookup name.below is the property from application.properties file.spring.jms.jndi-name= java:comp/env/XXXXi am using a Spring bean to define the JmsTemplate and below is the code for it.@Configuration\npublic class JmsMessageTemplateBean {\n\n //@Value(\"${spring.jms.jndi-name}\")\n //private ConnectionFactory connectionFactory;\n\n @Bean\n public JmsTemplate jmsTemplate() throws Exception{\n JmsTemplate jmsMessagingTemplate = new JmsTemplate();\n jmsMessagingTemplate.setDefaultDestinationName(\"Some Queue\");\n jmsMessagingTemplate.setConnectionFactory(connectionFactory);\n return jmsMessagingTemplate;\n }\n}i have a couple of questions:1.How to read the JNDI property from application.properties file and set the Connection object to Jms Template in the above bean.2.I have observed that the connection object from theJNDI lookupisMQQueueConnectionFactoryand from what i have researchedJmsTemplatesupportsjavax.jms.ConnectionFactoryobject. is there a way to convert theMQQueueConnectionfactoryobject tojavax.jms.Connectionfactory.Appreciate your answers.### Assistant: I also had a hard time figuring out how to implement a Spring Boot JMS Listener, listening to an ActiveMQ queue within a JBoss application server.ActiveMQ is supported by Spring Boot autoconfiguration, but since it was inside the JBoss server Spring Boot was failing to connect ActiveMQ. \nIn fact you need to defineconnectionFactoryandjmsListenerContainerFactorybeans yourself by doing a lookup on the JNDI provider.@Configuration\n@EnableJms\npublic class ActiveMqConnectionFactoryConfig {\n\n @Value(\"${broker.url}\")\n String brokerUrl;\n\n @Value(\"${borker.username}\")\n String userName;\n\n @Value(\"${borker.password}\")\n String password;\n\n @Value(\"${queue}\")\n String queueName;\n\n private static final String INITIAL_CONTEXT_FACTORY = \"org.jboss.naming.remote.client.InitialContextFactory\";\n private static final String CONNECTION_FACTORY = \"jms/RemoteConnectionFactory\";\n\n\n @Bean\n public ConnectionFactory connectionFactory() {\n try {\n System.out.println(\"Retrieving JMS queue with JNDI name: \" + CONNECTION_FACTORY);\n JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();\n jndiObjectFactoryBean.setJndiName(CONNECTION_FACTORY);\n\n jndiObjectFactoryBean.setJndiEnvironment(getEnvProperties());\n jndiObjectFactoryBean.afterPropertiesSet();\n\n return (QueueConnectionFactory) jndiObjectFactoryBean.getObject();\n\n } catch (NamingException e) {\n System.out.println(\"Error while retrieving JMS queue with JNDI name: [\" + CONNECTION_FACTORY + \"]\");\n } catch (Exception ex) {\n System.out.println(\"Error\");\n }\n return null;\n }\n\n Properties getEnvProperties() {\n Properties env = new Properties();\n env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);\n env.put(Context.PROVIDER_URL, brokerUrl);\n env.put(Context.SECURITY_PRINCIPAL, userName);\n env.put(Context.SECURITY_CREDENTIALS, password);\n return env;\n }\n\n @Bean\n public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(ConnectionFactory connectionFactory) {\n\n DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();\n factory.setConnectionFactory(connectionFactory);\n JndiDestinationResolver jndiDestinationResolver = new JndiDestinationResolver();\n\n jndiDestinationResolver.setJndiEnvironment(getEnvProperties());\n factory.setDestinationResolver(jndiDestinationResolver);\n return factory;\n }Then if you want to consume the queue you just define your JMS consumer class with a method annotated with@JmsListener(destination = \"${queue}\")@JmsListener(destination = \"${queue}\")\n public void receive(Message message) {\n System.out.println(\"Received Message: \" + message);\n }Hope that helps save a few hours of research ;)\nCheers\n"}
+{"text": "### Human: We are new to WebSphere MQ and we would like to know if we can create 2+RQSTRchannels in different QMgrs, connecting only oneSVRchannel on the server, like:Channel Name:CH1 (RQSTR) -----> CH1 (SVR)Then on another QMgr, another Channel Named:CH1 (RQSTR) -----> CH1 (SVR)When we try to start the 2nd CH1, we got error message like \"channel is in use\".We looked up quite a lot documents and forums all saying it seems we could create multiple instance of anRQSTR, so can those all be connected to our server through oneSVRchannel? Or do we simply have to create as many asSVRchannels on the server for theRQSTRto pair up?### Assistant: No. ASVRorSDRchannel connects to one and only one remote destination at a time. It is possible to have aSVRorSDRdefined on multiple QMgrs come to a singleRCVRorRQSTRon a single QMgr.This is also true in an MQ cluster. A QMgr'sCLUSRCVRaccepts connections from all nodes in the cluster. Each of those nodes auto-defines a matchingCLUSSDRof the same name. Thus in a cluster there will be one inbound channel namedCLUSTER.QMGRand oneCLUSSDRon each remote QMgr that also has the nameCLUSTER.QMGR.Channels manage messages in transactional batches. An outbound channel has one destination so that if a batch ever fails, it knows to which remote node it has to connect in order to reconcile the transaction. An inbound channel keeps track of multiple inbound connections separately.TheRQSTR/SVRchannels are designed for the case that a firewall will allow connections initiated only from the inside. In order to get inbound messages, theRQSTRstarts the channel. This also means that theSVRcannot hang up the socket and will accept a connction from anyRQSTRthat can start it.Contrast this with the behavior of aRQSTR/SDRpair. In that case, theSDRreceives the start request from theRQSTRbut then immediately closes the socket and proceeds to connect to whatever is in itsCONNAME.When I have a B2B channel connection, I always use aRQSTR/SDRpair. MyRQSTRcan initiate the business partner'sSDRwhich is often helpful if I'm sending transactions but no messages are coming back. If I start myRQSTRand the channel comes up, that rules out connectivity issues. If messages then flow across, I know the app on the other end is up but channel triggering is not working. If the channel starts but no messages arrive, I know the remote app is down.Then when I call the business partner to report the outage and can tell themexactlywhat's wrong on their end, they think I'm a genius. Not that I do it to make people think I'm a genius, but they're generally a lot more willing to take my calls if I'm usually accurate with the diagnosis.TheRQSTRchannel was built on the assumption that you would use it with aSVRand therefore doesn't haveADOPTNEWMCAcapabilities. That's the only down side. If the network is generally reliable, it's not much of a down side so I useRQSTR/SDRpairs a lot.So to sum up, theSVRchannel is not intended to connect to multiple remote nodessimultaneously. It is intended to connect to anyoneof multiple remote nodes at a time. Since any properly configuredRQSTRcan start aSVRuse theSVRonly when you legitimately need to point it to different locations that are decided at run time and without making changes to the channel definition. Otherwise use aSDRwith multiple instances in theCONNAMEor use a classicSDRchannel and change theCONNAMEduring the failover.\n"}
+{"text": "### Human: the title of the question says pretty much all: is it possible to connect to a locally running IBM MQ Light with Java and JMS ?\nIn the comment section ofthis post, Rob Nicholson says it is not possible, but I wonder if things have changed. Sadly, I was not able to find information that explicitly negate this possibility, apart this comment.Just to clarify, MQ Light runs locally, not in IBM's bluemix.### Assistant: Sure you can use JMS with MQLight!As MQLight supports the wire protocol AMQP 1.0 you can use, for instance, theApache QPid Proton library.Working Sample in two files will produce a message to a MQLight queue.Main.javaimport org.apache.qpid.jms.JmsConnectionFactory;\nimport javax.jms.*;\n\npublic class Main {\n\n public static void main(String[] args){\n try {\n ConnectionFactory cf = new JmsConnectionFactory(\"amqp://localhost:5672\");\n Connection connection = cf.createConnection();\n Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);\n MessageProducer producer = session.createProducer(session.createQueue(\"QUE.BAR\"));\n producer.send(session.createTextMessage(\"foo bar\"));\n producer.close();\n session.close();\n connection.close();\n }catch(JMSException jmsException){\n jmsException.printStackTrace();\n }\n }\n}pom.xml\n\n 4.0.0\n\n com.example.test\n mqlight-jms\n 1.0-SNAPSHOT\n \n \n org.apache.qpid\n qpid-jms-client\n 0.3.0\n \n \n\n"}
+{"text": "### Human: We have SQL server 2012 as the DB server and Websphere MQ on Redhat Linux as the MQ server. Our applications are on a Redhat Linux server and implemented in C++.We need distributed transaction capability so that transactions can span both the resources (DB and MQ). A distributed transaction is managed by a Transaction Manager working across Resource Managers of the resources.WMQ has the ability to act as a Distributed Transaction Manager if the individual Resource Managers(DB and MQ) provide XA operations.\nMS SQL does have a ODBC library for Linux:http://www.microsoft.com/en-us/download/details.aspx?id=28160.Does the SQL Server library support XA operations such as xa_open, etc. which can let it participate in an XA transaction managed by WMQ?Other option is to use MS Distributed Transaction Coordinator as the Transaction Manager.Is it possible to use MSDTC from a C++ program running on Linux?Does MSDTC work with WMQ acting as a Resource Manager?Thanks,\nYash### Assistant: I wish I had better news for you...Assuming you're talking about V8 (although other releases are similar), there is no support for MS SQL Server at all when using MQ as the transaction manager. You can see this in the 'databases' section of the MQ SOE:http://www-969.ibm.com/software/reports/compatibility/clarity-reports/report/html/softwareReqsForProduct?deliverableId=1350550241693&osPlatform=Linux#sw-DatabasesMSDTC can be used, but only by clients running in Windows as far as I'm aware - I don't see how you could make it work for your scenario.Another option is to use a J2EE environment (WAS/JBoss etc). This will act as the transaction manager, and MS SQL & MQ will work as resources. Still, this doesn't solve your requirement to write in C++.The only suggestions I have for you that really work therefore are:1) Review the transaction managers MQdoessupport:http://www-969.ibm.com/software/reports/compatibility/clarity-reports/report/html/softwareReqsForProduct?deliverableId=1350550241693&osPlatform=Linux#sw-TransactionServers and GatewaysSadly I'm not familiar with the details of the options on there.2) Raise an 'RFE' with IBM as their customer. This is the mechanism they provide to allow customers/external parties to request new function:http://www.ibm.com/developerworks/rfe/Although there's no guarantee it will be accepted, or which version it might end up in (or when!).\n"}
+{"text": "### Human: After looking for a couple of days I have the problem to consume message from IBM MQ. I followed the documentation, but still, the system is not working fine. I'm using 4.8.0 and MQ 7.5.0.2error[2014-02-06 01:06:14,341] ERROR - JMSListener Unable to continue server startup as it seems the JMS Provider is not yet started. Please start the JMS provider now.\n[2014-02-06 01:06:14,342] ERROR - JMSListener Connection attempt : 1 for JMS Provider failed. Next retry in 20 seconds\n[2014-02-06 01:06:34,364] ERROR - JMSListener Unable to continue server startup as it seems the JMS Provider is not yet started. Please start the JMS provider now.\n [2014-02-06 01:06:34,365] ERROR - JMSListener Connection attempt : 2 for JMS Provider failed. Next retry in 40 seconds\n\nroot@sandbox:/opt/wso2esb-4.8.0/FFDC# more JMSCC0001.FDC\n----------------------------------START FFST------------------------------------\n/opt/wso2esb-4.8.0/FFDC/JMSCC0001.FDC PID:5897\n\n JMS Common Client First Failure Symptom Report\n\n\nProduct :- IBM WebSphere MQ classes for JMS\nDate/Time :- Thu Feb 06 00:54:07 CET 2014\nSystem time :- 1391644447539\nOperating System :- SunOS\nUserID :- root\nJava Vendor :- Oracle Corporation\nJava Version :- 23.3-b01\n\nSource Class :- com.ibm.mq.jms.MQQueueConnectionFactory\nSource Method :- readObject()\nProbeID :- XF001003\nThread :- name=localhost-startStop-1 priority=5 group=main ccl=org.eclipse.core.runtime.internal.adaptor.ContextFinder@1da36adaxis2 config\n \n com.sun.jndi.fscontext.RefFSContextFactory\n file:///var/tmp/jndi\n ivtQCF\n queue\n ivtQ\n \ntest jndi is workingjava JmsJndiConsumer -i file:///var/tmp/jndi -c ivtQCF -d ivtQ\nInitial context found!\nReceived message:\n\n JMSMessage class: jms_text\n JMSType: null\n JMSDeliveryMode: 2\n JMSExpiration: 0\n JMSPriority: 4\n JMSMessageID: ID:414d5120514d412020202020202020204424ee5203db0020\n JMSTimestamp: 1391646438379\n JMSCorrelationID: null\n JMSDestination: queue://QMA/QUEUE1\n JMSReplyTo: null\n JMSRedelivered: false\n JMSXAppID: JmsJndiProducer\n JMSXDeliveryCount: 1\n JMSXUserID: webservd\n JMS_IBM_Character_Set: UTF-8\n JMS_IBM_Encoding: 273\n JMS_IBM_Format: MQSTR\n JMS_IBM_MsgType: 8\n JMS_IBM_PutApplType: 28\n JMS_IBM_PutDate: 20140206\n JMS_IBM_PutTime: 00271840\nJmsJndiProducer: Your lucky number today is 324proxy\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n contentType\n application/xml\n \n \nI've check the network and i cannot see any connecton form esb to mq server.Any idea ?updateI have configured the axis server in the sample ($WSO2_HOME/samples/axis2Server/repository/conf/axis2.xml) with exactly the same jms transport (default).Atfer compiling the 'SimpleStockQuoteService' and starting the the server i can see that is working fine.cd wso2esb-4.8.1/samples/axis2Server/src/SimpleStockQuoteService/ && ant\ncd wso2esb-4.8.1/samples/axis2Server/ && ./axis2server.sh\n\n14/02/10 21:20:29 INFO jms.JMSListener: JMS listener started\n14/02/10 21:20:30 INFO jms.JMSListener: Connection attempt: 1 for JMS Provider for\nservice: SimpleStockQuoteService was successful!\n14/02/10 21:20:30 INFO jms.ServiceTaskManager: Task manager for service : \nSimpleStockQuoteService [re-]initialized\n14/02/10 21:20:31 INFO jms.JMSListener: Started to listen on destination : ivtQ of \ntype queue for service SimpleStockQuoteService\n14/02/10 21:20:31 INFO util.SampleAxis2ServerManager: [SimpleAxisServer] StartedI still not understand why is not working inside carbon !!!### Assistant: The only way I found to made it work is to modify the startup script (ws02server.sh) to add the MQ client java library to the classpathCARBON_CLASSPATH=/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:\"$CARBON_CLASSPATH\"If MQ transport type is BIND (ws02 on the same server as the MQ server) the JNI library need also to be included (-Djava.library.path=/opt/mqm/java/lib)Copying the MQ java library to therepository/component/libas stated in the documentation is not working.Tested with MQ 7.5.0.2 and ws02 4.8.1 on Solaris and RHEL7\n"}
+{"text": "### Human: I've been trying unsuccessfully to get a spring message driven pojo (MDP) to work in a test region (tomcat linux to mq server linux) after it works ok between two dev machines (windows tomcat client to linux server).Ports and spring configuration seem ok. Trace level logging shows all property values populated correctly. Another war can actually put on the MQ Queue using JMS from this test region tomcat server. This war uses the same tomcat context.xml file that points to the hostname of the MQ server. Resource references in context.xml and web.xml are ok. The listener is set up as described inGetting error : WebSphere MQ reason code 2538?The exception on the tomcat server comes from com.ibm.mq.jmqi which I understand is a stub to call JNI i.e., native C/C++ code presumably to be installed on the client. I was unclear whether you actually need to install the MQ client when you use JMS. We installed the MQ client but we still get this message. (Reading the docs more thoroughly I think I don't need the MQ Client. In fact, we removed it from the windows client to no ill effect)I find it odd that the exception is saying that it wants to connect to localhost. The server error files show nothing interesting.****Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9213****\n\n\norg.springframework.jms.listener.DefaultMessageListenerContainer]\nDec 05 15:22:26 DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Could not establish shared JMS Connection - leaving it up to asynchronous invokers to establish a Connection as soon as possible\ncom.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'QMTST' with connection mode 'Client' and host name 'localhost(1414)'.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:479) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:221) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:426) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6902) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6390) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:285) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6233) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:120) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:203) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]\n at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]\n at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198) ~[spring-aop-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at $Proxy8.createConnection(Unknown Source) ~[na:na]\n at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184) ~[spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:405) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.jms.listener.AbstractJmsListeningContainer.establishSharedConnection(AbstractJmsListeningContainer.java:373) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.jms.listener.DefaultMessageListenerContainer.establishSharedConnection(DefaultMessageListenerContainer.java:760) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:280) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:265) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.jms.listener.DefaultMessageListenerContainer.start(DefaultMessageListenerContainer.java:561) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]\n at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:167) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:339) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:143) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:108) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:945) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [spring-web-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.4.RELEASE.jar:3.2.4.RELEASE]\n at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) [catalina.jar:7.0.29]\n at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) [catalina.jar:7.0.29]\n at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.29]\n at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.29]\n at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.29]\n at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) [catalina.jar:7.0.29]\n at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963) [catalina.jar:7.0.29]\n at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600) [catalina.jar:7.0.29]\n at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_24]\n at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_24]\n at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_24]\n at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_24]\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_24]\n at java.lang.Thread.run(Thread.java:662) [na:1.6.0_24]\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n ... 45 common frames omitted\n**Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9213**: A communications error for occurred. [1=java.net.ConnectException[Connection refused],3=localhost]],3=localhost(1414),5=RemoteTCPConnection.connnectUsingLocalAddress]\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2053) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1226) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:311) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:337) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:346) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n ... 44 common frames omitted\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9213: A communications error for occurred. [1=java.net.ConnectException[Connection refused],3=localhost]\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:810) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1140) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:724) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:400) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:299) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:164) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1598) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n ... 48 common frames omitted\nCaused by: java.net.ConnectException: Connection refused\n at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.6.0_24]\n at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) ~[na:1.6.0_24]\n at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) ~[na:1.6.0_24]\n at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) ~[na:1.6.0_24]\n at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) ~[na:1.6.0_24]\n at java.net.Socket.connect(Socket.java:529) ~[na:1.6.0_24]\n at java.net.Socket.connect(Socket.java:478) ~[na:1.6.0_24]\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$5.run(RemoteTCPConnection.java:795) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$5.run(RemoteTCPConnection.java:789) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]\n at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_24]\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:787) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]### Assistant: We found out that it's picking up localhost from the MQ file based JNDI bindings file. It looks like a hack but we just change localhost in the .bindings file to the IP of the MQ server and then things work.It never looks at the Tomcat context.xml file once it has found a QMGR matching name in the .bindings file.\n"}
+{"text": "### Human: I was wondering if there is a way for you to configure a queue to automatically clear messages? We are striving to partially implement a component of our architecture and want to be able to send to the queue, but have the queue automatically remove the messages that are being sent so that we don't have to run scripts, etc to perform the clean-up.So far the only thing I have been able to find is to run CLEAR QLOCAL or set the messages to expire from the publishing application.### Assistant: For you use case there are a few options in IBM MQ:Create a QALIAS that points to a TOPIC object which has a topic string with no subscribers, messages put to the QA will just disappear.Have the sending application set message expiry.Use the IBM MQCAPEXPRYfeature to administratively force message expiry at the queue level.Run a script to issueCLEAR QLOCALagainst the queue. There can not be open handles on the queue for this to work.Programmatically issue the equivalent PCF command toCLEAR QLOCALagainst the queue. There cannot be open handles on the queue for this to work.Run the IBM MQdmpmqmsgutility against the queue to read and discard the messages.\n"}
+{"text": "### Human: I use a Java client usingJMS/JNDI. The connection is working when using one-way SSL authenticationSSLCAUTH(OPTIONAL). The first step I did is to export the public certificate of the client:keytool -export -keystore keystore -storepass storepass -alias CLIENT -file client.cerThen I added this certificate to the MQ key repository.gsk7cmd -cert -add -db keydb.kdb -pw password -label ibmwebspheremqclient -file client.cer -format binaryAnd I finally switched toSSLCAUTH(REQUIRED)mode.I get the following error log. The message is pretty clear, it can't find my client certificate. I read that my client certificate should have a labelibmwebspheremq. What is this user id since I am connecting via Java?AMQ9637: Channel is lacking a certificate.### Assistant: As per the TechnoteSpecifying the userid in the SSL certificate label for an MQ clientthe Java and JMS clients do not find their certificate based on the label.What is often the problem is a mis-match between the trust store and the key store. I have seen two problems fairly commonly.The application specifies a trust store but not a keystore. This works great for anonymous (one-way) SSL but not for mutual authenticated SSL. The appmustspecify both key store and trust store for mutual auth.Sometimes the app specifies a trust store file but the private certs are in the key store. Or the app specifies the same file for both trust store and the key store and the personal certs are actually in a separate trust store file.Does either of these solve the problem? If not, please update the question with akeytool -cert -listfor both the key store and the trust store and the part of the command line or code that sets up the keystore/truststore.\n"}
+{"text": "### Human: We come across a scenario where disk space was occupied for empty queues in linux environment.Our queue manager ended unexpectedly as the file system become full and we need to empty the q file to bring back the queue manager.But actually we dont have any messages at all in queue. This is showing a particularl queue.Why the disk space is held here? what is the root cause?### Assistant: WMQ does not shrink the queue files in real time. For example, you have 100 messages on a queue and you consume the first one. WMQ does not then shrink the file and move all the messages up by one position. If it tried to do that for each message, you'd never be able to get the throughput that you currently see in the product.What does occur is that WMQ will shrink the queue files at certain points in the processing lifecycle. There is some latency between a queue becoming empty and the file under it shrinking it but this latency is normally so small as to be unnoticeable.The event you are describing could in theory occur under some very specific conditions however it would be an extremely rare. In fact in the 15 years I've been working with WMQ I've only ever seen a couple of instances where the latency in shrinking a queue file was even noticeable. I would guess that what is actually going on here is that one of your assumptions or observations is faulty. For example:Was the queue actually empty?The queue was most definitely emptyafteryou blew away the file. How do you know it was emptybeforeyou blew away the file?If there were non-persistent messages on any queue, the queue will be empty after the QMgr restarts. This is another case where the queue can appear to be empty after the QMgr is restarted but was not at the time of failure.If a message is retrieved from a queue under syncpoint, the queue depth decrements but the message is still active in the queue file. If a queue is emptied in a single transaction it retains it's full depth until the COMMIT occurs. This can make it look like the queue is empty when it is not.Was it actually the queue file that filled up the file system?Log extents can fill the file system, even with circular logs. For example, with a large value for secondary extents log files can expand significantly and then disappear just as quickly.FDC files can fill up the file system, depending on how the allocations were made.Was it even MQ?If the QMgr shares filesystem space with other users or apps, transient files can fill up the space.One of the issues that we see very frequently is that an application will try to put more than 5,000 messages on a queue and receive a QFULL error. The very first thing most people then do is set MAXDEPTH(999999999) to make sure this NEVER happens again. The problem with this is that QFULL is a soft error from which an application can recover but filling up the filesystem is a hard error which can bring down the entire QMgr. Setting MAXDEPTH(999999999) trades a manageable soft error for a fatal error. It is the responsibility of the MQ administrator to make sure that MAXDEPTH and MAXMSGL on the queues are set such that the underlying filesystem does not fill. In most shops additional monitoring is in place on all the filesystems to raise alerts well before they fill.So to sum up, WMQ does a very good job of shrinking queue files in most cases. In particular, when a queue empties this is a natural point of synchronization at which the file can be shrunk and this usually occurs within seconds of the queue emptying. You have either hit a rare race condition in which the file was not shrunk fast enough or there is something else going on here that is not readily apparent in your initial analysis. In any case, manage MAXDEPTH and MAXMSGL such that no queue can fill up the filesystem and write the code to handle QFULL conditions.\n"}
+{"text": "### Human: When a message fails to post to a WebSphere MQ queue with MQRC 2056 MQRC_Q_SPACE_NOT_AVAILABLE it goes to Dead Letter queue. It means the Original disk space we allotted for queues usage is 100%. Say file system /var/mqm has sufficient free queue storage. Even we have our dead letter queue storage also in same /var/mqm. If we already get MQRC 2056 - MQRC_Q_SPACE_NOT_AVAILABLE, then how is it possible that a message will go to the Dead Letter queue when its disk space is already full?### Assistant: In your case theMQRC_Q_SPACE_NOT_AVAILABLEdoes in fact reflect the total amount of space in the disk partition, however this is not true in all cases. For example, with older filesystems the largest file size possible was 2GB, even though the partition could hold up to about 1TB. So if a single queue file reaches 2GB the QMgr may still have plenty of space in the partition available to requeue a message to the DLQ. Although newer file systems have eliminated the 2GB file limit, WebSphere MQ does still support many file systems which have this 2GB-per-file restriction. On platforms were this restriction is not present (or in any case when the entire partition runs out of space, regardless of platform) the behavior does no harm. On those platforms where the requeue is likely to be successful, the behavior you have observed is appropriate and even desirable.So there is a difference between exhausting space for a single queue file versus exhausting all the file space in the partition. WebSphere MQ could inquire on aspects of the file system to determine in detail which case caused the error but that would add complexity to the code. What is simple and fast is to attempt a requeue when the operating system returns an out-of-space error. If the partition has space available, the requeue works. If not, then the app is no worse off than it was before the requeue attempt.\n"}
+{"text": "### Human: Hi\nI have two Message Driven Beans (MDBs) running on Websphere Application Server v7.\nIt is connecting to, and receiving messages from Websphere MQ v6.\nOn the Queue Manager, we notice that the number of open channel connections keeps on growing, and appears as though the MDBs are not releasing these connections.\nI am not aware of any errors happening in the onMessage method of the MDBs which could cause it to not exit cleanly.Any advise on what could be causing this would be greatly appreciated\nThanks\nGavin### Assistant: There is a known issue with WAS v7 connecting to WMQ V6 where MDBs do not reconnect. The APAR mentions failures after a WMQ outage but other types of failure can result in similar behavior.In general, the advice is to move to WMQ v7 since WMQ V6 is out of service as of September 2011. The fix was released in v7.0.1.1 and later. No v6 fix pack is listed for delivery of this APAR, although it doesn't mention why. So if you cannot upgrade to v7.0.1.1 or later, then obtain via a PMR and apply IC64098 and see if that solves the problem.References:PSP #1316899:Information about using the WebSphere MQ messaging provider for WebSphere Application Server Version 7.0IBM IC64098: APPLICATION DOES NOT AUTOMATICALLY RECONNECT TO THE QUEUE MANAGER IF CONNECTION IS LOST WHEN USING THE MQ RESOURCE ADAPTER\n"}
+{"text": "### Human: I have a application that is trying to put a message to a queue(LOG.TRANSACTION.IN) on a remote queue manager. The message ends up failing with a 2035 and is put on the DLQ on the local queue manager. On the local queue manager(QMLOCAL), the application puts the message directly on the SCTQ, since there is no remote queue definition. The application is running under an ID that has full access to MQ. I know that is not ideal, but that is for another discussion. We have an mcauser on the clusrcvr channel on the remote end(QMREMOTE) that has been granted access to the local queue. I thought I had the security worked out, but it appears that is not the case. Here is the security informationQMLOCAL:Entity application_id has the following authorizations for object SYSTEM.CLUSTER.TRANSMIT.QUEUE: \n get \n browse \n put \n inq \n set \n crt \n dlt \n chg \n dsp \n passid \n passall \n setid \n setall \n clrQMREMOTE:Entity MY_MCAUSER has the following authorizations for object LOG.TRANSACTION.IN: \n put \n crt \n setallAny help on this would be greatly appreciated.### Assistant: There are a few possibilities here. Since the message ends up in the DLQ then we know that the problem is on the remote side. If your putting application generated the 2035 then the message would never be put.This means that the MCAUSER in the CLUSRCVR channel is where the problem is. In order for it to work, it needs to have the following (Assume MY_MCAUSER is in group mqmmca):setmqaut -m QMREMOTE -g mqmmca -t qmgr -all +connect +inq +setallsetmqaut -m QMREMOTE -g mqmmca -n 'LOG.TRANSACTION.IN' -t queue -all +put +setallUnrelated to your 2035, the channel also needssetmqaut -m QMREMOTE -g mqmmca -n 'SYSTEM.CLUSTER.COMMAND.QUEUE' -t queue -all +put +setalljust to function in the cluster. Depending on your version, the channel MCAUSER might also need access toSYSTEM.CHANNEL.SYNCQ(v7 variants).An easy way to tell for sure is to enable authorization events.ALTER QMGR AUTHOREV(ENABLED)The authorization events tell you the ID that failed, the object it failed on (QMgr, queue, etc.), the API call being made and the options that were used.Then installSupportPac MS0Pinto WMQ Explorer. This will format the binary PCF event messages into human-readable form and it will be really obvious what exactly the problem is.In this case it is likely that either a) the MCAUSER lacks +setall on the QMgr or b) it's a v7 and the MCAUSER lacks the appropriate permission on the S.C.SQ as noted above.\n"}
+{"text": "### Human: I am in the process of exploring integration between SSIS and IBM MQ Series. Can some point me to some artical for integration.### Assistant: You might be able to use the \"Message Queue Task\" in conjunction with some other host bridge. Here's what I found while trolling the Internet:SSIS does not support loading into/from IBM MQ Series directly out of the box. ETI is the only known Microsoft partner or other 3rd party that can handle reading and writing to IBM MQ Series. This is handled via native sequential (MQSeries Queue Message)through their Built-to-Order connectivity process. SSIS customers also have the below ways of integrating their solutions with IBM MQ Series:1.Microsoft\u2019s MSMQ-MQ Series Bridge that comes with Host Integration Server. MSMQ Task in Control Flow in SSIS can be used along with the bridge, which provides connectionless, store-and-forward messaging across messaging systems and computing platforms throughout the network.2.Using BizTalk\u2019s MQ Series Adapter to push/pull messages into/out of SSIS Data Flow Engine via various exchange mechanisms : in-memory: script component, or staging : exchanging messages via the file system or directly writing it into SQL Server tables and use a data source component to read them.3.Using the extensibility story in SSIS: build an MQ Series source/destination custom/script component directly interfacing with MQ Series native libraries.You can find the original websitehere.Here's a description of the \"Message Queue Task\" that I came across in a PDF comparing how SSIS and Informatica handle messaging.SSIS includes a Microsoft Message Queue (MSMQ) connection manager that enables\nconnectivity to MSMQ message queues. Coupled with this is a bidirectional Message Queue\ntask that enables an SSIS package to push messages onto and pop messages off a message\nqueue. The messages can be in the form of text, files or the contents of SSIS variables.\nSQL Server Service Broker which is included with SQL Server 2005 (and therefore with SSIS)\nadds asynchronous messaging functionality to database applications. Service Broker queues\naccessible from any application able to issue T-SQL code which includes SSIS.\n"}
+{"text": "### Human: I'm queuing messages to a WebSphere MQ queue (NB: A point-to-point queue -- not a topic) using a stored procedure in my Oracle database. Is there a way to publish each message to multiple queues with a single call? What I would like is to find a solution that would incur zero additional latency on my database compared to sending the message to a single queue.Solutions that involve changing my WebSphere MQ settings are certainly welcome! What I had in mind was somehow creating a \"clone\" queue that got all the same messages as the original one, but I've been unable to locate anything like this in the documentation.Thanks,\nJeff### Assistant: With WMQ v7 you can do this easily and with administration only. You would create a topic object and then an alias over the topic. The Oracle app writes to the alias and does not know that it is actually publishing.Meanwhile, you make two administrative subscriptions on the topic so that publications are delivered to your two destination queues. The apps consuming them have no idea that the messages were published as opposed to delivered through point-to-point queues.If you are not familiar with the new WMQ v7 features, take a look at theInfocenter. In particular, the \"What's New in V7\" section and the sections on Pub/Sub.\n"}
+{"text": "### Human: How can I make the queue manager (which exists by default in the docker image) accept any connection without authentication?I went through all the options in the web console (:9443/ibmmq/console/) and tried anything that I thought might have the effect I wanted, but couldn't find it.TIA & BR,\nChristianEdit: here's the code I'm using to connectJmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\nJmsConnectionFactory cf = ff.createConnectionFactory();\n\n// Set the properties\n\ncf.setStringProperty(WMQConstants.WMQ_HOST_NAME, HOST);\ncf.setIntProperty(WMQConstants.WMQ_PORT, PORT);\ncf.setStringProperty(WMQConstants.WMQ_CHANNEL, CHANNEL);\ncf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\ncf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, QMGR);\ncf.setStringProperty(WMQConstants.WMQ_APPLICATIONNAME, \"JmsPutGet (JMS)\");\n//cf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true);\n//cf.setStringProperty(WMQConstants.USERID, APP_USER);\n//cf.setStringProperty(WMQConstants.PASSWORD, APP_PASSWORD);\n\n// Create JMS objects\ncontext = cf.createContext();----------edit------------Error log afterremoving \"connection authentication\" for the QMsetting the channel auth. record (under extended) to \"As Queue Manager\"AMQ9557E: Queue Manager User ID initialization failed for '[my OS user]'. \nEXPLANATION:\nThe call to initialize the User ID '[my OS user]' failed with CompCode 2 and\nReason 2035. If an MQCSP block was used, the User ID in the MQCSP block was ''.\nACTION:\nCorrect the error and try again.### Assistant: If you are trying to disable the MQ Connection Authentication feature so that userid & passwords are not authenticated then you can do this by executing the following MQSC commands in runmqsc against the Queue Manager.ALTER QMGR CONNAUTH(' ')\nREFRESH SECURITY(*) TYPE(CONAUTH)Alternatively in the MQ web Console:Select your queue manager in the Queue Manager widgetClick propertiesGo to the Extended section and scroll downSet the \"Connection Authentication\" attribute to a blank valueClick save adn then closeSelect your queue manager in the Queue Manager widgitClick the...and select Refresh security from the drop down\"Select connection authentication\"Add widget: \"Channel authentication records\"In this widget, select the entry for your channel, click properties under \"Extended\" set client connections to \"As Queue Manager\"If required:Select your QM in the \"Queue Manager\" widget, open properties (...), \"refresh security...\", \"Connection authentication\". \nMake sure the default user name (in the standard docker installation, that's \"app\") is set in the channel properties under MCA (as sugg. by @JoshMc)\n"}
+{"text": "### Human: I'm experiencing an odd behavior when running basic connectivity tests from my workstation to a remote MQ Server.I am using amqssslc.exe to connect from a command prompt.If I connect with nothing but a certificate store, it connects without issue, and returns a result indicating that it connected to the default queue manager, FOO:C:\\Program Files\\IBM\\MQ\\Tools\\c\\Samples\\Bin64>amqssslc.exe -k c:\\mycerts\\cert\n\nSample AMQSSSLC start\nConnecting to the default queue manager\nNo client connection information specified.\nUsing SSL key repository stem c:\\mycerts\\cert\nNo OCSP configuration specified.\nConnection established to queue manager FOO\nSample AMQSSSLC endIf I attempt to connect to the queue manager FOO, however, it returns a 2058 error, which typically indicates a queue manager name error.C:\\Program Files\\IBM\\MQ\\Tools\\c\\Samples\\Bin64>amqssslc.exe -k c:\\mycerts\\cert -m FOO\n\nSample AMQSSSLC start\nConnecting to queue manager FOO\nNo client connection information specified.\nUsing SSL key repository stem c:\\mycerts\\cert\nNo OCSP configuration specified.\nMQCONNX ended with reason code 2058It does this even if I copy the name directly from the result. It fails quickly, and doesn't generate a log entry in my AMQERR01.LOG file.Does this behavior indicate an issue with my CCDT file?Update:Per @JoshMc's suggestion, I ran the following command to get information about the vendor-supplied CCDT file:echo DIS CHL(*) QMNAME CONNAME|runmqsc -nThe results indicated that no queue manager was specified in the file:C:\\Program Files\\IBM\\MQ\\Tools\\c\\Samples\\Bin64>echo DIS CHL(*) QMNAME CONNAME|runmqsc -n\n5724-H72 (C) Copyright IBM Corp. 1994, 2016.\nStarting local MQSC for 'MYQUEUE.TAB'.\n 1 : DIS CHL(*) QMNAME CONNAME\nAMQ8414: Display Channel details.\n CHANNEL(FOOCHANNEL) CHLTYPE(CLNTCONN)\n CONNAME(CONNAME(xxx.xxx.xxx.xxx(1414),xxx.xxx.xxx.xxx(1414))\n QMNAME( )\n\nNo commands have a syntax error.### Assistant: If you review the source code located atC:\\Program Files\\IBM\\MQ\\Tools\\c\\Samples\\Bin64\\amqssslc.cyou can see that it does the following:If no queue manager name is specified it will set the queue manager name toNULLand printConnecting to the default queue managerIf no connection name is specified it will not setup theClientConn, andConnectOptions.ClientConnPtris left at it's defaultNULLvalue, it will printNo client connection information specified.If a SSL key repository stem is specified it will set theSslConnOptions.KeyRepositoryto this value and print outUsing SSL key repository stem and then pointConnectOptions.SSLConfigPtrto theSslConnOptions.After all of this it then issues aMQCONNXand specifies the theNULLqueue manager name and theConnectOptions. Because theConnectOptions.ClientConnPtris left at the defaultNULLvalue MQ will attempt to find the out how to connect to the queue manager via a few different other means. The order and where it looks for connection information is documented at the IBM v7.5 (or later) Knowledge Center page \"Connecting IBM WebSphere MQ MQI client applications to queue managers\". In your case it is picking up the CCDT file.When you do not specify a queue manager name it looks for a entry in the CCDT with a blankQMNAMEattribute and finds theCLNTCONNchannel that you have defined whereQMNAMEis blank. A blankQMNAMEon aCLNTCONNchannel is a special case where the MQ client will connect to any queue manager name which is listening atCONNAMEthat you specify. Because you are specifying the SSL key repository stem it will use this key repository to connect to MQ with theSSLCIPHyou have specified onCLNTCONNin the CCDT.When youdospecify the queue manager nameFOO, it attempts to find a entry in the CCDT with theQMNAMEattribute set toFOO, in your case it does not exist so you receive the2058orMQRC_Q_MGR_NAME_ERRORerror.Based on your update the CCDT channel does have a blankQMNAMEattribute and theCONNAMElists two different IP(PORT) seperated by a common. With this configuration MQ will attempt first to connect to the first IP, if the connection times out or is ended for some other reason such as the channel on the queue manager being in STOPPED status, it will then attempt to connect to the second IP.It is very possible they intend for you to connect with a blank or NULL queue manager name due to the benefit that the client will connect to any queue manager name that is listening on the CONNAME, in you case the first IP(PORT) might be queue manager FOO and the second IP(PORT) might be queue manager BAR.If you want it to work with your CCDT when you specify-m FOOyou would need to either create a new CCDT with aCLNTCONNchannel withQMNAME(FOO), or add anotherCLNTCONNchannel to your existing CCDT withQMNAME(FOO), note you can not have duplicate channel names in a single CCDT.For more information on the CCDT and what queue manager name to specify see my answer to \"Connecting to IBM MQ using CCDT file in JMS\". The answer was related to JMS but the information applies to MQI clients as well.You also have the option to specify all the details on the command line like Roger said. Runamqssslc.exe ?for usage information, it should look like this:Sample AMQSSSLC start\nParameters: [-m QMgr]\n [-c ChlName -x ConnName]\n [-k KeyReposStem] [-s CipherSpec]\n [-p any|rfc5280]\n [-f] [-b none|128_bit|192_bit[,...] ]\n [-o OcspURL]\n"}
+{"text": "### Human: I have a REST service which receives some data and check the data through an ansynchronous IBM MQ request.REST controller:@RestController\n@RequestMapping(\"/request\")\npublic class RequestController {\n\n @RequestMapping(method = RequestMethod.POST)\n public Response postRequest(@RequestBody Request request) {\n\n String data = request.getData();\n\n jmsSender.send(data);\n\n // Now I need the response from MQ\n // String mqResponse = ...\n if (mqIsValid(mqResponse)) {\n return createValidResponse();\n }\n return createNotValidResponse();\n }\n}MQ sender:@Service\npublic class JmsSender {\n\n public void send(String data) {\n jmsTemplate.convertAndSend(\"QUEUE.TO.MQ\", data);\n }\n\n}MQ receiver:@Component\npublic class JmsReceiver {\n\n @JmsListener(destination = \"QUEUE.FROM.MQ, containerFactory = \"DefaultJmsListenerContainerFactory\")\n public void receiveMessage(String message) {\n // How to pass the message to the controller?\n }\n\n}How can I wait for the right data from MQ to create the correct response in the controller?Is it possible to use aBlockingQueuefor this like describedhere? In my case I have to distinguish the data. I can't just take the first data from the blocking queue.If for example there are two REST requests simultaneously (with data:abcandxyz). How can I make sure to response the right answer not just the first answer I get from MQ?I also can't change the MQ interface.### Assistant: Try using a CountDownLatch like below.@RestController\n@RequestMapping(\"/request\")\npublic class RequestController {\n\n @RequestMapping(method = RequestMethod.POST)\n public Response postRequest(@RequestBody Request request) {\n final CountDownLatch jmsLatch = new CountDownLatch (1);\n\n String data = request.getData();\n\n jmsSender.send(data, jmsLatch);\n\n try {\n latch.await(); // wait untill latch counted down to 0\n } catch (InterruptedException e) {\n return createNotValidResponse();\n }\n\n return createValidResponse();\n }\n}Modify the send method to get the CountDownLatch from controller.@Service\npublic class JmsSender {\n\n public void send(String data, final CountDownLatch jmsLatch) {\n jmsLatch.await();\n jmsTemplate.convertAndSend(\"QUEUE.TO.MQ\", data);\n }\n\n}Modify the receive method to get the same CountDownLatch from controller.@Component\npublic class JmsReceiver {\n\n @JmsListener(destination = \"QUEUE.FROM.MQ\", containerFactory = \"DefaultJmsListenerContainerFactory\")\n public void receiveMessage(String message, final CountDownLatch jmsLatch) {\n // Pass the message to the controller\n jmsLatch.countDown();\n }\n\n}The trick here is you have to spread the same CountDownLatch instance from controller to the sender and receiver class and call the countDown method after you receive the message.\n"}
+{"text": "### Human: I have been looking into the RubyWMQ gem trying to connect to a Websphere queue, but am having no luck. My ultimate goal is to connect to, read and put messages to the queue using Ruby. I have used the gem authors documentation and examplesherewith no luck as well. currently I have tried this:queue = WMQ::QueueManager.connect( \n :q_mgr_name => 'MYQUEUEMANAGERNAMEHERE',\n :exception_on_error => true,\n :trace_level => 2,\n # :connect_options => WMQ::MQCNO_FASTBATH_BINDING, # this errors\n :channel_name => 'MYQUEUEMANAGERNAMEHERE',\n :connection_name => 'localhost(1414)',\n :transport_type => WMQ::MQXPT_TCP,\n :user_identifier => 'MYUSERNAMEHERE',\n :password => 'MYPASSWORDHERE')I believe the first error I am receiving has to do with the Webshpere MQ client itself, or the install of the gem. i installed RubyWMQ using this command:gem install rubywmq --platform=ruby -- '--with-mqm-include=\"C:\\Program Files\\IBM\\WebSphereMQ\\tools\\c\\include\"'I am using IBM WebSphere MQ version 7.1.0.3, located in C:\\Program Files\\IBM\\WebSphere MQ...I get this error when running my code:WMQ::QueueManager#connect(). Failed to load MQ Library:mqic32, rc=126 (WMQ::WMQException)I can see the \"mqic32.dll\" file in C:\\Program Files\\IBM\\WebSphere MQ\\bin, so I am not sure exactly what the gem code is doing..### Assistant: Managed to fix this by addingC:\\Program Files\\IBM\\WebSphere MQ\\bin64to my user$Path.Which was odd, becausebinandbin64had both been added to the System$pathvariable by the IBM install.(This is with a mingw ruby install)\n"}
+{"text": "### Human: I'm trying to read off messages from a websphere mq queue and dump it in another queue.Below is the code i have to do itprivate void transferMessages()\n{\n MQQueueManager sqmgr = connectToQueueManager(S_SERVER_NAME, S_QMGR_NAME, S_PORT_NUMBER, S_CHANNEL_NAME);\n MQQueueManager dqmgr = connectToQueueManager(D_SERVER_NAME, D_QMGR_NAME, D_PORT_NUMBER, D_CHANNEL_NAME);\n if (sqmgr != null && dqmgr != null)\n {\n MQQueue sq = openSourceQueueToGet(sqmgr, S_QUEUE_NAME);\n MQQueue dq = openDestQueueToPut(dqmgr, D_QUEUE_NAME);\n if (sq != null && dq != null)\n {\n setPutMessageOptions();\n setGetMessageOptions();\n processMessages(sqmgr, sq, dqmgr, dq);\n }\n }\n}And I'm calling the above method in a for loop and creating separate threads as below.int NO_OF_THREADS = 5;\nThread[] ts = new Thread[NO_OF_THREADS];\nfor (int i = 0; i < NO_OF_THREADS; i++)\n{ \n ts[i] = new Thread(() => transferMessages());\n ts[i].Start(); \n}As you see, I'm making a fresh connection to the queue manager in the transferMessages method. Not sure for some reason, the program makes only one connection to MQ.The custom method to connect to the queue manager is below..private MQQueueManager connectToQueueManager(string MQServerName, string MQQueueManagerName, string MQPortNumber, string MQChannel)\n {\n try\n {\n mqErrorString = \"\";\n MQQueueManager qmgr;\n Hashtable mqProps = new Hashtable();\n mqProps.Add(MQC.HOST_NAME_PROPERTY, MQServerName);\n mqProps.Add(MQC.CHANNEL_PROPERTY, MQChannel);\n mqProps.Add(MQC.PORT_PROPERTY, Convert.ToInt32(MQPortNumber));\n mqProps.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);\n qmgr = new MQQueueManager(MQQueueManagerName, mqProps);\n return qmgr;\n }\n catch (MQException mqex)\n {\n //catch and log MQException here\n return null;\n }\n }Any advise what am i missing?### Assistant: That is because ofShared Conversation(SHARECNV)feature of MQ where multiple connections to queue manager from one application share the same socket. This value is a negotiated between client and queue manager while establishing a connection. By default 10 connections will be shared over a socket.You can increase the number of threads in your application to 11, then you can see a second connection being opened. More details on SHARECNV arehere.UPDATEChannel status when running 6 threads each for put and get. Note I am connecting to the same queue manager (test purpose only). SHARECNV is set to 10.2 : dis chstatus(MY.SVRCONN)\nAMQ8417: Display Channel Status details.\n CHANNEL(MY.SVRCONN) CHLTYPE(SVRCONN)\n CONNAME(127.0.0.1) CURRENT\n STATUS(RUNNING) SUBSTATE(RECEIVE)\nAMQ8417: Display Channel Status details.\n CHANNEL(MY.SVRCONN) CHLTYPE(SVRCONN)\n CONNAME(127.0.0.1) CURRENT\n STATUS(RUNNING) SUBSTATE(RECEIVE)When running 5 threads each.3 : dis chstatus(MY.SVRCONN)\nAMQ8417: Display Channel Status details.\n CHANNEL(MY.SVRCONN) CHLTYPE(SVRCONN)\n CONNAME(127.0.0.1) CURRENT\n STATUS(RUNNING) SUBSTATE(RECEIVE)\n"}
+{"text": "### Human: I have configuredCachingConnectionFactorythat wraps aMQTopicConnectionFactoryandMQQueueConnectionFactorywith cache size set to 10 each.These are than used in severaljms:outbound-channel-adapter or jms:message-driven-channel-adapteras part of various spring integration workflows that I have in my application.It is noticed that once in a while the connection count on MQ channel reaches maximum allowed (about 1000) when the process stops functioning. This is a serious problem for a production application.Bringing the application down does not reduce the connection count so looks like orphaned connections on MQ side? I am not sure if I am missing anything in my spring jms / SI configuration that can resolve this issue, any help would be highly appreciated.Also I would like to log connection open and close from application but don't see a way to do that.\n//all that it needs host/port/ queue manager /channel\n\n\n \n \n \n\n\n\n\n//all that it needs host/port/ queue manager /channel\n\n\n\n \n \n\n\n//Qcf and tcf are than used in spring integration configuration as required### Assistant: You really need to show your configuration but the SpringCachingConnectionFactoryonly creates a single connection that's shared for all sessions. Turning onINFOlogging for the CCF category emits this log when a new connection is created...if (logger.isInfoEnabled()) {\n logger.info(\"Established shared JMS Connection: \" + this.target);\n}EDIT:There's nothing in your config that stands out. As I said, each CCF will have at most 1 connection open at a time.One possibility, if you have idle times, is that the network (a switch or firewall) might be silently dropping connections without telling the client or server. The next time the client tries to use its connection it will fail and create a new one but the server may never find out that the old one is dead.Typically, for such situations, enabling heartbeats or keepalives would keep the connection active (or at least allow the server to know it's dead).\n"}
+{"text": "### Human: currently I am working with mule and need to write in WMQ Queue. But instead of using WMQ endpoint, I want to do it by using JMS Endpoint. Here is my configuration:\n\n\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n #[flowVars['id']]\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \nI have successfully read message from WMQ Queue by using JMS endpoint. However, when I tried to write some message in WMQ Queue by using JMS Endpoint, I got following error from my server:2014-07-22 10:11:27,064 [Axis2 Task] ERROR WMQMsg - Expected MQ\n message format ' MQSTR ', but received 'MQHRF2 ' 2014-07-22\n 10:11:27,064 [Axis2 Task] WARN QMgrConnection - Moving msg into dead \n letter queue after 1 try/tries:\n 414D51206C6F63616C6D616E616765721A0CCE5320003C0 2 [Fatal Error] :1:1:\n Content ist nicht zul\u00f5ssig in Prolog. ERROR: 'Content ist nicht\n zul\u00f5ssig in Prolog.' 2014-07-22 10:11:27,064 [Axis2 Task] WARN ESBMsg\n - Error prettifying ESBMsg for log printingI know that this error occured because I tried to write into Non-JMS Queue. Also I know that I have to solve it by setting \"?targetClient=1\". However, when I tried to add the targetClient attribute into my Queue URL, I still got the error (it seems that the attribute was recognized as URL too by WMQ).Then, from my research, I found out that I can not directly set the \"?targetClient\" in the url. Instead of that, I need to create a Java Class to set the \"?targetClient\". To create those class, I follow some instructions from following URLCreate Custom JMSSupport ClassBut unfortunatelly, it also did not work for me. Anyone has an idea about how can I solve it? Thanks.NB: In Apache Camel, I can simply solve it by adding:\n queue:///LSMH.ZKSEAP.SERVICEBUS?targetClient=1 \nIs there something similar in Mule ESB?### Assistant: Just solved the problem:It is right that we need to create a java class to set the targetClient. And to do so, we can follow the link that I gave above. However, we will need to change the code a bit.\nHere is the right code:import javax.jms.Destination;\nimport javax.jms.JMSException;\nimport javax.jms.Session;\n\nimport org.mule.api.endpoint.ImmutableEndpoint;\nimport org.mule.transport.jms.Jms11Support;\nimport org.mule.transport.jms.JmsConnector;\n\nimport com.ibm.mq.jms.JMSC;\nimport com.ibm.mq.jms.MQQueue;\n\n/**\n* Implements WebSphere MQ specific JMS support for Mule. The class\n* overrides the createDestination method to intercept JMS Queue object\n* creation and sets the targetClient=1 property on created MQQueue\n* objects. This is necessary to prevent non-JMS consumers from being\n* choked by RFH2 headers.\n*/\npublic class CustomJms11Support extends Jms11Support {\n\n public CustomJms11Support(JmsConnector connector) {\n super(connector);\n }\n\n @Override\n public Destination createDestination(Session session, String name, boolean\n topic, ImmutableEndpoint ie) throws JMSException {\n Destination destination = super.createDestination(session, name, topic, ie);\n if (destination instanceof MQQueue){\n ((MQQueue) destination).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);\n }\n return destination;\n }\n}And then, we will need to set a property called \"JMS_IBM_Character_Set\" (If not we will get \"Expected MQ message characterSet '819', but received '1208'\" error) before send the request to JMS endpoint. Here is how I configure it:And just for your information, by changing the WMQ endpoint to JMS endpoint, for sure it improve the performance.Hopefully it would be useful :D\n"}
+{"text": "### Human: The Redbook documentation details out creating a.stofile usingamqmcert, but is it possible for a .NET MQ client to just use a certificate out of the Windows certificate store (system store, ie, MMC->Add/Remove Snap-In->Certificates->Computer Account)?### Assistant: Not with current versions of WebSphere MQ. As of V6.0, WMQ began using KDB files for certs rather than the Windows cert store. This provides a common set of tooling across all the distributed platforms supported by WebSphere MQ, as well as reducing the amount of platform-specific code. If you'd like to request that WMQ once again support the Windows cert store, please create a Request For Enhancement (or upvote one if it already exists) at theRFE Community.UPDATEThe Infocenter currently mentions some use of Windows Certificate Store with the XMS classes for .Net connecting to SIBus. This is incorrect and will be removed.\n"}
+{"text": "### Human: I have spring boot application which receive JSON requests and push it into IBM MQ JMS queue. There can be n number of JSON requests will be pushed to the queue. My Goal is to process each request from the queue. How can i listen to the queue and get the messages one by one to process using spring boot ?### Assistant: You need to implement listener as:1: Create configure following:@Bean\npublic MQConnectionFactory mqConnectionFactory(){\n MQConnectionFactory connectionFactory = new MQConnectionFactory();\n connectionFactory.setHostName(); //mq host name\n connectionFactory.setPort(); // mq port\n connectionFactory.setQueueManager(); //mq queue manager\n connectionFactory.setChannel(); //mq channel name\n connectionFactory.setTransportType(1);\n connectionFactory.setSSLCipherSuite(); //tls cipher suite name\n return connectionFactory;\n}\n\n\n@Bean()\npublic DefaultMessageListenerContainer myMessageEventContainer() {\n DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();\n container.setAutoStartup(true);\n container.setConnectionFactory(mqConnectionFactory);\n container.setDestinationName(//queue name//);\n container.setMessageListener(new MyEventListener());\n return container;\n}2: Implement message listener:public class MyEventListener implements MessageListener {\n\n @Override\n public void onMessage(Message message) {\n try {\n if (message instanceof TextMessage) {\n TextMessage textMessage = (TextMessage) message;\n String stringMessage = textMessage.getText();\n //do something with your message from queue\n }\n } catch (JMSException e) {\n //catch error\n }\n }\n}\n"}
+{"text": "### Human: Can somebody help to understand the basic of these 3 queues with example.when do we use all 3### Assistant: Perhaps a more simple explanation: Think of a local queue as a queue which exists on the queue manager it is defined.. you can PUT and GET messages off a local queue. A remote queue is like a pointer to a queue on another queue manager which is usually on different host. Therefore messages can be PUT to it (and they will usually arrive on a local queue at that remote host) but you cannot GET messages from a remote queue.\n"}
+{"text": "### Human: which is proven solution to connect mainframe and java? Which is best in WebSphere MQ / IBM CICS Transaction Gateway?Which is best solution to connect to java and mainframe COBOL?### Assistant: Presuming that by \"Java\" you mean \"Java not running on the mainframe,\" there are multiple ways to do this.CICS Web Services (SOAP)CICS Web Support (REST/POX)MQSeries with a triggered queue\"Best\" is in the eye of the beholder, it depends on what you want. None of these are new, the capability has been available for several years.For option 1, the CICS Web Services Assistant will generate WSDL from COBOL existing language structures. If you decide you don't like what it generates you can write your own WSDL and generate COBOL language structures from that. The Java program would use your favorite SOAP (or MQ) infrastructure to communicate with the CICS/COBOL program.For option 2, your CICS/COBOL program would have to be coded to be \"web aware.\" The CICS/COBOL program would have to use the WEB EXTRACT, WEB RECEIVE, and WEB SEND APIs to communicate with the Java program. The Java program would use HTTP(S) GET/POST processing to send/receive messages to the CICS/COBOL program.For option 3, your CICS/COBOL program would have to be coded to use MQGET and MQPUT to receive and send messages to the Java program. You want to have the queue defined with a backout queue name and a backout threshold, and check the latter against the backout count value. If the threshold is greater than the count, you want to move the message to the backout queue without attempting to process it in the CICS/COBOL program (it's a poison message). The java program would use JMS or whatever your favorite messaging wrapper package is to communicate with the CICS/COBOL program.\n"}
+{"text": "### Human: I've built a small Java program that uses the MQ client classes to talk to a Websphere MQ server and a queue thereon. What I want is to query the size, err depth, of a certain queue at regular intervals, e.g. every 10 seconds.What I do, schematically:qm = new MQQManager()q = qm.accessQueue()depth = q.getCurrentDepth()(do something withdepth)q.close()qm.close()This works like a charm!Out of laziness, I wrote my code to go through all 6 steps of the above sequence each time. So I ended up repeating this cycle every 10 seconds. Within about half an hour, the folks who monitor the server told me I had 153 instances open on it. Clearly, simply doingclose()on the queue and QM aren't sufficient to clean up after myself.I'm going to do the obvious fix and hold on to the QM and queue for the program's lifetime. But could somebody please tell me why my previous approach is leaking resources, and what I could do about it if I chose to follow that path?UPDATE (2017-01-25)TimingandAcceptanceRoger has provided some beautiful code and some useful explanations on the topics of performance and uncommitted messages. That's cool, but Eugene's answer was exactly (and minimally) sufficient to solve my problem, and he was a bit quicker. My little app is now doing exactly what I want after I simply changedclose()todisconnect()based on Eugene's advice. Now I'm a bit torn about who should get the checkmark. My apologies to both of you!I got exactly what I wanted and I think I'm done with this question but I should add that I appreciate Roger's thoughtful answer for the useful information it provides to any possible future other reader of this question. Hopefully other people will listen to him rather than follow my lead.PerformanceTo be honest, I don't give a damn about performance. The server is much fatter than needed for what it's currently doing, and my monitoring client (the topic of this question) runs on a development machine that's usually empty. I hope it will have served its purpose within a day or two, then I'll throw it away. In the meantime, if one connect every 10s causes a performance problem, they should load balance to a Raspberry Pi or something.Uncommitted messagesI think this is a non-problem as well. The sending application enqueues in small batches of about 1-5 messages within a few milliseconds and immediately commits. The receiving application (a client I wrote, and it may well have problems) continuously listens on the queue, receives and acknowledges (commits) each message individually. So I'm reasonably sure there will never be more than 1, possibly 5 unacknowledged messages. This number is insignificant compared to the parameters of...myactualproblem,which involves a handful to a few hundred messages suffering processing delays between 5 and 20 minutes at about the same time every morning. I suspect my receiving client is being stalled by a \"hanging\" network IO operation with something other than the MQS. One step I want to take in exploring this is to demonstrate that there is indeed a queue of waiting messages on the MQS, and it's not being picked up. I'd like to see when that queue starts to build up, how long it sits there and how quickly it subsides once my client wakes up again.This connection sees between 2,000 and 10,000 messages a day with peaks corresponding to batch processes in the afternoon and evening, but the delays are happening only in the morning, often with pretty small volumes actually coming through. I'd like to see a log of queue sizes to get a better idea of what's going on. As a next step, I'll probably need to do more instrumentation in my receiving client.EnvironmentFor what it's worth, the server is running WSMQ 6, so my client uses blocking-and-waiting queue gets rather than the spiffy asynchronous notification process I would have preferred to use. My receiving client is a standalone C app running under RHEL in a VM.### Assistant: Wow! Not very efficient code. The connect is by FAR the most expensive MQ API call. Also, getting the queue depth is meaningless. It gives you ALL uncommitted and committed messages in the queue. i.e. queue depth may say there is 5 messages in the queue but your program may only retrieve 3!! You would say MQ is broken but in reality, 2 messages are uncommitted, hence, unavailable for the consumer.If you really want to get and log the information every 10 seconds then STAY connected.Here's a better way of doing it:boolean working = true;\nint openOptions = CMQC.MQOO_INQUIRE + CMQC.MQOO_FAIL_IF_QUIESCING;\nint depth = 0;\nMQQueueManager qm = null;\nMQQueue q = null;\n\ntry\n{\n qm = new MQQueueManager(\"MQA1\");\n\n while (working)\n {\n try\n {\n q = qm.accessQueue(\"TEST.Q1\", openOptions);\n depth = q.getCurrentDepth();\n// (do something with depth)\n }\n catch (MQException e)\n {\n System.out.println(\"CC = \" + e.completionCode + \" : RC=\" + e.reasonCode);\n System.out.println(e.getLocalizedMessage() );\n working = false;\n }\n finally\n {\n if (q != null)\n {\n q.close();\n q = null;\n }\n }\n\n try\n {\n if (working)\n Thread.sleep(10*1000); // time in milliseconds\n }\n catch (InterruptedException ie) {}\n }\n}\ncatch (MQException e)\n{\n System.out.println(\"CC = \" + e.completionCode + \" : RC=\" + e.reasonCode);\n System.out.println(e.getLocalizedMessage() );\n}\nfinally\n{\n try\n {\n if (q != null)\n q.close();\n }\n catch (MQException e)\n {\n System.out.println(\"CC = \" + e.completionCode + \" : RC=\" + e.reasonCode);\n System.out.println(e.getLocalizedMessage() );\n }\n\n try\n {\n if (qm != null)\n qm.disconnect();\n }\n catch (MQException e)\n {\n System.out.println(\"CC = \" + e.completionCode + \" : RC=\" + e.reasonCode);\n System.out.println(e.getLocalizedMessage() );\n }\n}\n"}
+{"text": "### Human: For tests of JMS in WebSphere I have downloaded the developer version of WebSphere AS 8.0.Is WebSphere MQ (which is available as a separate product from IBM) already included in this version, or does WAS use a different JMS provider?Update: I know that in the (Apache Geronimo based) IBM WASCE (the 'community edition'), Apache ActiveMQ is used as the default JMS provider.Which product is used in WAS 8.0 / 8.5, a proprietary IBM product or an open source product like ActiveMQ as suggested in the answer below?### Assistant: WebSphere Application Server comes with a JMS provider calledService Integration Bus (SIBus). This is also know as the default messaging provider of WebSphere Application Provider and is Java EE compliant messaging engine. It has features like1) Clustering2) Supports both P2P and Pub/Sub style of messaging.3) High Availability4) Security5) And can integrate with WebSphere MQ.\n"}
+{"text": "### Human: I'm very beginner ofWebsphere MQ classes for Javaprogramming.I've decided to follow this way to write a small application able to connect and read messages from a queue through TCP/IP.following this guide:http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.csqzaw.doc%2Fja10410_.htmAt point 4 it is suggested to testWebsphere Clientinstallation (Version: 7.0.1.8) on windows command prompt using:java -Djava.library.path=library_path MQIVPwhere 'library_path' for me is \"C:\\Program Files\\IBM\\WebSphere MQ\\java\\lib\"The application runs and I have proceeded writing a simple program withEclipse IDEhere the code:import com.ibm.mq.MQEnvironment;\n\npublic class MQtestMain {\n\n public static void main(String[] args) {\n\n System.out.println(\"main\");\n\n new MQtestMain();\n }\n\n public MQtestMain(){\n\n System.out.println(\"MQtestMain\");\n\n MQEnvironment.hostname = \"my.host.name\";\n MQEnvironment.channel = \"my.channel\";\n MQEnvironment.port = 1414;\n\n }\n\n}It has nothing to do but it is just a test to be sure that everything is correctly set.I have set a custom library with both 'com.ibm.mq.jar' and 'com.ibm.mq.jmqi.jar' from \"C:\\Program Files\\IBM\\WebSphere MQ\\java\\lib\" and no error are reported at compile time.Running the application fromEclipseit correctly prints out \"main\" and \"MQtestMain\" on console.Therefore I have proceeded to export it: File > Export > Runnable Jarsetting 'Library handling' to 'Package required libraries into generated JAR'Unfortunately if I run the program from windows command prompt:java -jar MQtest.jarhere the result:main\nMQtestMain\nException in thread \"main\" java.lang.reflect.InvocationTargetException\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\n at java.lang.reflect.Method.invoke(Unknown Source)\n at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa\nder.java:58)\nCaused by: java.lang.NoClassDefFoundError: javax/resource/ResourceException\n at com.ibm.mq.MQEnvironment.(MQEnvironment.java:576)\n at MQtestMain.(MQtestMain.java:21)\n at MQtestMain.main(MQtestMain.java:14)\n ... 5 more\nCaused by: java.lang.ClassNotFoundException: javax.resource.ResourceException\n at java.net.URLClassLoader$1.run(Unknown Source)\n at java.net.URLClassLoader$1.run(Unknown Source)\n at java.security.AccessController.doPrivileged(Native Method)\n at java.net.URLClassLoader.findClass(Unknown Source)\n at java.lang.ClassLoader.loadClass(Unknown Source)\n at java.lang.ClassLoader.loadClass(Unknown Source)\n ... 8 moreFirst and second line are correct but I really don't understand the following errorsupdate:I try to give you more information:As I've said running the application from its mainclassfile there are no problems, while execute it from thejarfile it seems not able to find the IBM libraries.I have created a personal library ineclipsenamed \"MQ classes for Java\" containig the two jar packages used by this application.here the content of the project.classpathfile:\n\n \n \n \n \nIs there a way to link the correct libraries to the runnable jar in order to launch it form every machine with WMQ Client installed?Solution:The errors, due to some dependencies not found, have been solved includingalltheIBM classes for Javajarfiles into theWMQ Clientfolder instalation (\"C:\\Program Files\\IBM\\WebSphere MQ\\java\\lib\")### Assistant: I resolved this just by adding javax dependency:\n javax.resource\n connector-api\n 1.5\n\n"}
+{"text": "### Human: Is there a solution to make this docker imagehttps://hub.docker.com/r/ibmcom/mqrun on Apple M1 chips? For Intel chips, I was able to run this image by:docker run -e LICENSE=accept -e MQ_QMGR_NAME=QM1 -p 1414:1414 -p 9443:9443 ibmcom/mqIs there a custom build or an official IBM plan to create an Apple M1 compatible version of this image?### Assistant: This has already been requested from IBM, you can view and vote on ithere.\n"}
+{"text": "### Human: I have MQ server 7.1 running in machine1. I have a java app running in machine 2, that uses JMS to write messages to a queue in machine 1. The java app handles hundreds of messages per second (data coming from else where). Currently it takes about 100ms for 200 text messages (average size 600 bytes) or 2000 messages per second to write messages to the queue. Is this reasonable performance. What are some of the things that one can do to improve the performance further. i.e. faster?### Assistant: There are a number of detailed recommendations available in the WebSphere MQ Performance Reports. These are published as SupportPacs. If you start at theSupportPac landing page, the ones you want are all named MPxx and are available per-platform and per-version.As you will see from the SupportPacs, WMQ out of the box is tuned for a balance of speed and reliability across a wide variation of message sizes and types. There is considerable latitude for tuning through configuration and through design/architecture.From the configuration perspective, there are buffers for persistent and non-persistent messages, an option to reduce disk write integrity from triple-write to single-write, tuning of log file sizes and numbers, connection multiplexing, etc., etc. You may infer from this that the more the QMgr is tuned to specific traffic characteristics, the faster you can get it to go. The flip side of this is that a QMgr tuned that tightly will tend to react badly if a new type of traffic shows up that is outside the tuning specifications.I have also seen tremendous performance improvement allocating the WMQ filesystems to separate spindles. When a persistent message is written, it goes both to queue files and to log files. If both of those filesystems are in contention for the same disk read/write heads, this can degrade performance. This is why WMQ can sometimes run slower on a high-performance laptop than on a virtual machine or server of approximately the same size. If the laptop has physical spinning disk where the WMQ filesystems are both allocated and the server has SAN, there's no comparison.From a design standpoint, much performance can be gained from parallelism. The Performance reports show that adding more client connections significantly improves performance, up to a point where it then levels off and eventually begins to decline. Fortunately, the top number of clients before it falls off is VERY large and the web app server typically bogs down before WMQ does, just from the number of Java threads required.Another implementation detail that can make a big difference is the commit interval. If the app is such that many messages can be put or got at a time, doing so improves performance. A persistent message under syncpoint doesn't need to be flushed to disk until theCOMMIToccurs. Writing multiple messages in a single unit of work allows WMQ to return control to the program faster, buffer the writes and then optimize them much more efficiently than writing one message at a time.TheOf Mice and Elephantsarticle contains additional in-depth discussion of tuning options. It is part of the developerWorksMission:Messagingseries which contains some other articles which also touch on tuning.\n"}
+{"text": "### Human: I want to create a queue manager and a queue on the WebSphere MQ server and I want to do two things\n1) access the queue manager and the queue using WMQ Explorer from a client box\n2) write a Java stand-alone app that runs on the client box and puts and receives message from the queue.However I am getting authentication exceptions. Please let me know what I am doing wrong?Linux Server Box :I have WebSphere MQ v7.1 installedQueue managerQM_TESTcreated (crtmqm,strmqmcommands)Local queueQ_TESTcreated (runmqscand thedefine qlocal)SVRCONN channel defined (DEFINE CHANNEL (TEST_CHANNEL) CHLTYPE (SVRCONN) TRPTYPE (TCP))started a listener (runmqlsr -t tcp -m QM_TEST -p 1414)Linux Client Box :Tried to Show/Hide the queue manager using hostname, ip address, queue manager name and the channel name; However I get the following error:Access not permitted. You are not authorized to perform this operation. (AMQ4036)\nSeverity: 10 (Warning)\nExplanation: The queue manager security mechanism has indicated that the userid associated with this request is not authorized to access the object.Tried to access the queue manager and the queue using the java code, highlights given below:public void sendMail(Mail mail) { MQConnectionFactory cf = new\nMQQueueConnectionFactory(); Connection conn = null; try { //config\ncf.setHostName(\"hostname\"); cf.setPort(1414);\ncf.setQueueManager(\"QM_TEST\"); cf.setChannel(\"TEST_CHANNEL\");\ncf.setTransportType(WMQConstants.WMQ_CM_CLIENT);//WMQ_CM_DIRECT_TCPIP);\nWMQ_CM_CLIENT\n\nconn = cf.createConnection(); //fails hereHowever I get the following error:Error occurred :JMSWMQ2013: The security authentication was not valid\n that was supplied for QueueManager 'QM_TEST' with connection mode\n 'Client' and host name 'hostname(1414)'.Can you help? How do I pass the security authentication information? For now, it is OK if I can disable security as well. Just need to get this working?Let me know if I need to provide more information.UPDATE:I have created 'mq-user' linux user (mq-users group). CHLAUTH is enabled (default).\nAfter creating the queue manager QM_TEST (using sudo mqm) I have executed the following mqsc commands again using sudo mqm:DEFINE QLOCAL(TEST_QUEUE)\nSET AUTHREC PROFILE('TEST_QUEUE') OBJTYPE(QUEUE) PRINCIPAL('mq-user') AUTHADD(PUT,GET)\nSET AUTHREC OBJTYPE(QMGR) PRINCIPAL('mq-user') AUTHADD(CONNECT)\nDEFINE CHANNEL (TEST_CHANNEL) CHLTYPE (SVRCONN) TRPTYPE (TCP)\nSET CHLAUTH(TEST_CHANNEL) TYPE(ADDRESSMAP) ADDRESS('xxx.xx.xxx.*') MCAUSER('mq-user')\nDEFINE LISTENER (TEST_LISTENER) TRPTYPE (TCP) CONTROL (QMGR) PORT (1414)\nSTART LISTENER (TEST_LISTENER)I still get AMQ4036 access not permitted error. Mind you, I access the Queue Manager and Queue from a third remote machine (client machine) logged in as a third user. However I realize I can pass 'mq-user' credentials. I wish there was a clear step by step instructions somewhere, WebShere MQ 71. infocenter is not clear enough for me.What is still missing here?### Assistant: With v7.1 of WMQ the queue manager will by default not allow administrative connections. So if the ID that you are using ismqmor if it is in themqmgroup on the MQ server, it won't have access. The easy (read: NOT SECURE) way to address this is to delete the CHLAUTH record which contains the rule. IBM has published a TechNote about thishere.A longer-term and better solution is to keep the CHLAUTH record that disallows administrative access and instead connect using a different user ID. Of course, that ID will need to exist in the MQ server and be in a group that is authorized. For more on that topic, take a look at the slides and webinar recordinghere.When you are ready to turn security back on, you can find plenty of information on whatsetmqautcommands to use att-rob.netwhere I've archived the security presentations and labs from the IMPACT and European WSTC conferences.\n"}
+{"text": "### Human: In Websphere MQ series , command level for a queue manager is 701. What does it actually specify ?### Assistant: WebSphere products use a \"[version].[release].[modification].[Fix Pack]\" naming convention. For example 7.0.1.6 is the current release specified down to the Fix Pack level.Fix packs are limited to bug fixes and very limited non-disruptive functionality enhancements.Modifications can include functionality enhancements but no API changes. For example the Multi-Instance Queue Manager was introduced in 7.0.1.Releases may introduce significant new function and limited API changes but are highly forward and backward compatible withing the same version.Versions encapsulate a core set of functionality. Changes at this level may sacrifice some backward compatibility in trade for significant new functionality. For example, WMQ Pub/Sub was moved from Message Broker to base MQ in the V7 release.Since administrative functionality does not change in Fix Packs but may change at the Modification level, compatibility with administrative tools is based on the queue manager's Command Level.There is an old but stilluseful TechNotewhich described this when the numbering conventions were adopted for WMQ.\n"}
+{"text": "### Human: Trying to migrate from IBM WebSphere MQ V6 to V7.One of the line that we have is((com.ibm.mq.jms.MQQueue) queue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);JMSC.MQJMS_CLIENT_NONJMS_MQshows up as deprecated in V7.What is the proper replacement for the line? I looked around for a while, but couldn't find any info.### Assistant: Please see theWebSphere MQ Using Javamanual. In particular, look in theProperties of Objectssection and scroll down to Table 3. Next, find the entry in Table 3 forTARGCLIENT. In the far right column are the values for each of the setter methods. In this case, the values for thesetTargetClientmethod are:WMQConstants.WMQ_CLIENT_JMS_COMPLIANTWMQConstants.WMQ_CLIENT_NONJMS_MQIn the same manual, it is a good idea to review the installation and verification for the new version. Among other things, the classes have been repackaged and so the[CLASSPATH][3]requirements have changed.Since you are migrating from V6 to V7, another good reference is theWebSphere MQ Migrationmanual. In particular, please see the section entitledJava and JMS considerationsfor additional advice for migrating applications. Other sections in this manual will be helpful as well.Finally, it is worth mentioning that Fix Pack 7.0.1.5 has just been released and contains several Java/JMS related fixes. If you are running an earlier version of V7, it would be an extremely good idea to download and apply the maintenance. There are two ways to do this. First, the WMQ client download always has the latest version. You can always download it and install over top of a previous client. It is available as a free download atSupportPac MQC7. Alternatively, you can download the Fix Pack from theRecommended Fixespage. This is supplied as a platform-specific upgrade to the existing install, for example an EXE on Windows, an RPM for Linux, etc.\n"}
+{"text": "### Human: Many times I use 'mqsc' for create MQ queue manager from script files but I don't know how to generate script files.Thanks### Assistant: There is a SupportPac that installs a program called \"saveqmgr.exe\".Here's a link to the download of the Pac:http://shrinkster.com/17kcIBM seems to frequently reorganize its website, so the above link might not work if you check back here after a long while, but the SupportPac can be found easily by doing a search for \"saveqmgr\" on the Websphere MQ page. Hope this helps!IBM has this to say about the SupportPac:AbstractThis SupportPac (saveqmgr) saves all the objects, such\n as queues, channels, etc, defined in a\n either local or remote queue manager\n to a file.Download DescriptionThis SupportPac interrogates the attributes\n of all the objects defined to a queue\n manager (either local or remote) and\n saves them to a file.Possible UsesThe format of this file is suitable for use with runmqsc.\n It is therefore possible to use this\n SupportPac to save the definitions of\n objects known to a queue manager and\n subsequently recreate that queue\n manager.\n"}
+{"text": "### Human: We're trying to talk to a WebSphere MQSeries installation on the remote machine of an external organization. We don't have IBM WebSphere MQSeries ourselves.I've been looking at open source alternatives like Apache ServiceMix/Camel/ActiveMQ and also Oracle Database Gateway for WebSphere MQ (since we are using Oracle) but each solution requires both the client install provided as SupportPac MQC7 which is a free download plus the IBM jar com.ibm.mqjms.jarIs there a way to exchange messages with WebSphere MQSeries in production purely with non-Websphere MQSeries software?Thanks### Assistant: The latest WMQ client contains the jar files and all of the native WMQ diagnostics and tools. Also, note that the latest distributions include Extended Transactional Client without charge and include that functionality in the regular jar files. (In other words, no longer a separate ETClient.jar file.) The latest download is atSupportPac MQC75.Note that the download is an installer file and does not contain the jar files as a separate folder. The intention from IBM is for you to run the installer on each and every server where you will run WMQ client. Although this is a bit heavyweight versus just grabbing the jar files, the installer contains many diagnostic tools such asdspmqver, the native WMQ trace, themqrcprogram to tell you the meaning of return codes, the code samples, etc. With the full bundle installed, it is a lot easier for IBM to provide support. Considering that they provide support for a free component, requiring the full install seems reasonable to me.There are no other methods for communicating with a WebSphere MQ QMgr other than using the official WMQ client or another WMQ QMgr. Even though WMQ talks JMS, that's an API spec and not a protocol spec. It is necessary to use the Java JMS classes provided by the vendor of your chosen transport which, in this case, means using IBM's JMS classes. The same is true for running .Net code with WMQ. Gotta use IBM's classes.The one exception is that WebSphere App Server Messaging Engines can interoperate with WMQ. These are pure JMS messaging engines written in Java but they understand the WMQ formats and protocols and appear to WMQ as another QMgr. So if you have WAS you can talk to WMQ without a WMQ client or another QMgr.\n"}
+{"text": "### Human: I have an MQ application that I need to use SSL connections with. I have been given a keystore to use and a password to use it, but what I am unsure of is where I need to go to set the value of the keystore password?There are a few places in the MQ DLL's that I can see a password setting, but I don't want to set it in the wrong place. All of the other SSL stuff has been under the MQENVIRONMENT and there is a password there, but I can't seem to find anything that confirms this as the correct place.What is the value I need to set for my SSL keystore's password?(NOTE: I am writing this in C# using MQ version 7.)### Assistant: The .Net classes do not use a Java keystore, but rather they use the WMQ kdb format keystore. This file format includes a \"Stash file\" which contains an obfuscated password. Point your program to the kdb in the environment variables as discussedon this pageof the docs. The kdb is actually several files with the same prefix and different suffixes. What you see in the example is that the variable includes the path and the kdb prefix but no suffix.I'm guessing the next question is \"how do I get my jks into this kdb format?\" To do this you must have GSKit installed. It is bundled with both WMQ Client and WMQ Server but depending on the version installed, the path differs slightly. Look underC:\\Program Files\\IBM\\gsk7for starters. There are several different user interfaces but the one you want is the compiled gsk7cmd.C:\\Program Files\\IBM\\gsk7\\bin>gsk7cmd.exe -keydb -convert\n\nA required value for the command was not specified: \n-db Required \n\n-Correct command usage- \n-db Required \n-pw Optional \n-target Optional \n-new_pw Optional \n-old_format or -type Optional \n-new_format Required \n-expire Optional <0 - 7300> \n-stash Optional`When converting from jks to kdb, be sure to specify the -stash option so that the program can find the password.\n"}
+{"text": "### Human: When I callcom.ibm.mq.MQQueue#put(MQMessage,MQPutMessageOptions)it may hang. How can I set up a timeout for this method?\nThe same question is forcom.ibm.mq.MQQueue#get(MQMessage,MQGetMessageOptions)### Assistant: There is MQGMO_WAIT option and a WaitInterval that can be set to make the Get call to wait for a certain amount of time. For example, the following snippet makes the Get call to wait for 3 seconds.MQGetMessageOptions gmo = new MQGetMessageOptions();\n gmo.Options = MQConstants.MQGMO_WAIT;\n gmo.WaitInterval = 3000;\n\n mqQueue.Get(mqMessage, gmo);There is no option to set a timeout for the Put call though. The Put call returns with an error if there is any issue.UPDATE:When a Put call is invoked, connection to queue manager is already established. If there are any issues with the connection, the Put call gets returns soon as the TCP stack notifies of such issue. As such TCP level issues affect the all applications running on the system, in my opinion, tuning must be done at the system level and not at a per application level. Also I don't think it's possible to set a timeout for a socket.write call.MQ does provide a way set a timeout for establishing connection to queue manager though. There is connection_timeout parameter in mqclient.ini you can set a timeout.\n"}
+{"text": "### Human: I have installed MQ in my machine(have checked that with regedit32) But i get the error \"cannot recognise the command\" when i type \"runmqsc\" in command prompt (Environment variable is set for mqjms.jar ) What am i missing ? I want to create quemanagers and queue through command prompt in window### Assistant: What version of MQ are you using? (You can check by enteringdspmqverin the command prompt)To create a queue manager you should use the commandcrtmqm. For eaxmple if you'd like to create a queue manager using the default values and name it MyQueueManager, you should enter the following command:crtmqm MyQueueManagerIn any case I would recommend on creating queue managers through MQ Explorer, supposing you've installed it. It's much easier and fool proof.If you still want to work with the command prompt, after you've created your queue manager, type the following:runmqsc MyQueueManagerThis command will open the MQSC shell which you can use to create objects (such as queues) in your queue manager.To create a queue with default values named 'MyQueue' enter:DEFINE QLOCAL('MyQueue')\n"}
+{"text": "### Human: This is very basic question about IBM WebSphere MQ V7.Regarding the Transmission Queue, my understanding is it is only used with remote queue that resides in the same queue manager. Therefore, if I want to put message to the queue, I need to put it to remote queue.It is like this.App --> Remote queue --> Transmission QueueMy question is:Is it possible to put the message directly into transmission queue like this?App --> Transmission Queue--Modified on 2014.03.17 --I found a way to put message directly into transmission queue. I do not know this is a common use, but in order to do that I needed to prependMQXQHto the message. I tried and confirmed it works. See the Infocenter referencehere.### Assistant: Do not ever put directly to a transmission queue. It is dangerous if you do not know what you are doing.You should put your message to a remote queue. A remote queue is not the same as a local queue. A remote queue is simply a pointer to a queue on another queue manager.\n"}
+{"text": "### Human: I am new to Web Sphere MQ.I created a Queue Manager, Channel and Listener in AIX as follows:crtmqm MY_Q_MGR\n\nstrmqm MY_Q_MGR\n\nrunmqsc\n\nDEFINE LISTENER(MY_QM_LISTENER) TRPTYPE(TCP) PORT(5030)\n\nDEFINE CHANNEL(MY_QM_CHANNEL) CHLTYPE(SDR) CONNAME('10.128.1.51(5030)') XMITQ('MY_Q_MGR') DISCINT(0)Then I checked that QMGR is running. I saw listener in proc.Then, I tried to create MQQueueManager from java as follows and I gotMQJE001: Completion Code '2', Reason '2059'.import com.ibm.mq.MQException;\nimport com.ibm.mq.MQGetMessageOptions;\nimport com.ibm.mq.MQMessage;\nimport com.ibm.mq.MQPutMessageOptions;\nimport com.ibm.mq.MQQueue;\nimport com.ibm.mq.MQQueueManager;\nimport com.ibm.mq.constants.MQConstants;\nimport com.ibm.mq.MQEnvironment;\n\npublic class MQSample {\n\n // code identifier\n static final String sccsid = \"@(#) samples/wmqjava/MQSample.java, jmscc.samples, k700, k700-L080529 1.4.1.1 08/06/01 09:37:53\";\n\n // define the name of the QueueManager\n private static final String qManager = \"MY_Q_MGR\";\n\n // and define the name of the Queue\n private static final String qName = \"SYSTEM.DEFAULT.LOCAL.QUEUE\";\n\n /**\n * Main entry point\n * \n * @param args - command line arguments (ignored)\n */\n public static void main(String args[]) {\n try {\n MQEnvironment.hostname = \"MY IP ADDRESS\";\n MQEnvironment.channel = \"MY_QM_CHANNEL\";\n MQEnvironment.port = 5030;\n\n\n // Create a connection to the QueueManager\n System.out.println(\"Connecting to queue manager: \" + qManager);\n System.out.println(\"Connecting to queue manager is finished: \" + qManager);\n // Set up the options on the queue we wish to open\n int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;\n\n // Now specify the queue that we wish to open and the open options\n System.out.println(\"Accessing queue: \" + qName);\n MQQueue queue = qMgr.accessQueue(qName, openOptions);\n MQQueueManager qMgr = new MQQueueManager(qManager); // here i got error\n System.out.println(\"Connecting to queue manager is finished: \" + qManager);\n // Set up the options on the queue we wish to open\n int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;\n\n // Now specify the queue that we wish to open and the open options\n System.out.println(\"Accessing queue: \" + qName);\n MQQueue queue = qMgr.accessQueue(qName, openOptions);I am stuck here.### Assistant: You need a Sever connection (SVRCONN) type channel, notSDRtype. ASVRCONNtype channel is required for clients applications to connect to queue manager whereSDRtype channel is for communication between two queue managers.When a queue manager is created, a default SVRCONN channel,SYSTEM.DEF.SVRCONNis created. You can use this for your tests. But in production it's recommended to create your own channel and not use any predefined channels.Please see thislinkfor complete details what you need to do. This is from WebSphere MQ Quick Beginnings book.\n"}
+{"text": "### Human: The sender and receiver channels between two queue managers (WebSphere MQ v7.1 running on Redhat Linux) that I have configured is going down pretty frequently. Any idea why? How can I debug this? Thanks.### Assistant: Channels are expected to go down. The idea is that they stay active as long as there is traffic and then time out. Assuming they've been configured to trigger, the presence of a message on the XMitQ causes the channel to start up again.The reason for this is that a triggered channel will generally restart if interrupted by a network failure or other adverse event. However if a channel is configured to stay running 24x7 then the only way it stops is due to one of these adverse events and that increases the likelihood that human intervention will be required to restart the channel. On the other hand, a channel that times out can survive all sorts of nasty network events that occur while it is inactive. Allowing it to time out when not in use thus improves overall reliability of the channel.So how do you cause a channel to trigger? Make sure the transmission queue contains theTRIGGER,TRIGTYPE,TRIGDATAandINITQattributes. For example, to define a transmission queue to theJUPITERQMgr:DEF QL(JUPITER) +\n USAGE(XMITQ) +\n TRIGGER +\n TRIGTYPE(FIRST) +\n TRIGDATA('MYQMGR.JUPITER') +\n INITQ(SYSTEM.CHANNEL.INITQ) +\n REPLACEThe only variable of the bunch isTRIGDATAwhich contains the name of the channel serving this XMitQ.Of course, the channel initiator must be running but in modern versions of WMQ it starts by default (based on the value of the queue manager'sSCHINITattribute) so generallywillin fact be running.The channel that is inSTOPPEDstate cannot be triggered. By default theSTOP CHLcommand usesSTATUS(STOPPED)so most of the time manually stopping a channel prevents triggering. If you want to stop a channel in such a way that it will restart (for example to test triggering) use theSTOP CHL(CHLNAME) STATUS(INACTIVE)command. If the channel is already inSTOPPEDstate, either issue theSTART CHLcommand to make it start immediately or use theSTOP CHL(CHLNAME) STATUS(INACTIVE)to change the status fromSTOPPEDtoINACTIVEwithout starting it.Once the channels are up, theDISCINTattribute of the channel determines how long it will run before timing out. The value is in seconds and defaults to 600 which is 10 minutes. TheDISCINT,KAINTandHBINTcombine to determine when the channel comes down. Note that the TCP spec calls for things using keepalive to disable them by default so if you want to use keepalive on your channels, youmustenable it in the QMgr tuning as describedhere.Please seeTriggering Channelsin the Infocenter for more on the configuration details. Take a look atSupportPac MD0CWebSphere MQ - Keeping Channels Up and Runningif you want to know more about the internals and tuning. (The SupportPac is a bit dated but the principles of tuning mostly still apply. Where there are discrepancies, the Infocenter is the authoritative version.)If you want to keep channels up continuously, setDISCINT(0)but remember that triggering remains the preferred option. Some shops need to minimize response times during the business day and so setDISCINTto a value that allows the channels to time out at night but generally keeps them running all day. If for some reason you have triggering set up right and the channels go down prior toDISCIINTyou should be able to check in the error logs for the reason why. These reside in the QMgr's directory undererrors. For example, on UNIX/Linux they are in/var/mqm/qmgrs/qmgrname/errorsand on Windows the default location isC:\\Program Files(x86)\\WebSphere MQ\\QMgrs\\qmgrname\\errors. Look for the files namedAMQERR??.LOGwhere??=01,02, or03. The logs rotate where01is current,02is next and so on. If you have a very busy QMgr you need to capture these as soon as the channel goes down or they could roll off.\n"}
+{"text": "### Human: I want to use Backout and Commit at IBM MQ Client.Process OrderPut 10 messages to queueGet 10 messages from queue andBackout()I expect 10 messages exist in the queue because of Backout, but there is no messages exist in the queue. So I think Backout does not work properly. Why?Platform: .Net Core 2.1IBM Client DLL: amqmdnetstd.dll v 9.1.2Codestring hostName = \"TX32\";\nint port = 5566;\nstring channelName = \"TESTTRY\";\nstring queueName = \"TESTTRY\";\nint numberOfMsgs = 10;\nstring queueManagerName = \"DMQ1\";\nint queueOpenOptionsForPut = MQC.MQOO_OUTPUT + MQC.MQGMO_SYNCPOINT + MQC.MQOO_FAIL_IF_QUIESCING;\nint queueOpenOptionsForGet = MQC.MQGMO_SYNCPOINT + MQC.MQOO_FAIL_IF_QUIESCING;\nstring messageString = \"Bunyamin Test\";\nMQQueue queue;\n\nproperties = new Hashtable();\nproperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\nproperties.Add(MQC.HOST_NAME_PROPERTY, hostName);\nproperties.Add(MQC.PORT_PROPERTY, port);\nproperties.Add(MQC.CHANNEL_PROPERTY, channelName);\n\n// PUT MESSAGES\nvar queueManager = new MQQueueManager(queueManagerName, properties);\nqueue = queueManager.AccessQueue(queueName, queueOpenOptionsForPut);\nvar message = new MQMessage();\nmessage.WriteString(messageString);\n\n// putting messages continuously\nfor (var i = 1; i <= numberOfMsgs; i++)\n{\n System.Console.Write(\"Message \" + i + \" <\" + messageString + \">.. \");\n queue.Put(message);\n System.Console.WriteLine(\"put\");\n}\n\nqueue.Close();\nqueueManager.Disconnect();\n\n//GET MESSAGES\nqueueManager = new MQQueueManager(queueManagerName, properties);\nqueue = queueManager.AccessQueue(queueName, queueOpenOptionsForGet);\n\n for (var i = 1; i <= numberOfMsgs; i++)\n {\n // creating a message object\n message = new MQMessage();\n queue.Get(message);\n System.Console.WriteLine(i + \" .Message \" + i + \" got = \" + \n message.ReadString(message.MessageLength));\n queueManager.Backout(); //I EXPECT 10 MESSAGES SHOULD GO BACK TO QUEUE?\n message.ClearMessage();\n}\n\nqueue.Close();\nqueueManager.Disconnect();### Assistant: I would modify your application this way.void testCommitBackout()\n {\n string hostName = \"localhost\";\n int port = 1414;\n string channelName = \"SVRCONN_CHN\";\n string queueName = \"QU1\";\n int numberOfMsgs = 10;\n string queueManagerName = \"QM1\";\n int queueOpenOptionsForPut = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;\n int queueOpenOptionsForGet = MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING;\n string messageString = \"Bunyamin Test\";\n MQQueue queue;\n\n Hashtable properties = new Hashtable();\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n properties.Add(MQC.HOST_NAME_PROPERTY, hostName);\n properties.Add(MQC.PORT_PROPERTY, port);\n properties.Add(MQC.CHANNEL_PROPERTY, channelName);\n properties.Add(MQC.USER_ID_PROPERTY, \"myuserid\");\n properties.Add(MQC.PASSWORD_PROPERTY, \"Mylongpassword\");\n\n // PUT MESSAGES\n var queueManager = new MQQueueManager(queueManagerName, properties);\n queue = queueManager.AccessQueue(queueName, queueOpenOptionsForPut);\n\n // putting messages continuously under a syncpoint and commit after that\n for (var i = 1; i <= numberOfMsgs; i++)\n {\n var mqpmo = new MQPutMessageOptions();\n mqpmo.Options |= MQC.MQPMO_SYNCPOINT;\n var message = new MQMessage();\n message.WriteString(messageString);\n System.Console.Write(\"Message \" + i + \" <\" + messageString + \">.. \");\n queue.Put(message, mqpmo);\n System.Console.WriteLine(\"put\");\n }\n // Now commit all 10 messages.\n queueManager.Commit();\n\n queue.Close();\n queueManager.Disconnect();\n\n //GET MESSAGES\n queueManager = new MQQueueManager(queueManagerName, properties);\n queue = queueManager.AccessQueue(queueName, queueOpenOptionsForGet);\n\n // Get messages under syncpoint \n for (var i = 1; i <= numberOfMsgs; i++)\n {\n // creating a message object\n var message = new MQMessage();\n var gmo = new MQGetMessageOptions();\n gmo.Options |= MQC.MQGMO_SYNCPOINT;\n queue.Get(message, gmo);\n System.Console.WriteLine(i + \" .Message \" + i + \" got = \" +\n message.ReadString(message.MessageLength));\n message.ClearMessage();\n }\n // Backout all messages.\n queueManager.Backout(); //I EXPECT 10 MESSAGES SHOULD GO BACK TO QUEUE?\n\n queue.Close();\n queueManager.Disconnect();\n }Hope this helped.\n"}
+{"text": "### Human: Good day.I'm having an issue which MQ process amqrmppa are keep increasing which currently there are 635 processes exist. Previous 2 days it only have 2++ processes but keep increasing slowly until current value.MQ version = 8.0Operating System = AIX 7This processes expected to be increase until our maxuproc limit which is 1024.When I run command,echo \"dis chs(*)\" | runmqsc MYMQ | grep channel | wc -lThe output appeared is 268.Does this means the actual process that are amqrmppa use is 268?### Assistant: Theamqrmppaprocess is MQ's channel pooling process and by default will scale up using both threads and new process instances. When it increases like this there are two possibilities.Memory leak. The question doesn't mention the complete version number. When the fix pack level is included it would be a dotted-quad format such as8.0.0.1where8.0is the major version and0.1is the support stream and Fix Pack. When the Fix Pack is known it's possible to look through the APARS to see if it is a known problem.Application error. When applications terminate client connections improperly, it leaves an orphan channel instance behind. These eventually time out but the pooling process is slow to release threads since it is quicker to reuse one than to rebuild the entire process from scratch. So the number of processes generally reflects a recent high water mark of started channels.Generally poor programming or external factors (such as firewall timeout) are more likely root causes than MQ code bugs, however the number of APARS in every Fix Pack is testament that these do happen. You might want to tune theMAXCHANsettings so that no one application can spin up more than a reasonable number of concurrent channel instances. You might also want to installBlockIP2orLogIP(fromMr. MQ) and log connection attempts.Some more notes:As a rule, the number of processes islessthan the number of concurrent channels due to dispatching channels to threads. This is tunable though and the local QMgr may have the channels set toPROCESSinstead ofTHREAD. Also, if channels are started byinetdthe result is one channel per process. (Donotdo that in a modern QMgr!)Why are you running withmaxuproc=1024? According to the Infocenter for MQ v8.0,on AIX this value should be 64000. If the recommended kernel tuning has not been performed an apparent process leak is one of the most benign errors you might see. Run themqconfigprogram and follow the advice it gives. (I believemqconfigruns on AIX and also you need to give it the full path name to the executable.)\n"}
+{"text": "### Human: I have reached the ibm site but I cant find the actual logic to make use of the trigger.I have done the below code but how can i receive an intimation from the trigger?public void setTrigger()\n {\n try{\n Queue = QMGR.accessQueue(queueName, (MQC.MQOO_INQUIRE+MQC.MQOO_SET));\n Queue.setTriggerControl(1);\n Queue.setTriggerType(2);\n }\n catch(Exception e){\n System.out.println(\"------------------------\");\n System.out.println(\"trigger method\");\n System.out.println(\"------------------------\");\n System.out.println(e);\n System.out.println(\"************************\");\n }\n }How can I get the intimation whenever message came.### Assistant: First off, don't do the triggering setup via an application. It is a waste of time.Secondly, read & understand these MQ web pages:Starting IBM MQ applications using triggers > Prerequisites for triggeringStarting IBM MQ applications using triggersThird, for Java applications, create a batch file or Unix script to set up any environment variables i.e. CLASSPATH and set batch file or Unix script in the PROCESS's APPLICID field.Fourth, after you do the MQSC definition for the queue and process, don't forgot to start the trigger monitor (otherwise nothing will be triggered).Fifth, if you set Trigger Type of First then make absolutely sure that the triggered application reads every message from the queue before exiting.Sixth, triggering (Trigger First) is only good for scenarios when there are large gaps between messages or large gaps between burst of messages. If you are receiving messages every second or 2 then triggering is not good because the application start, process & exit every second or 2. And if it is a Java application, you will always have the JVM load time.Seventh, if what you really wanted was Message CallBack (Asynchronous) rather than MQ Triggering then go read:Asynchronous consumption of IBM MQ messages\n"}
+{"text": "### Human: I set up a connection with Weblogic IBM Webpsphere MQ through JMS with using a secure channel using SSL.\nMy application on Weblogic received message from MQ.\nSending answer to reply queue.\nThe response header is present MQMD, it fills java. In parameter Persistence JMS send value \"1\". Other system need to received value \"0\" at Persistence. How to set this parameter to java?\nI guess that parameter is javax.jms.deliverymode. But how to set it i don't know.Anyway thank you for help.### Assistant: The corresponding property on JMS is the delivery mode (Int parameter to be set) to set Persistent and non persistent messages.You can refer this URL fromIBMfor details\n"}
+{"text": "### Human: If a publisher publish some messages to a WMQ topic, but the subsciber didn't take it, then where the messages are saved? is there any way to know the message count?### Assistant: As MQ is JMS compliant, the answer is mostly a JMS answer.If the subscription is not durable and no subscription is registered, the messages for that subscriber are discarded.If the subscription is durable, MQ creates a queue (or uses a predefined one if specified by the subscriber) to deliver the messages. The messages will collect there if the subscriber is not consuming them.The 3rd case as Dave points out int he comments is that the non-durable subscriber is holding the subscription open but not consuming the messages. Since a queue is created to receive these that queue depth can be queried to determine if there's a back-up.Based on there being a queue for every subscription (durable or otherwise) just look in the durable subscriber's queue to determine the number of messages outstanding.Please also seePublish/subscribe lifecyclesin the MQ Knowledge Center for more description of the behavior and specification of durable subscriber queues.Of course, if that queue fills up the behavior changes. Depending on the settings either the publishers block or the publications continue but the messages are routed to an exception queue (if specified), the DLQ, or discarded.Thanks Dave Ware for the comments about non-durable subscriptions.\n"}
+{"text": "### Human: I'm looking to setup a Queue Manager Using WebSphere MQ V7 MQ Explorer.\nAfter Creating my Queue Manager, normally I expect that some sub directories are automatically generated under it, \"Queues\", \"Topics\", \"Channels\" .. as illustrated in the photo below.In my case, no sub directories are generated, as illustrated below in the second snapshot.PS: the status of my Queue manager is :Running but disconnectedfrom WebSphere MQ Explorer.When I right-click on the QMgr Name and choose Connect, I get \"An unexpected error (2063) has occurred (AMQ4999)\"Could you advise please about a possible cause of this behavior ?### Assistant: Administrative tools -> Local Security Policy -> Local Policies -> User Rights Assignment -> Log on as a service -> Properties ->add your user hereSame problem with MQ v9 and i solved it this way.\n"}
+{"text": "### Human: There is a property for WebSphere MQ queue to inhibitGETfrom the queue.\nTo set this property I found two ways.Just set the property using WebSphere MQ Explorer GUI.Alter the queue with the MQSC commandALTER QLOCAL(TEST) GET(DISABLED).Is there any way to enable or disableGETon a WebSphere MQ queue through a Java Program?### Assistant: You can use PCFChange, Copy, and Create Queuecommand to change the attributes of the queue. This can be used from Java with the aid of the PCF Java helper classes, seeHandling PCF Messages with IBM MQ classes for JavaInhibitGet (MQCFIN)Get operations are allowed or inhibited (parameter identifier: MQIA_INHIBIT_GET ).The value can be:MQQA_GET_ALLOWEDGet operations are allowed.MQQA_GET_INHIBITEDGet operations are inhibited.\n"}
+{"text": "### Human: When I read about HA in Websphere MQ I always come to the point, when the best practise is to create two Queue Managers handling the same queue and use out-of-the-box load balancing. Therefore, when one is down, the other takes over his job.Well, this is great but what about the messages in the queue that belong to the Queue Manager that went down? I mean do these messages reside there (when queue is persistent of course) until QM is up and running again?Furthermore, is it possible to create a common storage for this doubled Queue Managers? Then no message would wait for the QM to be up. Every message would be delivered in the proper order. Is this correct?### Assistant: WebSphere MQ provides different capabilities for HA, depending on your requirements. WebSphere MQ clustering uses parallelism to distribute load across multiple instances of a queue. This provides availabilityof the servicebut not for in-flight messages.Hardware clustering and Multi-Instance Queue Manager (MIQM) are both designs using multiple instances of a queue manager that see a single disk image of that queue manager's state. These provide availabilityof in-flight messagesbut the service is briefly unavailable while the cluster fails over.Using these in combination it is possible to provide recovery of in-flight messages as well as availability of the service across multiple queue instances.In hardware cluster model the disk is mounted to only one server and the cluster software monitors for failure and swaps the disk, IP address and possibly other resources to the secondary node. This requires a hardware cluster monitor such as PowerHA to manage the cluster.The Multi-Instance QMgr is implemented entirely within WebSphere MQ and needs no other software. It works by having two running instances of the QMgr pointing to the same NFS 4 shared disk mount. Both instances compete for locks on the files. The first one to acquire a lock becomes the active QMgr. Because there is no hardware cluster monitor to perform IP address takeover this type of cluster will have multiple IP addresses. Any modern version of WMQ allows for this using multi-instanceCONNAMEwhere you can supply a comma-separated list of IP or DNS names. Client applications that previously used Client Channel Definition Tables (CCDT) to manage failover across multiple QMgrs will continue to work and CCDT continues to be supported in current versions of WMQ.Please see the Infocenter topicUsing WebSphere MQ with high availability configurationsfor details of hardware cluster and MIQM support.Client Channel Definition Table files are discussed in the Infocenter topicClient Channel Definition Table file.\n"}
+{"text": "### Human: I've being trying to setup my java application that connects to a local queue manager in MQ7 without a WebSphere Application Server installed on my machine in binding mode. Without specifying the host in the .bindings file, running my application will throw an java exception somewhere along the lines of:com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018:\n Failed to connect to queue manager 'TBUKKKNN' with connection mode\n 'Client' and host name ''. Check the queue manager is started and if\n running in client mode, check there is a listener running. Please see\n the linked exception for more information.Although documentation for WebSphere MQ has explicitly denied possibility of connecting to MQ7 without WAS installed on same machine, my colleagues are very confident that there are workarounds for this.Much appreciated if anyone could help me with this issue. Or let me know if more clarification on my question is required.### Assistant: I wrotean articlea while back that explains how to do this so I'm a little puzzled about any documentation stating that it can't be done. Not only is there a \"workaround\" but it is officially supported and the sample programs that come with the WMQ Client install media include several that use Java and JMS but do not use a Java EE server. If for some reason you just grabbed the jar files instead of installing the vendor distribution, you can download it for free to get the samples. The v7.0 clientis hereand the v7.1 clientis here. Also, make sure to use the version of the docs that matches your client version. The v7.0 Infocenteris hereand the v7.1 Infocenteris here. Any client version can connect to a v7.0 QMgr, by the way.Anyway, your error message indicates that your Connection Factory transport type is still set to Client. You'll need to change it to BIND. The properties are describedhere. The landing page with the list of all the properties of all the administered objectsis here.\n"}
+{"text": "### Human: So I'm sending an object using Spring and IBM MQ Queue:public void sendObjectMessage(final Object message) {\n\n// jmsTemplate.convertAndSend(message);\n\n jmsTemplate.send(new MessageCreator()\n {\n public Message createMessage(Session session) throws JMSException\n {\n ObjectMessage outMessage = session.createObjectMessage((Serializable) message);\n return(outMessage);\n }\n }); \n}And during debugging I can see that I am indeed sending it as an object message. But using Spring's listener implementation I am picking up the messages in the onMessage() method as JMSBytesMessages????public void onMessage(Message message) {\n System.out.println(\">>>>>>> Recieved in onMessage\");\n System.out.println(message.getClass());\n}OUTPUT:>>>>>>> Recieved in onMessage\nclass com.ibm.jms.JMSBytesMessageAnybody know whats going on here? This is difficult to debug as it seems to be happening on the queue???Thanks for your helpP.S I've also tried to catch the message usingif (message instanceof ObjectMessage) {\n object = ((ObjectMessage) message).getObject();\n}andif (message instanceof JMSBytesMessage) {\n System.out.println(\"ITS A BYTES MESSAGE!!!!!!!!!!!\"); \n}Neither of which work???### Assistant: My first guess is, that you're using WebSphere AppServer and your JMS queue object (in JNDI) is configured to be a native MQ series client, i.e. you create a JMSObjectMessage which you hand over to the session and then MQSeries thinks it has to convert to BytesMessage.\n"}
+{"text": "### Human: I have a message driven bean that throws exception under certain conditions. When it throws an exception the message is not processed and put back on the queue. From what I understand with MQ and WAS (Websphere Application Server) the message should be marked as bad after x number of tries and removed from the queue. This is not happening and the message remains on the queue marked as bad.What part of the configuration in MQ and/or WAS have I missed to set correct?(The issue with the MDB throwing exceptions is NOT the point here)Thanks.### Assistant: On the queue there are attributes BOQNAME and BOQTHRESH. These must be set to the name of the backout queue where the message is to be requeued and the threshold for number of backouts before requeueing the message.In addition, the QMgr must be able to put the message onto the designated queue. Problems may include misspelling of the queue name, the backout queue being full or the account running the MDB was not authorized to put messages on the backout queue.If the MDB detects a poison message loop and has nowhere to requeue the message, it stops processing. You will still see the thread but you will be missing one or more open input handles on the queue. The app must be restarted to revive it in this instance.Avoid using the system's DLQ for the backout destination. The DLQ is where the QMgr will place messages arriving from another QMgr which cannot resolve to a destination queue. These will have a Dead Letter Header attached whereas MDB messages that are requeued will not. This can cause problems with any automation you have watching the DLQ. Therefore, it is advisable to have an exception queue per application that isnotthe DLQ.BOQTHRESH should be greater than 1 or 2 because normal operations such as shutdown of the QMgr or channel can result in a backout. I generally set BOQTHRESH to 5 or 10 but have seen people set this much higher. Depends on your tolerance for retries and whether the backouts are typically caused by transient conditions such as filling up log extents.\n"}
+{"text": "### Human: I'm experiencing problems with native modules dependencies (specifically IBM MQ for js) inside a Google Cloud Function (Node v10) and didn't found anywhere the information I needed, so I've opened this question and answered myself to allow other people to find it in the future.It worked fine in the Node v8 engine but it is now deprecated. After upgrading the engine to v10 and bumping some packages (following all migration guides regarding my dependencies) the exception is thrown by theffi-napipackage duringyarn install, as follows:ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: ...s status = napi_get_instance_data(env, &d);\n ^~~~~~~~~~~~~~~~~~~~~~\n../src/ffi.cc:11:24: note: suggested alternative: 'napi_new_instance'\n napi_status status = napi_get_instance_data(env, &d);\n ^~~~~~~~~~~~~~~~~~~~~~\n napi_new_instance\n../src/ffi.cc: In function 'Napi::Object BindingHook(Napi::Env, Napi::Object)':\n../src/ffi.cc:347:24: error: 'napi_set_instance_data' was not declared in this scope\n napi_status status = napi_set_instance_data(\n ^~~~~~~~~~~~~~~~~~~~~~\n../src/ffi.cc:347:24: note: suggested alternative: 'napi_new_instance'\n napi_status status = napi_set_instance_data(\n ^~~~~~~~~~~~~~~~~~~~~~\n napi_new_instance\nIn file included from ../src/ffi.cc:3:0:\n../src/ffi.h: At global scope:\n../src/ffi.h:148:19: warning: mangled name for 'Napi::TypedArray FFI::WrapPointer(Napi::Env, T*, size_t) [with T = char*() throw ()]' will change in C++17 because the exception specification is part of a function type [-Wnoexcept-type]\n inline TypedArray WrapPointer(Env env, T* ptr, size_t length = 0) {\n ^~~~~~~~~~~\n../src/ffi.h:148:19: warning: mangled name for 'Napi::TypedArray FFI::WrapPointer(Napi::Env, T*, size_t) [with T = void*(void*, const char*) throw ()]' will change in C++17 because the exception specification is part of a function type [-Wnoexcept-type]\n../src/ffi.h:148:19: warning: mangled name for 'Napi::TypedArray FFI::WrapPointer(Napi::Env, T*, size_t) [with T = int(void*) throw ()]' will change in C++17 because the exception specification is part of a function type [-Wnoexcept-type]\n../src/ffi.h:148:19: warning: mangled name for 'Napi::TypedArray FFI::WrapPointer(Napi::Env, T*, size_t) [with T = void*(const char*, int) throw ()]' will change in C++17 because the exception specification is part of a function type [-Wnoexcept-type]\nmake: *** [Release/obj.target/ffi_bindings/src/ffi.o] Error 1\ngyp ERR! build error \ngyp ERR! stack Error: `make` failed with exit code: 2\ngyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:191:23)\ngyp ERR! stack at ChildProcess.emit (events.js:198:13)\ngyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)\ngyp ERR! System Linux 5.3.0-1020-gcp\ngyp ERR! command \"/usr/bin/node\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"\ngyp ERR! cwd /workspace/node_modules/ffi-napi\ngyp ERR! node -v v10.19.0\ngyp ERR! node-gyp -v v5.0.5\ngyp ERR! not ok \nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! ffi-napi@3.0.1 install: `node-gyp-build`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the ffi-napi@3.0.1 install script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-06-12T17_47_25_766Z-debug.log; Error ID: c4475859It works fine both locally (OSX Catalina node 10.21) and in Docker (tested in alpine-based node 10 and 12 major tags).### Assistant: TLDR: It is not supported yet.I've just found out some needed Native APIs for the IBM MQ package dependencies (ffi-napi specifically) were introduced inNode v10.20(napi_get_instance_dataadded in v10.20.0) but Google Cloud Functions is based onNode v10.18.1.The only work around I found so far is to downgrade theffi-napitov2.4.7using Yarn Resolutions or a custom fork. There is no public information regarding an expected release of the Node v10.20 in the Cloud Functions engine.\n"}
+{"text": "### Human: How do I change the name of an existing channel. My client has informed me that they are changing the channel but keeping the CONNAME the same. I am not able to use the ALTER function. Should I DELETE and re-DEFINE the channel?### Assistant: IBM MQ does not have aRENAMEaction, so you would need toDEFINEa new channel and once you are no longer using the old channelDELETEit.To make it easier you can use theLIKEverb to copy most (if not all) of the parameters of the old channel to the new channel, for example:DEFINE CHL(NEW.CHL) CHLTYPE(SDR) LIKE(OLD.CHL)In the above case theNEW.CHLwill have the same values asOLD.CHLfor things likeXMITQ,CONNAME, etc.\n"}
+{"text": "### Human: I have two docker containers which I'm building using docker-compose. One of which initializes the ibm mqs and another is the one exposes rest end points(using SpringBoot project) to send message to the ibm mq which were set up by first container. When I get the docker-compose up I am getting the below errormock-service_1 | 2020-01-29 08:07:52.928 ERROR 1 --- [nio-7090-exec-2] c.j.ids.controller.AcarsController : JMSWMQ0018: Failed to connect to queue manager 'QM1' with connection mode 'Client' and host name 'localhost(1414)'.\nacars-mock-service_1 | com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'QM1' with connection mode 'Client' and host name 'localhost(1414)'. Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').\n\nmock-service_1 | at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)I'm able to put the messages in the same queue if I run the SpringBoot application locally from my IDE without any error. Not sure what is the issue using separate containers. My DockerFile looks like thisFROM ibmcom/mq\nUSER root\nRUN useradd ibm-mq -G mqm && \\\n echo ibm-mq:passw0rd | chpasswd\nUSER mqm\nCOPY config.mqsc /etc/mqm/\n\nEXPOSE 9443 1414And config.mqscALTER QMGR CHLAUTH(DISABLED)docker-compose.ymlversion: '3.3'\nservices:\n ibm-mq-mock:\n build: \n context: ../mock-service/ibm-mq\n dockerfile: Dockerfile\n ports:\n - 9443:9443\n - 1414:1414\n environment:\n LICENSE: accept\n MQ_QMGR_NAME: QM1 \n mock-service:\n build:\n context: ../mock-service\n ports:\n - 7090:7090\n depends_on:\n - ibm-mq-mock\n environment:\n MQ_QMGR_NAME: QM1\n CHANNEL: DEV.ADMIN.SVRCONN\n IBM_MQ_HOST: localhost\n IBM_MQ_PORT: 1414\n IBM_MQ_USERID: admin\n IBM_MQ_PASSWORD: passw0rd\n IBM_MQ_QUEUE: DEV.QUEUE.1\n LOG_LEVEL: INFO\n PROFILE: test### Assistant: Localhost inside your spring container, is your spring container. Instead of setting the host to localhost for your MQ Connection you need your container's / host ip.How you do it depends on your host's platform, but it will be something likehost.docker.internal\n"}
+{"text": "### Human: I am using this official IBM tutorial:MQ JMS application development with Spring Bootand using IBM\u00ae MQ Advanced for Developers in docker got from this docker hub page:ibmcom/mqMQ is started with this command:docker run --name mq --env LICENSE=accept --env MQ_QMGR_NAME=QM1 --publish 1414:1414 --publish 9443:9443 --detach ibmcom/mqIt's up and running, and I'm able to connect to it using connection name and channel info:ibm.mq.channel: DEV.ADMIN.SVRCONN\nibm.mq.connectionName: localhost(1414)However I get an error when I try to connect to it using the CCDT file. I get this CCDT file with this command:docker cp :/mnt/mqm/data/qmgrs/QM1/@ipcc/AMQCLCHL.TAB I've set the proper application.yml property:ibm:\n mq:\n ccdtUrl: file://but I get this error:com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2020: Failed to connect to queue manager 'QM1' with connection mode 'Client' and supplied CCDT URL 'AMQCLCHL.TAB', see linked exception for more information.\n at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:424)\n at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8475)\n at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7815)\n at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:303)\n at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:236)\n at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6016)\n at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6041)\n at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:196)\n at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:411)\n at org.springframework.jms.listener.AbstractJmsListeningContainer.establishSharedConnection(AbstractJmsListeningContainer.java:379)\n at org.springframework.jms.listener.DefaultMessageListenerContainer.establishSharedConnection(DefaultMessageListenerContainer.java:818)\n at org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:291)\n at org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:276)\n at org.springframework.jms.listener.DefaultMessageListenerContainer.start(DefaultMessageListenerContainer.java:612)\n at org.springframework.jms.config.JmsListenerEndpointRegistry.startIfNecessary(JmsListenerEndpointRegistry.java:242)\n at org.springframework.jms.config.JmsListenerEndpointRegistry.start(JmsListenerEndpointRegistry.java:205)\n at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)\n at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)\n at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)\n at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)\n at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)\n at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:879)\n at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161)\n at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)\n at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)\n at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)\n at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)\n at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)\n at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)\n at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)\n at Application.main(Application.java:11)\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2278' ('MQRC_CLIENT_CONN_ERROR').\n at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)\n ... 31 common frames omitted\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2278\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1688)\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1273)\n at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:377)\n at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:562)\n at com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:357)\n ... 30 common frames omittedThe official troubleshoot is here:2278 (08E6) (RC2278): MQRC_CLIENT_CONN_ERROR, but is says:\"It also occurs in Java\u2122 applications when a client channel definition table (CCDT) is specified to determine the name of the channel, but the table itself cannot be found.\"However the table file is found, if I mispell the filename on purpose, I get a FileNotFoundException.So, what am I missing?### Assistant: The2278 MQRC_CLIENT_CONN_ERRORas you found was because the application could not find a channel matching the queue manager name being specified.The2540 MQRC_UNKNOWN_CHANNEL_NAMEerror is because by setting theQMNAMEfield of the channelSYSTEM.DEF.CLNTCONNyou are now attempting to connect to aSVRCONNchannel calledSYSTEM.DEF.CLNTCONNwhich does not exist.By default a new queue manager comes with a default channel table found in the following location under the MQDATA path:qmgrs//@ipcc/AMQCLCHL.TABThe default channel table only contains a singleCLNTCONNchannel calledSYSTEM.DEF.CLNTCONN. This is meant only to show the default values for newly definedCLNTCONNchannels.On the queue manager your client application connects to aSVRCONNchannel. On the client side of the connection if you use a CCDT the channel type that pairs up with a queue managersSVRCONNis aCLNTCONN.Since you are connecting to aSVRCONNchannel calledDEV.ADMIN.SVRCONNyou need to define a CCDT with aCLNTCONNchannel calledDEV.ADMIN.SVRCONN.I would recommend against modifying the default CCDT and instead just create a new one.You can use the following steps to create a CCDT:echo \"DEFINE CHL(DEV.ADMIN.SVRCONN) CHLTYPE(CLNTCONN) QMNAME(QM1) CONNAME(`localhost(1414)`)\" | MQCHLLIB=/PATH/TO/CCDT MQCHLTAB=NAME_OF_CCDT runmqsc -nJust replace the values ofMQCHLLIBandMQCHLTABwith the actual path and name you want to call the CCDT, for example, to create a CCDT calledAMQCLCHL.TABin/tmpuse the following command:echo \"DEFINE CHL(DEV.ADMIN.SVRCONN) CHLTYPE(CLNTCONN) QMNAME(QM1) CONNAME(`localhost(1414)`)\" | MQCHLLIB=/tmp MQCHLTAB=AMQCLCHL.TAB runmqsc -nFor some more examples showing how to create CCDTs and how MQ selects a specific channel in the CCDT you can review this my answer toConnecting to IBM MQ using CCDT file in JMS.\n"}
+{"text": "### Human: I need help, I have the following issue:AMQ9776: Channel was blocked by userid \n\nEXPLANATION: \nThe inbound channel 'TEST1.SRVCONN' was blocked from address '10.0.2.4' \nbecause the active values of the channel were mapped to a userid which should \nbe blocked. The active values of the channel were 'MCAUSER(mqm) CLNTUSER(mqm)'.And I have the following authorities records:DISPLAY CHLAUTH(*)\n 37 : DISPLAY CHLAUTH(*)\nAMQ8878: Ver detalles de registro de autenticaci\u00f3n de canal.\n CHLAUTH(SYSTEM.ADMIN.SVRCONN) TYPE(ADDRESSMAP)\n ADDRESS(*) USERSRC(CHANNEL)\n\nAMQ8878: Ver detalles de registro de autenticaci\u00f3n de canal.\n CHLAUTH(TEST1.SRVCNN) TYPE(ADDRESSMAP)\n ADDRESS(10.0.2.4) USERSRC(CHANNEL)\n\nAMQ8878: Ver detalles de registro de autenticaci\u00f3n de canal.\n CHLAUTH(TEST1.SRVCNN) TYPE(BLOCKUSER)\n USERLIST(mqm) \n\nAMQ8878: Ver detalles de registro de autenticaci\u00f3n de canal.\n CHLAUTH(SYSTEM.*) TYPE(ADDRESSMAP)\n ADDRESS(*) USERSRC(NOACCESS)\n\nAMQ8878: Ver detalles de registro de autenticaci\u00f3n de canal.\n CHLAUTH(*) TYPE(BLOCKUSER)\n USERLIST(*MQADMIN)So I don't know what else I can do, I had been reading about this problem and I created the rule to connect to the channel and I granted privilege to the user. \u00bfWhat am I missing?### Assistant: Note that for MQ v8 and later when MQ compares the MQ client user to theUSERLISTof aTYPE(BLOCKUSER)rule or to theCLNTUSERon aTYPE(USERMAP)rule, it can be set to look at either the user the client process is running under or at the user that is presented in the MQCSP and successfully authenticated by CONNAUTH. To get the later behavior you must haveChlauthEarlyAdopt=yset in theChannels:stanza of theqm.ini. For new queue managers created under MQ v8.0 LTS and MQ v9.0 LTS the default would NOT be to set this and MQ will look at the user the client process is running under. For MQ v9.0.5 CD, MQ v9.1 LTS, and MQ v9.1 CD the default is to have it set and MQ will look at the user sent in the MQCSP and successfully authenticated by CONNAUTH.Note theChlauthEarlyAdoptsetting was added at 8.0.0.5, prior to this it would always look at the user the client process is running under.By default MQ comes with the following rule:CHLAUTH(*) TYPE(BLOCKUSER)\nUSERLIST(*MQADMIN)That rule blocks all users which MQ deems to have MQ Administrative authority from connecting to ANYSVRCONNchannel on the queue manager.You added the following two rules (note unless you add ALL to your DISPLAY command it will not show all attributes, so I can only discuss what you show):AMQ8878: Ver detalles de registro de autenticaci\u00f3n de canal.\n CHLAUTH(TEST1.SRVCNN) TYPE(ADDRESSMAP)\n ADDRESS(10.0.2.4) USERSRC(CHANNEL)\n\nAMQ8878: Ver detalles de registro de autenticaci\u00f3n de canal.\n CHLAUTH(TEST1.SRVCNN) TYPE(BLOCKUSER)\n USERLIST(mqm)The first (TYPE(ADDRESSMAP)) will allow a connection fromADDRESS(10.0.2.4)to this channel and leave the user set to what is negotiated on the channel. But absent any other MAP rule that blocks connections by settingUSERSRC(NOACCESS), this rule really does not do anything.If you have aSVRCONNchannel that has a blankMCAUSERthen MQ will accept the username that is sent from the client. For most clients this is the user the process is running under, for Java and JMS it is very easy to send any user including a blank value. If both user sent by the client andMCAUSERon the channel are blank then the negotiatedMCAUSERwill be the user the message channel agent process is running under, on unix this would normally bemqm.The second rule (TYPE(BLOCKUSER)) is actually telling MQ specifically to block any channel where the user ismqmis sent from the client, this is likely the opposite of what you were trying to accomplish.If the client connecting is not an administrative application, then the best way to fix this would be to define another user and give that user permission to what it needs.See my answer to the following question for more details on how to provide MQ permissions to a low privledge user:Authorization errors with MQ8 + JDk8It would not be a good practice to allow applications to connect to a SVRCONN channel that has no security, you do not mention if you are usingCONNAUTHorTLScerts to provide security on the channel, but if you are not you should use one or the other to lock down who can connect to the channel.\n"}
+{"text": "### Human: We are trying to connect to IBMMQ using CCDT file and JMS configuration.\nWe are able to connect to it but we have an issue here:since we are using spring to set connection factory with CCDT file, this is initialized once at the start of the application, but unfortunately it picks only one queue manager at a time,i.e it sends all the messages to same queue manager and it does not load balance.Though i observed, if i manually set the CCDT file before every request then its able to load balance the Queue Managers, ideally it looks to me Queue Manager is decided whenever i set the URL to CCDT file. which is wrong practice. My expectation was to initialize the connection factory with CCDT file and then this configuration will be able to load balance on its own.Can you help me this?### Assistant: This is the expected behavior. MQ does not load balance clients, it connection balances them. The connection is the single most time consuming API call and in the case of a mutually authenticated TLS connection can take seconds to complete. Therefore a good application design will attempt to connect once, then maintain that connection for the duration of the session. The JMS architecture and Spring framework both expect this pattern.The way that MQ provides load distribution (again, not truebalancing, but rather round-robindistribution) is that the client connects a hop away from a clustered destination queue. A message addressed to that clustered destination queue will round-robin among all the instances of that queue.If it is a request-reply application, the thing listening for requests on these clustered queue instances addresses the reply message using the Reply-To QMgr and Reply-To Queue name from the requesting message. In this scenario the requestors can fail over QMgr to QMgr if they lose their connection. The systems of record listening on the clustered queues generally do not fail over across queue managers in order to ensure all queue instances are served and because of transaction recovery.Short answer is that CCDT and MQ client in general arenotwhere MQ load distribution occurs. The client should make a connection and hold it as long as possible. Client reconnect and CCDT are forconnectionbalancing only.Load distribution is a feature of the MQ cluster. It requires multiple instances of a clustered queue and these are normally a network hop away from the client app that puts the message.\n"}
+{"text": "### Human: I want to get multiple output from a single XML input message.\nmailbox\n\n 38ghjk\n\n\n 39ghjk\nThis is how my XML looks it contains more DocID. My requirement is I want separate output messages for each DocID. I tried with while loop but I'm not getting separate messages for each DocIDs. I can fetch all DocIDs but I'm not able to get Separate Output each DocID.Please suggest any way or solution to do it and please comment for any queries.### Assistant: DECLARE I INTEGER;\nDECLARE J INTEGER;\nSET J = CARDINALITY(InputRoot.XMLNSC.List.Docs[]);\nSET I = 1;\nWHILE I < J DO\nSET OutputRoot.XMLNSC.LIST.DocId[K] = InputRoot.XMLNSC.List.Docs[I].DocId;\nPROPAGATE TO TERMINAL 'out' delete none;\nSET I = I + 1;\nEND WHILE;Earlier I was not using propagate statement so I was getting single output but now I'm getting different output for all docid.\n"}
+{"text": "### Human: Is anyone aware of an IBM Websphere MQ module compatible with python3? pymqi doesn\u2019t seem compatible and the author seems unconcerned with that fact.### Assistant: pymqiv1.10.1 compatible with python 3.x (tested with 2.7, 3.5, 3.6, 3.7, 3.8)\n"}
+{"text": "### Human: I have MQ client code that can browse an Alias Queue to get the Alias Queue's base object name (i.e. the name of the Local Queue which the Alias Queue points to). However, the code only works when the MQ client connects to an MQ Manager running on the same host as the client code but NOT when the client code connects to an MQ Manager on a remote host.Client Code:MQEnvironment.hostname = \"192.168.1.3\";\nMQEnvironment.port = \"1415\";\nMQEnvironment.channel = \"ADMIN.SVRCONN\";\n\nMQQueueManager mqQueueManager = new MQQueueManager(null);\n\nint openOptions = CMQC.MQOO_BROWSE;// + CMQC.MQOO_RESOLVE_LOCAL_Q;\n\nMQQueue mqQueue = mqQueueManager.accessQueue(\"AN.ALIAS.QUEUE.NAME\", openOptions);\n\nString resolvedName = mqQueue.getResolvedQName();\n\n// resolvedName is null when the MQ Manager is on a remote host \nSystem.out.println(\"Resolved Queue Name: \" + resolvedName);When the resolved queue name of the Alias Queue is null, the MQ Manager's error logs shows the following single entry:AMQ9208: Error on receive from host devlaptop (192.168.1.5).\n\nEXPLANATION:\nAn error occurred receiving data from devlaptop (192.168.1.5) over TCP/IP.\nThis may be due to a communications failure.\nACTION:\nThe return code from the TCP/IP (recv) call was 10054 (X'2746'). Record these\nvalues and tell the systems administrator.Should it be possible for client code to get a remote MQ Manager's Alias Queue's base object name? And if so, how? Am I missing remote permissions somewhere? Or are my client codeopenOptionswrong?NOTE: The Alias Queue or any other queues in the Queue Managers are NOT clustered.### Assistant: What you are seeing at the server is the client shutting down without closing the connection. TCP closes it and the QMgr emits the error you see in the QMgr logs. If the client were receiving an error you would see it returned to the client.The question doesn't specify whether the alias you are trying to open is clustered or not. If it is clustered then we expect the resolved name to be blank as per the docs. In this case, theOPENresolves to a transmission queue but the application is not told which one. In the returned handle the application sees, the resolved queue and QMgr name are left blank.This is covered in the section onName Resolutionin the Knowledge Center. Refer to the table row withBlank queue managerin Column 1 andAlias queue with CLUSTER attributein Column 2.\n"}
+{"text": "### Human: I'm trying to use rubywmq gem to publish message to a IBM MQ pub/sub topic. I do not see any direct way of publishing to topic from Ruby code.Following is the MQ TOPIC, SUB setup MQSC:DEFINE TOPIC(MY_TOPIC) TOPICSTR('COM/APP')\nDEFINE QALIAS(MY_TOPIC_Q) TARGET(MY_TOPIC) TARGTYPE(TOPIC)\n\nDEFINE QLOCAL(APP.RAW.INPUT)\nDEFINE QLOCAL(APP.VALIDATOR.INPUT)\nDEFINE QLOCAL(APP.ENRICHER.INPUT)\nDEFINE QLOCAL(APP.XFORM.INPUT)\nDEFINE QLOCAL(APP.LOGGER.INPUT)\n\nDEFINE SUB(SUB.APP.RAW.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/RAW') DEST(APP.RAW.INPUT)\nDEFINE SUB(SUB.APP.VALIDATOR.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/XML') DEST(APP.VALIDATOR.INPUT)\nDEFINE SUB(SUB.APP.ENRICHER.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/VLD') DEST(APP.ENRICHER.INPUT)\nDEFINE SUB(SUB.APP.XFORM.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/ENR') DEST(APP.XFORM.INPUT)\nDEFINE SUB(SUB.APP.LOGGER.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('#') DEST(APP.LOGGER.INPUT)I also tried publishing to alias queue for the topic with MQRFH2 header\nRuby Code:WMQ::QueueManager.connect(:connection_name => conn_name, :channel_name => channel_name, :q_mgr_name=> queue_manager) do |qmgr|\n message = WMQ::Message.new\n message.data = 'Hello World'\n message.headers = [\n {\n header_type: :rf_header_2,\n xml: ['COM/APP/MSG/RAW']\n }\n ]\n message.descriptor[:format] = WMQ::MQFMT_STRING\n qmgr.put(q_name: 'MY_TOPIC_Q', message: message )\nendAnd then add a SUB with selector like:DEFINE SUB(SUB.APP.RAW.INPUT) TOPICOBJ(MY_TOPIC) TOPICSTR('MSG/RAW') DEST(APP.RAW.INPUT) PSPROP(RFH2) SELECTOR('route = ''COM/APP/MSG/RAW''')Couldn't succeed. Could anyone please point where the problem is or suggest an alternative? Thanks.Software Version Used:IBM WMQ Server & Client v7.5Ruby v2.3.0rubywmq v2.1.1### Assistant: Putting a message to an alias over a topic is a method to convert point-to-point apps to pub/sub. Since the API call is PUT and not PUBLISH, there is no mechanism to add a topic string to the prefix supplied by the topic object. The messages are published to the topic string as defined in the topic object and no further. YourSUB.APP.LOGGER.INPUTsubscription should be seeing the publications, but not the other ones.There are several other issues in the posted code. The crafting of an RFH2 header suggests you are relying on docs from perhaps as early as v5.3 or v6. Unfortunately, there is no mention of which version the MQ server is at or which version client libraries are being used by Ruby.There is also no mention of what you meant by \"Couldn't succeed.\" Does that mean you saw zero publications, even onSUB.APP.LOGGER.INPUTpub appeared to PUT messages OK? Or the PUT returned a bad reason code? Or that you got messages onSUB.APP.LOGGER.INPUTbut nowhere else?For debugging purposes, you can use MQ Explorer, theamqsputsample, or any of the other supplied tools to drop a message onto the alias queue and look for output. The difference between that test and your Ruby testing should help diagnose the issue.Please do come back and update your question with additional details if you'd like a less speculative response.\n"}
+{"text": "### Human: I want to use IBM Websphere MQ client v7.5. I am writing standalone JMS client application to send and consume messages from the IBM WebsphereMQ server(which is running somewhere else but I have authority to send/receive messages)\nI followed steps below:Installed Websphere MQ client(Free version for 6 months) and did all basic installation.I copied required Jar to other location/host and wrote a sample JMS application to send/receive messages. I am able to communicate to with the server.My questions is : Can I use these Jars independently on any host(even in production) for life long or I should buy proper licence, install the client and then use those JARs ?Thanks,Anuj### Assistant: MQ v8.0.0.4 provides exactly what you want. See here:http://www-01.ibm.com/support/docview.wss?uid=swg21969244. Look forIBM MQ JMS and Java 'All Client'. Client is free but whoever runs the queue manager must have appropriate licenses.\n"}
+{"text": "### Human: I am trying to connect to Websphere MQ from my node.js clients.\nI found two options1.Using MQTT protocol\n --- we dont have license for MQTT \n2.Using MQLight\n -- We are using a older version of websphere MQ which does not have bridge between MQLight and MQ.Are there any other options or is it possible to send messages from MQlight to MQ 7 queue/topic.### Assistant: There is no interoperability at any released version of MQ which supports AMQP, the protocol MQLight uses (at time of writing 8.0.0.3 is the newest version).The MQTT protocol is supported from MQ 7.1+, and would allow a node.js MQTT client to create and consume messages to MQ via the MQ telemetry component.\n"}
+{"text": "### Human: I have Queue A. I have used this in one of my message flow which is up and running. I want to know the number of message dropped in to the queue A on particular day or time interval.Kindly help me in finding out this.### Assistant: Please have a look at the product manuals, in particular:Queue statistics informationtells how to enable queue statistics and ensure that you are collecting all the relevant data.Displaying accounting and statistics informationwhich explains, well, pretty much what the title says.And to keep this on-topic for Stack Overflow, check out theStatistics messages formatpage which tells you how to programmatically access the queue stats messages. By writing your own code to collect the messages, you can store them to a database, save them off to a file, slice and dice the numbers for pie charts, whatever.You did not mention which version of MQ that you are using and that is usually important. However, all modern versions of MQ have some queue stats instrumentation. The links I provided are from the v8.0 Knowledge Center.\n"}
+{"text": "### Human: In MSMQ there is a functionality that lets users to peek at a message without actually consuming it. i.e. I peek at the next message in a Queue based on MessageID. If I am not interested in the message I can put the message back into the Queue (i.e. unacknowledged are added back to the Queue and the messageID is maintained).Similar functionality also exists in RabbitMQ. However in RabbitMQ its not done in a clean way. You can simulate peeking messages by taking the message off the queue and then not sending an acknowledgement so RabbitMQ will then add that message back to the queue. However I read that RabbitMQ can reorder the messages and increment message IDs when unacknowledged messages are re-added to the queue.Has anyone encountered this problem before.Also does any one know if IBM MQ supports this behaviour/functionality of peek and seek?regards\nD### Assistant: IBM MQ provides a way to browse messages without removing them from queue. You can start browsing messages from the beginning and iterate through all messages in a queue. You can also browse a specific message using MessageId or CorrelationId.Here is snippet in C# for browsing messages in a queue./// \n /// Browse messages in a queue\n /// \n private void BrowseMessages()\n {\n MQQueueManager qm = null;\n MQQueue queueGet = null;\n Hashtable mqProps = null;\n\n try\n {\n mqProps = new Hashtable();\n // Setup properties for connection\n mqProps.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n mqProps.Add(MQC.HOST_NAME_PROPERTY, \"localhost\");\n mqProps.Add(MQC.PORT_PROPERTY, 1414);\n mqProps.Add(MQC.CHANNEL_PROPERTY, \"QM.SVRCONN\");\n\n // Open connection to queue manager\n qm = new MQQueueManager(\"QM\", mqProps);\n\n // Open queue for browsing\n queueGet = qm.AccessQueue(\"Q1\", MQC.MQOO_BROWSE | MQC.MQOO_FAIL_IF_QUIESCING);\n\n // In a loop browse all messages till we reach end of queue\n while (true)\n {\n try\n {\n // Need to create objects everytime\n MQMessage msg = new MQMessage();\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n\n // Use browse next option to start browsing\n gmo.Options = MQC.MQGMO_BROWSE_NEXT;\n queueGet.Get(msg, gmo);\n Console.WriteLine(msg.ReadString(msg.MessageLength));\n }\n catch (MQException mqex)\n {\n // When there are no more messages to browse, the Get call\n // will throw MQException with reason code MQC.MQRC_NO_MSG_AVAILABLE.\n // But here we close the queue and break out of loop for all exceptions\n queueGet.Close();\n break;\n }\n }\n qm.Disconnect();\n }\n catch (MQException mqex)\n {\n Console.WriteLine(mqex);\n }\n }\n"}
+{"text": "### Human: I want to create a topic with name \"manipulation\" in my Java application, but I get this error:Exception in thread \"main\" com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2085'My code is:MQTopic subscriber = new MQTopic(queueManager, null, \"manipulation\",CMQC.MQTOPIC_OPEN_AS_SUBSCRIPTION, CMQC.MQSO_CREATE);as said here:Accessing queues, topics, and processes in IBM MQ classes for Java### Assistant: The code that you are using to create a subscription for topic needs slight modification to get it working:MQTopic subscriber = new MQTopic(queueManager, null, \"manipulation\",CMQC.MQTOPIC_OPEN_AS_SUBSCRIPTION, CMQC.MQSO_CREATE);In the above snippet you have specified the third parameter, i.e topic object name. When you specify a topic object name, then that object must exist before it can be used. In your case you have administratively create a topic object with namemanipulationand then use above constructor to create a subscription. Because topicmanipulationdoes not exist, anMQRC 2085exception is being thrown.You have two options:1) Administratively create a topic object \"manipulation\".2) If you don't want create a topic object, then create a subscription on the fly without using topic object name as shown belowMQTopic subscriber = queueManager.accessTopic(\"manipulation\", \"\", CMQC.MQTOPIC_OPEN_AS_SUBSCRIPTION, CMQC.MQSO_MANAGED | CMQC.MQSO_CREATE | CMQC.MQOO_FAIL_IF_QUIESCING);\n"}
+{"text": "### Human: I have developed subscripe (topic) conncept using Camel. it is working fine in my local tomcat.but it is not working in my test environment tomcat. it is getting below mentioned error. kindly help me to resolve the issue and how to debug the issue.is it related to server configuration ?Errororg.apache.camel.component.jms.JmsMessageListenerContainer refreshConnectionUntilSuccessful\n SEVERE: Could not refresh JMS Connection for destination 'TOPIC-NAME' - retrying in 5000 ms. Cause: JMSWMQ0018: Failed to\n connect to queue manager 'QUEUE-MANAGER' with connection mode 'Client' and\n host name 'HOST-NAME'.; nested exception is com.ibm.mq.MQException:\n JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED')\n reason '2059' ('MQRC_Q_MGR_NOT_AVAILABLE').regards,\nGnana### Assistant: There is almost no information to go on here and therefore no way to answer with any confidence. Instead, I'll provide a diagnostic process and hopefully you will find the problem. Note that in the future if you have similar issues, it would help to list the diagnostics you have already tried so that people responding can narrow down their answers.In order for this to work, the QMgr must be running a listener, have a channel defined and available, have authorizations set up to allow the connection, and be able to resolve the queue or topic requested. With that in mind, the things I normally check and the order I check them in is as follows:Is the QMgr running.Is the listener running? On what port?Can I telnet to the QMgr on the listener port? i.e.telnet mqhost 1414.Is the channel defined? If so, is it available?Do the sample client programs work? In this case,amqspubcis the one to try.There are other considerations and if all of the above work, it is time to look into the client code and configuration, the versions of the client and server, authorizations, etc. But until you know that the basic configuration is in place to support a client connection (which was not indicated in the question) then these are the things to start with.\n"}
+{"text": "### Human: I am writing an application that gets data from IBM WebSphere MQ. IBM supplies a DLL with classes to interact with MQ. However, there appear to be two main namespaces; IBM.WMQ and IBM.WMQAX. The latter seems to be a newer addition, but the former appears to be what vague answers on various web sites suggest using for .NET applications. I was hoping someone here might be able to enumerate the real differences and what advantages/disadvantages the classes in each namespace offer.### Assistant: Fromthis thread:The IBM.WMQ is IBM's version of Neil Kolban's original work of\n converting the Java classes for MQ to classes for the .NET framework.The IBM.WMQAX is IBM's COM component for accessing MQ (ActiveX)If you're coding in .NET, use IBM.WMQ since it's managed code. If\n you're coding in VB6 or VC++ then use the ActiveX com component.You could use the COM component from .NET using COM Interop, but that\n really would only make sense, IF, the classes for .NET were NOT\n available. Seeing that they are, use IBM.WMQ.\n"}
+{"text": "### Human: We currently use MQ Explorer to manage a WebSphere MQ V7 on Z/OS.\nFew days ago I deleted a queue by mistake.\nLater I wanted to go back in history and look some logs to see when it exactly happened.\nMy question is, where does MQ Explorer logs all activities that takes place via MQ Explorer?Thank you### Assistant: MQ Explorer does not have such a log. If you want an audit trail of things done to your queue manager you should enable command events on the queue manager, that way you'll have an audit trail regardless of the tool used to do the deed.Command events are enabled usingALTER QMGR CMDEV(ENABLED)or if you prefer not to clutter the audit trail with Display commands, useALTER QMGR CMDEV(NODISPLAY).You may also want to consider configuration events, which provide a snapshot of a object before and after any change. For example in your example where a queue is deleted, the configuration event will contain a snapshot of what the queue looked like before it was deleted, allowing that information to be used to reinstate the queue as it was.Read more:-Command EventsCommand Event referenceConfiguration EventsCreate object Event referenceChange object Event referenceDelete object Event reference\n"}
+{"text": "### Human: I just upgraded a project to VS2013 from VS2010 and now it crashes whenever I send a message via MQ, yet it worked fine under VS2010.I suspected it was something to do with VS2013, so I built one of the demo apps that comes with MQ - imqwrld.cpp which is a simple \"hello world\" app.This code alone is enough for the debug runtime library to throw an exception:#include // WebSphere MQ C++\n int main ( int argc, char * * argv ) {\n\n ImqQueue * p = new ImqQueue();\n delete p;\n return 0\n }when the ImqObject is deleted, the c rtl detects memory corruption.I suspect it is because of DLL hell. The MQ dlls have a dependency on msvcr80.dll and my program uses a different version of the library - msvcr120d.dll.Any suggestions on how I can solve this? I'm using MQ client 7### Assistant: Its a current release (up to and including 7.5) bug/restriction - the compiler that MQ produces its C++ libraries from, and the Visual Studio 2012+ compilers are apparently binary incompatible. You cannot solve nor workaround this other than to use the C or .NET API's depending on what you are trying to do...As @John M Gant commented below,hereis the official support page from IBM. BTW, it looks like MQ Series 8.0is supportedfor C++ in VS2012\n"}
+{"text": "### Human: If I want to set up Websphere MQ in a distributed environment (across 2 machines in a cluster), will the queues and topics(which I understand as physical storage spaces for messages) be created on both machines?Or will the queues and topics be created on one machine only but the program (I guess it is called the websphere MQ broker) will be deployed on 2 machines and both the instances will access the same queue and topic.### Assistant: Cluster concept in WebSphere MQ is different from the traditional high availability (HA) clusters. In traditional HA cluster two systems access the same storage/data to provide HA feature. Both systems can be configured to be active at anytime and processing requests. You can also have a active/passive type of HA configuration.Unlike traditional HA cluster, WebSphere MQ cluster is different. Two queue managers do not share the same storage/data. Each queue manager is unique. WebSphere MQ cluster is more suitable for workload balance than a HA. You can have a queue with same name in multiple queue managers in a MQ cluster and when messages are put, MQ cluster will load balance them to all queues in that cluster. It should be noted the messages in each instance of a queue in cluster are independent and are not shared. If for some reason one of the queue manager in a cluster goes down, then messages in that queue manager become unavailable till the queue manager comes back.Are you aiming for workload balance or HA? If you are aim is to achieve HA, then you could look at the multi-instance queue manager feature of MQ or any other HA solutions. If you are aiming for workload balance then you can go for MQ clustering. You can also have a mix of mutli-instance queue manager and MQ clustering to achieve HA and workload balance.\n"}
+{"text": "### Human: This is the sample code i am using, however, i don't know how to get a response back from put or access queue, that the message is sent.mqQueue = mqQMgr.AccessQueue(\"Queue Name\", MQC.MQOO_OUTPUT |\n MQC.MQOO_INPUT_SHARED | MQC.MQOO_INQUIRE); \n mqQueue.Put(mqMsg, mqPutMsgOpts);PUT method is a void return type, if it would have been bool for example, based on the return value - true/false, i can confirm, message was sent to the queue, that is what my question, how do i get back an acknowledgement,so that message is sent to the queue.Any inputs will be highly helpful.### Assistant: Updating as per comments clarifying the question:Enclose yourPUTin a try block and catch theMQException. If noMQExceptionwas thrown, then thePUTworked and you got back RC=0. For example, this is from the samplePUTprogram:void PutMessages()\n {\n try\n {\n // mq properties\n properties = new Hashtable();\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n properties.Add(MQC.HOST_NAME_PROPERTY, hostName);\n properties.Add(MQC.PORT_PROPERTY, port);\n properties.Add(MQC.CHANNEL_PROPERTY, channelName);\n\n // display all details\n Console.WriteLine(\"MQ Parameters\");\n Console.WriteLine(\"1) queueName = \" + queueName);\n Console.WriteLine(\"2) host = \" + hostName);\n Console.WriteLine(\"3) port = \" + port);\n Console.WriteLine(\"4) channel = \" + channelName);\n Console.WriteLine(\"5) numberOfMsgs = \" + numberOfMsgs);\n Console.WriteLine(\"\");\n\n // create connection\n Console.Write(\"Connecting to queue manager.. \");\n queueManager = new MQQueueManager(queueManagerName, properties);\n Console.WriteLine(\"done\");\n\n // accessing queue\n Console.Write(\"Accessing queue \" + queueName + \".. \");\n queue = queueManager.AccessQueue(queueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);\n Console.WriteLine(\"done\");\n\n // creating a message object\n message = new MQMessage();\n message.WriteString(messageString);\n\n // putting messages continuously\n for (int i = 1; i <= numberOfMsgs; i++)\n {\n Console.Write(\"Message \" + i + \" <\" + messageString + \">.. \");\n queue.Put(message);\n Console.WriteLine(\"put\");\n }\n\n // closing queue\n Console.Write(\"Closing queue.. \");\n queue.Close();\n Console.WriteLine(\"done\");\n\n // disconnecting queue manager\n Console.Write(\"Disconnecting queue manager.. \");\n queueManager.Disconnect();\n Console.WriteLine(\"done\");\n }\n\n catch (MQException mqe)\n {\n Console.WriteLine(\"\");\n Console.WriteLine(\"MQException caught: {0} - {1}\", mqe.ReasonCode, mqe.Message);\n Console.WriteLine(mqe.StackTrace);\n }\n }As noted, this is from the sample code and a real program intended for Production would probably have more granular exception handling. That said, the API call will either succeed or throw anMQException. The exact behavior depends on your options. For example, if you request message conversion on aGETit's possible to get a conversion error whereas the exact same message retrieved as a binary payload would succeed.Previous response:I'm not sure I understand the question, but what Ithinkyou are asking is how to design a request/reply program using WebSphere MQ and that's how I'll respond. However, if by \"response\" you actually meant the reason and return code from thePUT, please clarify the question and I'll update my answer.The usual pattern for request/response is that the requesting program first opens the reply-to queue. If the name of the queue that is opened is a model queue, the queue manager creates a dynamic queue and returns a handle to that. Otherwise, the queue must be a pre-existing local queue.Once the application has a handle on the reply-to queue, it opens the request queue and creates a new request message. The name of the local reply-to queue is used to initialize thereplyToQueuefield of the request message. The local queue manager name is automatically filled in for the message'sreplyToQMgrfield. The app then puts the message and waits on the reply in the reply-to queue.If there are several app instances listening on the same reply-to queue, they usually specify a correlation ID for the specific message they want. The usual design is that the server that reads the request message puts theMQMD.MsgIDinto theMQMD.CorrelIDfield of the reply message however sometimes it transfers the incoming message ID to the outbound message ID.Be sure toCOMMITthePUTbefore issuing theGETor else you willneverget a reply.There's more on this in the Infocenter topicDesign of the Request sample programand you can find the sample programs atC:\\Program Files (x86)\\IBM\\WebSphere MQ\\tools\\dotnetin a default Windows WMQ client installation. I would encourage you to familiarize yourself with the samples and reuse some of the code from there. If you didn't actually download and install the full client, pick up a copy free atSupportPac MQC75. Then when you install it, be sure to select the option to install the SDK and sample code.\n"}
+{"text": "### Human: I would like to get some opinion regarding these two JMS providers in terms of :DocumentationEasy to useFeaturesStandard ConformanceI would like to use it together with NetBeans and GlassFish.Thanks.### Assistant: HornetQ has a concise documentation on hornetq.org. Maybe it's just me but I often find myself lost on the redbooks on IBM while looking for the right documentation.HornetQ has very few dependencies making it easy to manage.You would need to compare feature by feature, but last time I looked at it HornetQ has more features.Both are JMS compliant. However with HornetQ you have standard syncs out of the box.In a another note, I made myself a performance comparison between HornetQ and WebSphere MQ and HornetQ was faster in all the usecases. I can't publish the actual comparisson due to license issues with IBM.Regarding glass fish you will have to integrate the Resource Adapter of HornetQ, but we haven't dedicated many resources on testing it.As for NetBeans that should be really easy.\n"}
+{"text": "### Human: I am writing a Java application, running in a LINUX environment, that does transactions on an MQ using SYNCPOINT. It uses Websphere MQ Java Classes to interact with the MQ service. What I am doing in my code is the following (pseudo):MQGetMessageOptions gmo = new MQGetMessageOptions();\ngmo.options = MQConstants.MQGMO_FAIL_IF_QUIESCING | MQConstants.MQGMO_SYNCPOINT;\n\nMQMessage message = new Message();\nqueue.get(message, gmo);\n\n// process the message, save to database\n\ndatabaseConnection.commit();\nqueueManager.commit();I basically grab the message, process it, persist to database, then call a commit on the queueManager. The process listens for a message on TIBRV in order to do a graceful shutdown.I've been testing the process to make sure no messages are lost. I place 20k messages on a queue, then run the process. I perform a graceful shutdown call in the middle of processing. I then compare the amount of messages on the queue versus the amount of messages in database. When a graceful shutdown occurs via TIBRV message, the number of MQ messages + the number of DB messages = total messages originally on the queue.However, when I do akillorkill -9, I see that a message is lost. I always end up with a result of 19999 total messages.Is there a way I can investigate how I am losing this message? Is there anything that occurs on the Websphere App Server that I would need to be aware of?### Assistant: There is no reason to expect the numbers to reconcile when using single-phase commit. The program will always be between the WMQ and DB Commit call or else between the DB and WMQ Commit call when you kill it.What you are asking for would require 2-Phase (XA) Commit. For WMQ, 2PC would require the application to be using bindings mode and for WMQ to be the resource coordinator. You would then call MQBEGIN, execute your WMQ and DB updates, then call MQCOMMIT. This way both the WMQ and DB transactions would succeed or fail together.\n"}
+{"text": "### Human: I've a problem whereby a message occasionally gets read from the Q more than once. I'm using .NET wrapper for MQSeries (amqmdnet.dll) and read messages, using Win Service.Here's how I do it with VB.NET:\n\n'QManager\n Dim properties As Hashtable = New Hashtable(4)\n\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT)\n properties.Add(MQC.CHANNEL_PROPERTY, channelName)\n properties.Add(MQC.HOST_NAME_PROPERTY, iPAddress)\n properties.Add(MQC.PORT_PROPERTY, port)\n\n QManager = New MQQueueManager(queueManagerName, _\n properties)\n\n\n'Q itself\ngetMessageOptions.Options = _\n MQC.MQGMO_FAIL_IF_QUIESCING Or _\n MQC.MQGMO_WAIT Or _\n MQC.MQGMO_SYNCPOINT\n\ngetMessageOptions.WaitInterval = 1000 ' read from config\n\nDim locker As New Object\n\nSystem.Threading.Monitor.Enter(locker)\n\nQ.Get(message, getMessageOptions)\n\nQManager.Commit()\n\nSystem.Threading.Monitor.Exit(locker)I heard that Q.Get(message, getMessageOptions) makes the message unavailable for other readers, QManager.Commit in turn just removes the message from the Q (by analogy with .NET Peek & Dequeue). That on its own should eliminate need for Monitor.In my Win Service multiple threads read the Q and we suspect that due to a low polling interval (100ms and less) the wrapper doesn't get enough time to update 'Read' flag of the message, so it get's picked up more than once by overlapping threads. Historically the same message gets read up to four times.Before increasing the polling interval, I wanted to make sure if I'm doing things the right way. Could anyone suggest on any problmes with my approach?Thanks.### Assistant: Let's address a number of points from the post and subsequent comments:Performing a GET in WMQ does indeed make the message unavailable to other readers. A GET outside of syncpoint permanently dequeues the message immediately whereas a GET under syncpoint makes the message unavailable to other readers unless a BACKOUT occurs. A BROWSE operation however provides no such protection.The queue manager mediates access to the messages. There is no direct manipulation by the MQ application of the queue or message internals, and thus no opportunity for the .Net wrapper to manipulate a \"Read flag\".The wait interval is how long the outstanding GET blocks the program if the queue has no available messages and with a value of 1000 that interval is one second. If there are many messages on the queue and the program loops immediately, the effective polling interval is however long it takes the program to process the message. The wait interval has no affect on throughput dequeueing messages from a deep queue since the queue manager never has to wait for a message to arrive.WMQ offers a number of different levels of reliability. These are controlled by things such as message persistence, acknowledge mode and transactionality. For example, a non-persistent message retrieved outside of a unit of work provides at-most-once reliability.With regard to threading and synchronization, theWebSphere MQ: Using .Netmanualhas this to say:The implementation of WebSphere\u00ae MQ\n .NET ensures that, for a given\n connection (MQQueueManager object\n instance), all access to the target\n WebSphere MQ queue manager is\n synchronized. The default behaviour is\n that a thread that wants to issue a\n call to a queue manager is blocked\n until all other calls in progress for\n that connection are complete. If you\n require simultaneous access to the\n same queue manager from multiple\n threads within your program, create a\n new MQQueueManager object for each\n thread that requires concurrent\n access. (This is equivalent to issuing\n a separate MQCONN call for each\n thread.)If the default connection options are\n overridden by\n MQC.MQCNO_HANDLE_SHARE_NONE or\n MQC.MQCNO_SHARE_NO_BLOCK then the\n queue manager is no longer\n synchronized.So the synchronization is done for you but the exact behavior depends on whether each thread has its own connection. This is because transactions are connection-scoped. If one connection serves many threads and one of the threads calls COMMIT then all threads under that connection are in the same unit of work and all COMMIT at once.There are a couple of possibilities that can result in duplicate messages other than browsing them. All of these are variations on messages being backed out. Backouts may not always be under program control. When many transactions are under syncpoint simultaneously, several tuning limits come into play including MAXUMSGS, log file primary and secondary extents and several others. If any of these limits are exceeded, the QMgr will cancel the oldest outstanding unit of work to make room for the next one. Another reason backouts occur is if the client connection is interrupted. In this case any GETS under syncpoint are rolled back and the messages become available again.One way to determine whether this is happening is to inspect the backout count of the messages as they are read. A robust messaging application will routinely check this value as part of poison message handling and requeue (or delete and log) messages where the backout count exceeds some arbitrary threshold. This prevents an unreadable message from permanently locking a thread. When duplicate messages are seen it might be helpful to log any messages where the backout count exceeds zero rather than simply requeueing those that exceed the threshold.Another way to see exactly what is happening is to use thetracing facilities of WMQorSupportPac MA0W. Either of these will show exactly what API calls are being performed, by which applications and threads, and with which options. If your trace shows that duplicate messages are being delivered to non-browse GET calls without BACKOUT occurring, then it is a defect for which you can request a fix.There is a slight chance if you are using older .Net code that the problem is a defect that has been fixed. I did not see any defects in the fix lists that would result in duplicate messages but if your .Net client is not at a recent v7 you should be considering upgrading soon anyway. The v7 classes are much more functional, and in fact are now fully integrated into WMQ and supported. There is also the small matter of WMQ v6 going end-of-support as of September 2011. You can get the latest WMQ client inSupportPac MQC7. If you have already installed a v7 client and need to upgrade to v7.0.1.4 you can install the latest client over the older v7 one or apply the latest Fix Pack (FP 7.0.1.4 as of this writing) from theRecommended Fixes page. The Fix Pack upgrades client as well as server installations.\n"}
+{"text": "### Human: I\u2019m writing a client that receives messages from an external Websphere MQ Queue and puts them on an internal MSMQ Queue. The client will use MQ Client or, preferably, be purely managed (MQC.TRANSPORT_MQSERIES_MANAGED).Based on anexample from IBM, I have a version up and running that can do a simple IBM.WMQ.MQQueue.Get(\u2026). How can this operation be done within a transaction? I'm thinking of using non-XA transactions.### Assistant: The WMQ Single-Phase Commit is enabled by using the MQC.MQPMO_SYNCPOINT flag when putting messages or the MQC.MQGMO_SYNCPOINT flag when getting messages. To complete the unit of work, call the queue manager object's Commit or Backout method.Reference: the Backout and Commit methods in theMQQueueManagersection in the manual.As long as you are using managed code you are limited to 1-phase commit. If using unmanaged code in bindings mode (using shared memory to talk to a local WMQ QMgr) you can use XA. In that case you'd need to use the Begin method.\n"}
+{"text": "### Human: How can I check from IBM MQ UI that to a specific queue if there is any consumer present### Assistant: From WMQ Explorer or any of the desktop client tools, look for an open input handle on the queue. In WMQ Explorer's default view the first two columns are the queue name and type. After that there are several columns with numbers. The first is queue depth. Next is the number of open input handles, then the number of open output handles. If you right-click on the queue name there is an option for Status. Selecting that will show you lots of details about the handles such as who has them open, what open options were used, the PID holding the handle, etc.If you wanted to do this at the command line you would use runmqsc and the display qstatus command. For example:echo 'dis qs(SYSTEM.ADMIN.COMMAND.QUEUE) type(handle) all' | runmqsc TESTQMGR\n\n5724-H72 (C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.\nStarting MQSC for queue manager TESTQM.\n\nAMQ8450: Display queue status details.\n QUEUE(SYSTEM.ADMIN.COMMAND.QUEUE) TYPE(HANDLE)\n APPLDESC( )\n APPLTAG(er V7\\java\\jre\\bin\\javaw.exe)\n APPLTYPE(USER) BROWSE(NO)\n CHANNEL( ) CONNAME( )\n ASTATE(NONE) HSTATE(INACTIVE)\n INPUT(NO) INQUIRE(NO)\n OUTPUT(YES) PID(6236)\n QMURID(0.0) SET(NO)\n TID(*)\n URID(XA_FORMATID[00000000] XA_GTRID[] XA_BQUAL[])\n URTYPE(QMGR) USERID(T.Rob@IBM-02BE93E63E4)\nAMQ8450: Display queue status details.\n QUEUE(SYSTEM.ADMIN.COMMAND.QUEUE) TYPE(HANDLE)\n APPLDESC( )\n APPLTAG(er V7\\java\\jre\\bin\\javaw.exe)\n APPLTYPE(USER) BROWSE(NO)\n CHANNEL( ) CONNAME( )\n ASTATE(NONE) HSTATE(INACTIVE)\n INPUT(NO) INQUIRE(YES)\n OUTPUT(NO) PID(6236)\n QMURID(0.0) SET(NO)\n TID(*)\n URID(XA_FORMATID[00000000] XA_GTRID[] XA_BQUAL[])\n URTYPE(QMGR) USERID(T.Rob@IBM-02BE93E63E4)\nAMQ8450: Display queue status details.\n QUEUE(SYSTEM.ADMIN.COMMAND.QUEUE) TYPE(HANDLE)\n APPLDESC(WebSphere MQ Command Server)\n APPLTAG(ebSphere MQ\\bin\\amqpcsea.exe)\n APPLTYPE(SYSTEM) BROWSE(NO)\n CHANNEL( ) CONNAME( )\n ASTATE(NONE) HSTATE(ACTIVE)\n INPUT(EXCL) INQUIRE(YES)\n OUTPUT(NO) PID(5556)\n QMURID(0.0) SET(NO)\n TID(1)\n URID(XA_FORMATID[00000000] XA_GTRID[] XA_BQUAL[])\n URTYPE(QMGR)\n\n1 MQSC commands read.\nOne command has a syntax error.\nAll valid MQSC commands were processed.You can also do this programmatically from Java or C using PCF commands but since you specified \"from the UI\" I'm guessing this is not what you need.The DIS QS command is described more fully here:http://bit.ly/WMQdisQSIf you need the WMQ Explorer, that is here:http://bit.ly/SupportPacMQC7\n"}
+{"text": "### Human: I have a general question about the JMS createQueue method. In WebSphere MQ is this method used as an alternative to the JNDI lookup? I was thinking that I could dynamically create a queue. Is this possible? Thank you.### Assistant: Assuming you meanQueueSession.createQueue, this is a very misleading method, and doesn't do what you might think:Creates a queue identity given a Queue\n name.This facility is provided for the rare\n cases where clients need to\n dynamically manipulate queue identity.\n It allows the creation of a queue\n identity with a provider-specific\n name. Clients that depend on this\n ability are not portable.Note that this method is not for\n creating the physical queue. The\n physical creation of queues is an\n administrative task and is not to be\n initiated by the JMS API. The one\n exception is the creation of temporary\n queues, which is accomplished with the\n createTemporaryQueue method.The JMS API does not provide a way of dynamically creating queues (unless you mean temporary queues, which are a very different beast used by request-response messaging). If you want to create queues are runtime, that's going to be proprietary to WebSphere.\n"}
+{"text": "### Human: Has anyone worked with MQ from RPG?\nThe problem is as follows. There are several messages in the queue. All of them are with RFH2 header. Each header contains a set of NameValueData.\nI am creating a Message Handle and passing it to MQGET. Then I retrieve Properties using MQINQMP.\nQuestion. When I read several messages in a loop, using the same Message Handle instance for all (without freeing it and re-creating it for each message), will I have memory leaks?### Assistant: The IBM MQ Message Properties API is designed to be used in the following way.MQOPEN\nMQCRTMH\n\nstart-loop\n\nMQGET\nMQINQMP\n\nend-loop\n\nMQCLOSE\nMQDLTMHYou can see this demonstrated in the IBM supplied 'C' sample amqsbcg0.c. I know your question is for RPG, but the underlying API is meant to work the same for all languages.\n"}
+{"text": "### Human: I have done an SSL configuration for my IBM MQ v9, created a Java client, and added the certificates both sides. A Put and Get messages works fine. My issue is I'm able to browse the message using the MQ Explorer in the server. Is it because the message is decrypted and shown? Can I keep this message encrypted to a MQ Admin user who has access to the MQ explorer.Any advice is very much appreciated.Thanks in advance,Yasothar### Assistant: Configuring encryption at the channel level only encrypts data in motion (on the network).Messages on a queue are not encrypted unless you do this at the application layer or use the IBM MQ Advanced Message Security (AMS) extension of the product, this requires additional configuration with different certs to represent the putting and getting applications as well as policies to tell MQ AMS what to encrypt and who can receive.Even with IBM MQ AMS configured, someone with MQ admin authority can still override configurations to allow viewing of messages sent, since the the MQ admin controls the policy, so can easily add themselfs as a new recipient so they can also view message that are sent.\n"}
+{"text": "### Human: I am using this example from IBM. I have just copied and pasted the code:https://github.com/ibm-messaging/mq-dev-patterns/blob/master/dotnet/dotNetGet.csI am connecting to a MQ Server version 9.0.0.5I am using a console application .Net Framework 4.6.1The MQ client installed in my local machines is 9.1.0.1I can see a very strange behavior. The application run normally and it is able to get messages. But it would disconnect after exactly 10 minutes. It is always 10 minutes.This is the error catched:IBM.XMS.IllegalStateException: Failed to get a message from destination MY_QUEUE.\nIBM MQ classes for XMS attempted to perform an MQGET; however IBM MQ reported an error.\nUse the linked exception to determine the cause of this error.\n at IBM.XMS.Client.Impl.XmsMessageConsumerImpl.ReceiveInboundMessage(Int64 timeout)\n at IBM.XMS.Client.Impl.XmsMessageConsumerImpl.Receive(Int64 millis)\n at Mq_Get_Tests.SimpleConsumer.ReceiveMessages() in C:\\Users\\osotorrio\\Projects\\Temporal\\Mq_Get_Tests\\Mq_Get_Tests\\SimpleConsumer.cs:line 137\nLinked Exception : CompCode: 2, Reason: 2009*Is the IBM example missing some configuration settings to allow the client to reconnect after 10 minutes of inactivity?### Assistant: The symptoms you describe appear to be a match for APARIT26614: MQ dotnet (.NET) client channel ends abnormally when the heartbeat (HBINT) is reached.The fix is targeted for delivery in the following PTFs:\n\nVersion Maintenance Level\nv8.0 8.0.0.13\nv9.0 LTS 9.0.0.7\nv9.1 CD 9.1.3\nv9.1 LTS 9.1.0.3As of August 7th 2019 9.0.0.7 and 9.1.0.3 have been released and can be downloaded fromMQC9: IBM MQ V9 ClientsorMQC91: IBM MQ ClientsTo give some background on how things are supposed to work:A MQ client application when it connect to the queue manager will negotiate a heartbeat interval (HBINT) which is a value in seconds. The negotiatedHBINTis always the highest value negotiated between theSVRCONNand the client application.Note:ASVRCONNHBINThas a default value of300.Based on theHBINT, a TIMEOUT is calculated in one of two ways:If the negotiatedHBINTis less than 60 the TIMEOUT is 2xHBINT. (the received timeout is HBINT seconds after the HBINT has passed)If the negotiatedHBINTis greater than or equal to 60 the TIMEOUT isHBINT+ 60. (the receive timeout is 60 seconds after the HBINT has passed).If no normal traffic has been received from the queue manager in theHBINTamount of time the client should send a Heart Beat to the queue manager which should respond. The client should wait the receive timeout amount of time for the Heart Beat to be received.The queue manager can also initiate a Heart Beat to the client, but to prevent extra traffic the queue manager waits five seconds more than the negotiatedHBINTbefore sending a Heart Beat to the client.APAR IT26614 corrects the following three issues:In either Unmanaged or Managed mode it is documented that if you are not using a CCDT theHBINTwill use the value of theSVRCONNchannel. In reality if not using a CCDT theHBINTon the client side defaults to300so this is the lowestHBINTyou will see.Specific to Managed .NET the client sideHBINTcannot be lower than theSVRCONNHBINTthe connection will fail with a 2059. This problem impacts both with or without CCDT.with a CCDT you are unable to set theCLNTCONNHBINTto a value less than theSVRCONNHBINTwithout a CCDT you will be impacted if theSVRCONNHBINTis set to301or higher\nSpecific to Managed .NET the client side receive timeout was being calculated in milliseconds not seconds. In this case the defect has been present according to IBM for a long time, but did not present itself until APARIT16167: Managed .NET client application does not send heartbeat request to queue managerwas introduced in 8.0.0.10 and 9.0.0.4 (IBM also confirmed this is present in GA 9.1.0.0). The reason it was not previously a problem was that Managed .NET was never initiating the Heart Beat, the queue manager would always send the Heart Beat at HBINT + 5 seconds and the .NET client would respond. Once this was corrected, the miscalculation of the receive timeout presented itself.Based on Managed XMS.NET client version 9.1.0.1 this is what I suspect is happening:The HBINT is negotiated to 300 seconds no matter what the SVRCONN HBINT has set.The Managed XMS.NET client will send a Heart Beat to the queue manager after having not received anything from the queue manager for 300 seconds.At this point the Managed XMS.NET client will only wait 60ms for a response from the queue manager.If the Managed XMS.NET client does not receive a response in 60ms it will return a 2009 error to the application.The queue manager error logs will show a AMQ9209 with \"An error occurred receiving data from 'dnsname (xx.xx.xx.xx)' over TCP/IP.You mention seeing this only at 10 minutes (600 seconds), but I have seen it at any 300 second interval based on the latency of the network. If you are connecting to a queue manager on the same server or in the same local network segment you may never see this problem. If you are connecting over a high latency WAN circuit it may be experienced every 300 seconds. If you are connected over a segment with close to 30ms latency you may see it intermittently.I suggest you try out the 9.0.0.7 or 9.1.0.3 Managed XMS.NET client and see if it resolves the problem for you since at these releases it will wait a full 60 seconds for the Heart Beat response from the queue manager.If you want to add reconnect to the sample which would mask the issue if not using a version of MQ that includes APAR IT26614, you can use the following settings:cf.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, XMSC.WMQ_CLIENT_RECONNECT);\ncf.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT_DEFAULT);\n//Note that XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT_DEFAULT is 1800Note even if you use a version of MQ with APAR IT26614, the above is a good practice as it will tell the Managed XMS.NET client to automatically attempt to reconnect to the queue manager forXMSC.WMQ_CLIENT_RECONNECT_TIMEOUTseconds if the connection is lost. Reconnect does not apply to the initial connection to the queue manager, it only applies after you are connected.\n"}
+{"text": "### Human: Basically, I was given a task at work that involves using IBM MQ and C#, and while I am good with C#, I am a total newbie when it comes to Network programming and IBM MQ (As in I barely started using IBM MQ yesterday).Anyway, after reading through a lot of guides, and examples, and troubleshooting a lot of stuff I managed to make a C# solution that connects to a QueueManager, and successfully sends and reads messages. However, I only managed to do so by disabling the default Authorisation, and while that was good when all I needed to do was test my Adapter class, I now need to be able to specify an User Id and a Password, and eventually restore all the Authorisation settings I disabled.Here is the problem though, whenever I try to add the USER_ID_PROPERTY property to the connectionProperties Hashtable the QMQueueManager constructor returns a Null reference System Exception.Here is the code where I build the Hashtable;Hashtable connectionProperties = new Hashtable();\n\n // Add the connection type\n connectionProperties.Add(MQC.TRANSPORT_PROPERTY, connectionType);\n\n // Set up the rest of the connection properties, based on the connection type requested\n switch (connectionType) {\n\n case MQC.TRANSPORT_MQSERIES_BINDINGS: break;\n\n case MQC.TRANSPORT_MQSERIES_CLIENT:\n case MQC.TRANSPORT_MQSERIES_XACLIENT:\n case MQC.TRANSPORT_MQSERIES_MANAGED:\n //connectionProperties.Add(MQC.USER_ID_PROPERTY, \"newUser\");\n connectionProperties.Add(MQC.HOST_NAME_PROPERTY, hostName);\n connectionProperties.Add(MQC.PORT_PROPERTY, 1421);\n connectionProperties.Add(MQC.CHANNEL_PROPERTY, channel);\n connectionProperties.Add(MQC.CONNECTION_NAME_PROPERTY, connectionName);\n break;\n\n default:\n Console.WriteLine(connectionType + \" is not a valid connection type\");\n break;\n }\n\n return connectionProperties;If I run the code as is, everything works out fine, I get connected to the Queue, send, read, and disconnect without an issue, the moment I uncomment the Use ID line, I get a Null Reference System Exception on the following line;qmQueueManager = new MQQueueManager(qManager, connectionProperties);This is the exception message that pops up:A System error occurred: System.NullReferenceException: Object reference not set to object instance.\n At IBM.WMQ.MQQueueManager.Connect (String queueManagerName)\n At IBM.WMQ.MQQueueManager..ctor (String queueManagerName, Hashtable properties)\n At MQNetworkClient.MQManager.ConnectMQ (String details) Location C: \\ Users \\ A440 \\ Documents \\ Visual Studio 2017 \\ Projects \\ MQNetworkClient \\ MQNetworkClient \\ MQManager.cs: Line 124\n At MQNetworkClient.MQManager.TryMQAction (MQSanityCheck sanityCheck, MQActionHandler mqAction, String details, String sanityFailMessage) Location C: \\ Users \\ A440 \\ Documents \\ Visual Studio 2017 \\ Projects \\ MQNetworkClient \\ MQNetworkClient \\ MQManager.cs: Line 95The error message doesn't give me much to go on, and while I checked the QueueManager's AMQError Logs but nothing gets written there.I would really appreciate any solution, work-around, or any help tracing the issue, basically, I would grateful to get any kind of advice that could potentially point me towards the right direction here.In case it is somehow relevant, I am usingIBM MQ v9, and Visual Studio 2017.Thank you.### Assistant: This is a product defect (I've also raised it as such). Basically if you provide a userid you MUST provide a password as the code dereferences the password field without first checking it is supplied... Sorry!\n"}
+{"text": "### Human: I am new toIBM WebSphere MQ. I am running it within adockercontainer. The user 'sampleuser' and 'root' are part of the 'mqm' group within the conatiner. I am able to access the MQ from the host as a 'root' user and as a 'sampleuser' (I created 'sampleuser' in the host aswell).I want to enable anonymous authentication, so that irrrespective of the client user id, they should be able to access the MQ. I thoughMCAUSER('sampleuser')would do it for me. But it does't work. I get error AMQ4036 (not authorized) from the eclipse IBM explorer. Please advice.ALTER QMGR PSNPRES(SAFE)\nALTER QMGR PSMODE (ENABLED)\nDEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN) MCAUSER('sampleuser') REPLACEUpdate #1I updated the code to allow privileged user. But still fails.ALTER QMGR PSNPRES(SAFE)\nALTER QMGR PSMODE (ENABLED)\n\nSET CHLAUTH(*) TYPE(BLOCKUSER) USERLIST('*NOACCESS')\n\nDEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN) MCAUSER('sampleuser') REPLACEHere is the log, that I have got.EXPLANATION:\nThe user ID 'sampleuser' and its password were checked because the user ID is\nprivileged and the queue manager connection authority (CONNAUTH) configuration\nrefers to an authentication information (AUTHINFO) object named\n'SYSTEM.DEFAULT.AUTHINFO.IDPWOS' with CHCKCLNT(REQDADM). \n\nThis message accompanies a previous error to clarify the reason for the user ID\nand password check.\nACTION:\nRefer to the previous error for more information. \n\nEnsure that a password is specified by the client application and that the\npassword is correct for the user ID. The authentication configuration of the\nqueue manager connection determines the user ID repository. For example, the\nlocal operating system user database or an LDAP server. \n\nTo avoid the authentication check, you can either use an unprivileged user ID\nor amend the authentication configuration of the queue manager. You can amend\nthe CHCKCLNT attribute in the CHLAUTH record, but you should generally not\nallow unauthenticated remote access.Update #2Based on JohnMC's answer and refernce toProvide anonymous access to IBM WebSphere MQI finally made it work.. : )ALTER QMGR PSNPRES(SAFE)\nALTER QMGR PSMODE (ENABLED)\nALTER QMGR CHLAUTH(DISABLED)\nSET CHLAUTH(*) TYPE(BLOCKUSER) USERLIST('*NOACCESS')\nDEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN) MCAUSER('sampleuser') REPLACE\nALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) CHCKCLNT(OPTIONAL)\nREFRESH SECURITY TYPE(CONNAUTH)### Assistant: I will assume you are using a supported version of MQ (7.1 or later).With MQ 7.1 and later a new queue manager by default will come with a few CHLAUTH rules, one of these disables connections to SVRCONN channels from users with MQ administrative authority. In this case you have placed the usersampleuserin theMCAUSERof the channel. Sincesampleuseris a member of the mqm group it is disallowed by default.Based on the setup you present if the connection was allowed you would be allowing any user that can connect over the network to your MQ listener port the ability to manage the queue manager, define queues, delete queues, add permissions, etc.Look at this answer by T.Rob for some more detail on how to make this work without disabling security \"Unable to connect to queue manager in WebSphere MQ 7.1\".I also have another post with some similar information \"C# MQ Connect get Error 2035 but Java MQ Connect works well\"Update #1The logs show that you are getting a connection authentication error. With MQ 8.0 and later by default the queue manager is configured to require a valid password be specified for MQ Administrative users, sincesampleuseris part of the mqm group it falls into this category.You can configure MQ Explorer to send a username and password when connecting to the queue manager.Right click the queue manager nameSelect Connection DetailsSelect Properties...Select UseridCheck the box next to \"Enable user identification\"Fill in the Userid fieldIf you leave it as \"Prompt for password\" it will ask you each time you open MQ Explorer for the password when you attempt to connect to the queue manager. You have the option of selecting \"Use saved password\" and then providing the password.I do not recommend you do this, but if you want to disable security and allow anyone to connect as a MQ administrator to your queue manager with out providing a valid password you can disable this with the following command.ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) CHCKCLNT(OPTIONAL)\nREFRESH SECURITY TYPE(CONNAUTH)\n"}
+{"text": "### Human: As per our configuration, we have WAS version is 8.5.5.1, IBM MQ version 7.5.0.3. We are using 2 channels to connect to WMQ, one with MAXINST set to 250 and one with 500. SHARECNV is set to 10 for both. Now we have an upper limit of making maximum 1600 connections in a queue manager but we end up crossing that limit after 3-4 days of continuous running of WAS Server.I want to understand how parameters on WAS side affect this count. We are using Queue Connection Factory and Act Spec for making the connections and we have 23 of each of them. Out of these for 22 the settings in Act Spec and QCF are kept default like max server sessions=10, max connection in connection pool=10, max sessions in session pool set to 10. This services have quite low tps of around 15-20 request per minute. All 22 of them use same channel to connect to queue manager with MAXINST set to 250. 1 gets quite high load with peak of 80 requests per second(aprox 40 per server) for which max server sessions=40, max connection in connection pool=40, max sessions in session pool is set to 10.Connection Timeout, Reap Time, Unused Timeout and Aged timeout values are kept default for all.With these settings we end up making around 1200 connection on the channel used by 22 services and around 500 for the other channel after 2-3 days of continuous running. These build up over a period of time.\nNow I want to tune these settings so that we don't end up crossing the connection count limit and also don't end up having no connections available.\nSo I have a few questions:What is a better option from performance point of view- reducing max connections in connection pool or max sessions in sessions pool. What should be the ideal values for the load mentioned earlier.What should be the ideal value for Unused Timeout for Connection Pool and Session Pool which is set to 30 mins by default. If we reduce it to say 5 mins, what implications could it have on performance of failure to get the connections.Is there some setting that can be done at WMQ side so that the idle/unused connections are closed or this can happen only from the client side.DISCINT parameter value is set to zero and HBINT to 300. What should be the ideal value.I ran below command to view the connectionsecho \"DIS CONN(*) TYPE(*) CONNAME CHANNEL OBJNAME OBJTYPE\" | mqsc -e -m QM-p width=1000 | grep -o '^\\w\\+:\\|\\w\\+[(][^)]\\+[)]' | awk -F '[()]' -v OFS=\",\" 'function printValues() { if (\"CHANNEL\" in p) { print p[\"CHANNEL\"], p[\"CURSHCNV\"], p[\"CONNAME\"],p[\"CHSTADA\"],p[\"CHSTATI\"],p[\"LSTMSGDA\"],p[\"LSTMSGTI\"],p[\"OBJNAME\"],p[\"OBJTYPE\"],p[\"ASTATE\"] } } /^\\w+:/ { printValues(); delete p; next } { p[$1] = $2 } END { printValues() }' | grep MYCHANNEL\n\nMYCHANNEL,,10.215.161.65,,,,,,,NONE\nMYCHANNEL,,10.215.161.65,,,,,,,SUSPENDED\n MYCHANNEL,,10.215.161.65,,,,,MYQUEUE01,QUEUE,ACTIVEI can see a lot of connection in None and suspended state which do not have any OBJNAME or OBJTYPE associated.\nI have tried simulating the issue in Test and same thing happens and these connections keeps on increasing as we keep in hitting requests. Can someone tell me why these connections are getting created. Also it looks like these connections will never be used by the application.This is how connection are made and closed in the application:\nWe have an abstrack bean class which is extended by all MDB's@MessageDriven(activationConfig = {\n @ActivationConfigProperty(propertyName = \"acknowledgeMode\", propertyValue = \"Auto-acknowledge\"),\n @ActivationConfigProperty(propertyName = \"destinationType\", propertyValue = \"javax.jms.Queue\") })\npublic class TrackBeanV2 extends AbstractServiceBean implements MessageListener {//code}The abstrack bean handles creation and closing of connections in following manner:public abstract class AbstractServiceBean {\n\n@Resource(name = \"myQCF\", type = QueueConnectionFactory.class, shareable = true, description = \"Reply Connection Factory\")\nprivate ConnectionFactory replyCF; \n\n@PostConstruct\nprivate void postConstruct() {\n replyConnection = replyCF.createConnection();\n\n } catch (JMSException e) {\n throw new RuntimeException(\"Failed to create JMS Connection\");\n }\n\n}\n@PreDestroy\nprivate void preDestroy() {\n try {\n replyConnection.close();\n } catch (JMSException e) {\n throw new RuntimeException(\"Failed to close JMS connection\", e);\n }\n}\n\nprivate void sendResponseMessage(String outputMessageText, String jmsMessageID , Destination replyDestination) {\n TextMessage replyMessage = null;\n try { \n createSession(); \n createProducer();\n replyMessage = createReplyMessage(outputMessageText , jmsMessageID); \n sendReply(replyMessage, replyDestination); \n closeProducer();\n closeSession();\n } catch (JMSException exp) {\n handleException(exp);\n }\n}\nprivate void createSession() throws JMSException{\n replySession = replyConnection.createSession(true, 0); \n}`\nprivate void createProducer() throws JMSException{ \n replyProducer = replySession.createProducer(null); \n}\n\nprivate void closeSession() throws JMSException {\n if (replySession != null) {\n replySession.close();\n }\n}\n\nprivate void closeProducer() throws JMSException{\n if (replyProducer != null) { \n replyProducer.close(); \n }\n} \nprivate void sendReply(TextMessage replyMessage, Destination replyDestination) throws JMSException { \n logMessages(replyMessage.getText(), \"RESPONSE MESSAGE\");\n replyProducer.send(replyDestination, replyMessage);\n}I have not added other methods of the class which marshalling/unmarshalling and other stuff.### Assistant: After doing lot more analysis and trying out different WAS and MQ settings, we ruled out any issue with configuration and code. While researching found following linkhttp://www-01.ibm.com/support/docview.wss?uid=swg21605479. The issue was with Wily Introscope tool used to monitor the WAS server, it was making connections with MQ and not releasing them. We removed the monitoring from the Server and it is working fine since then. Thanks everyone here for their support.\n"}
+{"text": "### Human: Where can I find the differences between the IBM MQ versions V8.0.0.5 and V9.0? I tried to look it up on IBM website but no luck.### Assistant: IBM's v9 Knowledge center page \"What's new in Version 9.0.0\" lists new things in v9.0.New family features\n are:Additional quality of protection for IBM MQ AMSWeb addressable access to the client channel definition table (CCDT)IBM MQ AMS supported in non-IBM JREs in Java clientsUpdated Resource Adapter for traditional WebSphere Application ServerEnhanced Unicode data conversion supportIBM MQ Managed File Transfer Protocol Bridge Agent logging enhancementsNew features for distributed platforms\n are:Performance monitoring API and enhanced activity trace available through publish/subscribe[Windows] LDAP authorization on Windows platforms[UNIX] runmqsc command line editor for UNIX platformsNew z/OS\u00ae features\n are:Data manager page set statisticsJMS support within CICS OSGI ServerJMS support within IMS ServerImproved control of messages by using message expiryIncreased number of active logsUsing IBM z/OSMF to automate IBM MQIBM's v9 Knowledge center page \"What's changed in Version 9.0.0\" lists what has changed.[V9.0.0.0]Changes to supported platformsFor IBM MQ Version 9.0, some changes are made to the platforms that\n are supported.[V9.0.0.0]Changes to commandsA number of commands have changed at IBM MQ Version 9.0[V9.0.0.0]Command level changes for Version 9.0The command level changes to 900 at IBM MQ Version 9.0[V9.0.0.0]Deprecated, stabilized and removed featuresA number of features are deprecated, stabilized or removed from IBM MQ\n Version 9.0.[z/OS][V9.0.0.0]z/OS: Prerequisites for Version 9.0Some prerequisites have changed for Version 9.0.[z/OS][V9.0.0.0]z/OS: Changes to OPMODEIn previous versions of IBM MQ, if a queue manager was started with\n OPMODE=(COMPAT,vrm), new functions added at command level vrm would\n always be available. In IBM MQ Version 9.0 this is no longer the case.\n"}
+{"text": "### Human: I am running into an error when trying to download IBM Websphere MQ Explorer with the Eclipse Marketplace. The error reads:\n \"An error occurred while installing the items\n session context was:(profile=DefaultProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Install, operand=null -->[R]com.ibm.mq.explorer.doc 8.0.0.201506171824, action=).\n Failed to prepare partial IU: [R]com.ibm.mq.explorer.doc 8.0.0.201506171824.\"### Assistant: I haven't seen this error before and I don't normally dig into the guts of Eclipse so I do not have a good feel for what might be going wrong. But after some searching, I see this seems to be a fairly common error and I found a forum thread with a workaround. The solution has a lot of confirmation messages following it from people with a wide variety of modules who were able to complete their installs. Perhaps it will work for you.I'll quote the relevant bits and providethis linkto the source thread.So, go to Help -> Install New Software..., choose \"The Eclipse Project\n Updates -http://download.eclipse.org/eclipse/updates/4.4\" from the\n \"Work with\" list and then in the \"Eclipse Tests, Examples, and Extras\"\n category check \"Eclipse 2.0 Style Plugin Support\" and install it.\n After restarting Eclipse, install veloeclipse again and this time the\n installation will succeed.\n"}
+{"text": "### Human: I am using circular logging. Because of human intervention, one of the\nqueue files is corrupted.Since the circular logging is not having the ability of recovering the \ncorrupted queue files, what will be the next steps it will take?Will queue manager create an empty queue file for that queue and start\nenrolling the messages to it? Else, it will just show the pending\nmessages in the queue but not allow the applications to process?### Assistant: As you correctly note, MQ cannot recover from a damaged queue file when it is configured for circular logging.Will queue manager create an empty queue file for that queue and start enrolling the messages to it? Else, it will just show the pending messages in the queue but not allow the applications to process?None of the above. The queue manager will return an error to any process attempting to access that queue.When a queue file is damaged, it may or may not have had messages in it. There is no automatic recovery possible that would correctly reconcile the state of any messages that may have been enqueued, therefore no further processing is done on that queue and any access returns an error. Human intervention is required in that case and the fix is to delete and redefine the queue usingrunmqsc.If additional queue recovery is required to make sure messages are not lost in such cases, linear logging is mandatory.\n"}
+{"text": "### Human: My node.js code does this :var MyMQ = require( './build/release/mqconn' ) ;\nvar MyQmgrName = 'QM_CNT' ; // req.params.qmgrname ; \nMyMQ.connect ( MyQmgrName, function ( err, result ) {And my C++ code (uning nan) wants to receive the first string parameter :NAN_METHOD( MQ_Connect ) {\n\n NanScope();\n Local szQMN( args[ 0 ] );\n printf( \"(cc)>>>> qmn [%s].\\n\", szQMN ) ;... but what I get is garbage.Any clue on what am I doing wrong ?\nSebastian.### Assistant: First you should generally validate your arguments. Then you can get a string by callingToString()on the argument. For example:NAN_METHOD(MQ_Connect) {\n NanScope();\n\n if (args.Length() > 0) {\n if (args[0]->IsString()) {\n String::Utf8Value str(args[0]->ToString());\n printf(\"(cc)>>>> qmn [%s].\\n\", (const char*)(*str));\n }\n }\n"}
+{"text": "### Human: I have a problem on getting message id and set it on reply's correlation id.Here's the piece of code:MQBYTE msgID;\n\nrequest_msg.messageId().copyOut(msgID, MQ_MSG_ID_LENGTH, 0);\nresponse_msg.setCorrelationId(msgID);when I checked the correlation Id of the reply, the correlation id is 0.How can I copy/get the messageId of the request and put it on the correlation id of the reply?Thanks in advance. :)### Assistant: The Infocenter pageManipulating binary strings in C++shows the data types involved asImqBinaryandMQBYTE24. As Shashi notes in the comments,MQBYTEis a single byte and incapable of containing a 24-byte message ID. The page linked above provides a reference example:#include // C++ classes\n\nImqMessage message ;\nImqBinary id, correlationId ;\nMQBYTE24 byteId ;\n\ncorrelationId.set( byteId, sizeof( byteId ) ); // Set.\nid = message.id( ); // Assign.\nif ( correlationId == id ) { // Compare.\n ...One tool to diagnose issues like this is the very usefulSupportPac MA0Wwhich is an API exit. It can show you the exact contents of the structures passed to MQ before and after an API call. Very often what is seen is that what is expected (in this case having copied theMQMD.MsgIDto theMQMD.CorrelIDis not what actually happened. In this case, I believe a trace such as that provided by MA0W would reveal that themsgIDwas accurately passed from the app to MQ but consisted of only one character.UPDATEOP asks:Variableidis anImqBinaryandmessageis anImqMessageobject, from what I knowidis not a member ofImqMessagelikemessageId,correlationId,groupIdand etc. so how canmessage.id()passed it's value onid?You are coorrect thatidis a declared variable of typeImqBinaryand not a member of theImqMessageclass. Please see the Infocenter page for theImqBinary C++ classwhich explains that:This class encapsulates a binary byte array that can be used for\n ImqMessage accounting token, correlation id, and message id values. It\n allows easy assignment, copying, and comparison.The intent of theImqBinaryclass is to provide a variable type to encapsulate a byte array with overloaded methods such that \"normal\" variable manipulations work as expected. Rather than copying the byte array one byte at a time, it can be anLVALorRVALin an assignment. Rather than comparing the array a byte at a time, you can just use comparison operators like==.So if your code were modified to use the example, it might look like this:#include // C++ classes\n\nImqMessage request_msg, response_msg ;\nImqBinary id ;\n\nid = request_msg.id( );\nresponse_msg.setCorrelationId(id);That said, I'm not sure you even need an intermediate variable. You might be able to assign the correlation ID using the output of the getter call for the message ID from the source message. Something like....response_msg.setCorrelationId( request_msg.id( ) );...might do it. I don't code C or C++ anymore so I probably got the syntax wrong or didn't do it as elegantly as it might be coded, but you should get the idea.\n"}
+{"text": "### Human: I want to run a test command on MQ Server Windows Machine remotely. In order to do that, I useSupportPac MO72and I can successfully connect remotely to MQ Server with Administrator ID. Now I have MQSC console available and I want to run some OS command with creatingSERVICEobject. I defined my service as:DEFINE SERVICE('myService') STARTCMD('C:\\Windows\\System32\\PING.EXE 127.0.0.1') SERVTYPE(SERVER) CONTROL(MANUAL)The service was created successfully and now I want to start this service, so I typed:START SERVICE(myService)But I got this error:AMQ8734- Command failed - Program could not be startedAny idea?### Assistant: There's a combination of things wrong...YourSERVTYPE(SERVER)is for something which starts running and stays running (and hence whose health is monitored).SERVTYPE(COMMAND)is for something you run and ends. Only aSERVTYPE(SERVER)can be monitored for health but it ought to be long running.Yourstartcmdneeds to be a binary to launch - just the binary. TheSTARTARGSneed to hold the arguments to the command.DEFINE SERVICE('myService') + \n STARTCMD('C:\\Windows\\System32\\PING.EXE') + \n STARTARG('127.0.0.1') + \n SERVTYPE(COMMAND) + \n CONTROL(MANUAL)Of course, you might like to see its output - look at the args likeSTDOUTandSTDERRto capture output into a file.If you want the output to come back to your remote client in a queue it gets a bit more complicated. You would have to capture the output and pipe it throughamqsputor some other program to get it onto a queue, then retrieve it. The queue cannot be the same reply queue you are using with MO72 because MO72 would choke on the text, so you would have to useamqsgetcor some other program to fetch the output from the queue.\n"}
+{"text": "### Human: My current setup consists of one queue, the InQueue, called \"QONE\". QONE then has 6 other queues that it sends messages to. Each of these subsequent queues has a selector on it which accepts messages based on a regular expression.There is a situation where I want to ignore a message completely. Meaning, when QONE gets a message matching a specific pattern, do not send the message down to any other queue. Instead we want to disregard the message.Can I put a selector on QONE which will serve to filter out the unwanted messages? For example, if the unwanted message is sent to QONE it will know not to send it down to any subsequent queues based on the selector's pattern.I want to avoid adding to the selectors of the subsequent queues, though I know this is an option. I'd rather remove the message at the root rather then the downstream queues. Thank you.### Assistant: The most efficient way of implementing this would be to ensure the application on QONE, which forwards the messages on to the other six queues, reads all the messages and by looking at each message, either forwards it, or does whatever should happen to these messages you want to ignore (are you planning to simply discard them, or place them on a side queue out of the way?). If the application on QONE correctly only forwards the required messages, then no selectors are required on the downstream queues.\n"}
+{"text": "### Human: I want to check if anychlauthmethod is deployed for a channel or not in my MQ. So I run this command:dis chlauth(MY.CHANNEL.NAME)But I've got this message:AMQ8884: Channel authentication record not found.So, does it mean that I run a wrong command or it means that this channel has no channel authentication mechanism?### Assistant: SinceCHLAUTHrules can be put in place either with fully spelled out channel names, or with wild carded profiles, there are a few different ways to display theCHLAUTHrules in the system.In this case the best way to determine whether there is a rule that will apply to your channel when it runs is to use the following command:DISPLAY CHLAUTH(MY.CHANNEL.NAME) +\n MATCH(RUNCHECK) +\n ADDRESS(IP-address) +\n CLNTUSER(client-side-UserID)You can read more about this approach inI'm being blocked by CHLAUTH - how can I work out why?\n"}
+{"text": "### Human: I want to check all the authorities and access levels of queues and channels in my MQ-manager and check if there is a client queue or channel with administrative access. In order to do that I used./dmpmqautcommand and I successfully dumped all the objects' authorities. However, I have two problems here:1- There are a lot of objects in my Q-manager which has the entity ofmqmand their authority is set to:almqi dlt chg dsp clr. So is this normal? I mean all I know is that the clients should not havemqmentity name and the authorities are not restricted at all here. Am I right?2- I want to check all the channels and queuesMCAUSERlike what I can see in MQ-Explorer on windows. Is there any way that I can check it in Linux machine?### Assistant: Whenever an MQ object is created, the user who created it (or that user's primary group in non-Windows Distributed platforms) is granted all rights to the object. In practice, this usually means that the mqm group is visible on every object when you do an auths dump. On windows, this is oftenadminID@domainin addition to mqm.On Linux you can do...echo \"dis chl(*) mcauser | runmqsc [qmgrname]...from the command line to see what the MCAUSER is on the channels. You can also see this using MQ Explorer.The defined MCAUSER for all inbound channels should be one that blocks all access. I used to recommendnobodybut since this is potentially a valid ID on some systems, I now recommend*nobody. Note that by \"inbound channels\" I mean those of typeRCVR,RQSTR,CLUSRCVR, andSVRCONN. By \"all\" I mean channels namedSYSTEM.AUTO.*,SYSTEM.DEF.*, and any that you define yourself.Make sure that an exit or aCHLAUTHrule maps the MCAUSER to the expected value when the connection request is authenticated. TheCHLAUTHrules are available on any version of MQ from 7.1 on up. This mapping ensures that only an authenticated user or partner QMgr can connect.If authorizations (setmqautorSET AUTHRECcommands) are defined without also defining theCHLAUTHrules or setting up a security exit, the effect isworsesecurity, not better. The reason being that legitimate users willappearto have restrictions placed on their connection but malicious users will be able to easily spoof an administrative user ID.Please see the basic MQ Security Hardening slides athttp://t-rob./net/linksfor more on this topic.\n"}
+{"text": "### Human: I'm trying to write a simple test case to pull messages from a queue based on a message property, hitting a 7.5.0.3 QMgr and using the 7.5.0.3 client jars.Everything I have seen online says that I need to specify the message selector when I open the queue. I'm fine with that, but I only see two ways to open it:MQQueueManager.accessQueue(\n String queueName, \n int openOptions);\n\nMQQueueManager.accessQueue(\n String queueName, \n int openOptions, \n String queueMgr, \n String dynamicQueueName, \n String altUserId);Neither of these allow me to specify a message selector. I'm running this from a command line batch application, not in an app server, so using JMS selectors is not possible.Here is the IBM documentation on selectors:WebSphere MQ Message Selectorswhich shows that selection must happen as part of the MQOPEN call.### Assistant: MQ JMS API provides the type of message selection syntax you are looking for. The base MQ Java API provides message selection based on MessageId and CorrelationId and it does not yet provide type selection syntax you are looking for. The documentation link you provided is for MQ C API.Using MQ JMS API, message selection can be done as shown here:// Create JMS objects\n connection = cf.createConnection();\n session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n\n // Create queue destination \n Destination queDest= session.createQueue(que);\n\n // Create consumer with selector\n String selector = \"category='bucket1'\"; \n MessageConsumer cons= session.createConsumer(queDest, selector);\n\n connection.start();\n // receive messages\n Message inMessage = cons.receive(5000);\n"}
+{"text": "### Human: I need to change theCONNAME('xx.xx.xxx.xx(1414)toCONNAME('yy.yy.yyy.yy(1414)for IBM MQ. I searched through the internet I did not found any command. My object definition code is given below.DEFINE CHANNEL(CHANNELNAME) +\n CHLTYPE(SDR) +\n TRPTYPE(TCP) +\n MAXMSGL(30000000) +\n DESCR('Channel to REPLY TO sender') +\n XMITQ('Sender.XMITQ') +\n CONNAME('xx.xx.xxx.xx(1414)') +\n BATCHSZ(50) +\n DISCINT(6000) +\n SHORTRTY(10) +\n SHORTTMR(60) +\n LONGRTY(999999999) +\n KAINT(AUTO) +\n LONGTMR(1200) +\n SEQWRAP(999999999) +\n CONVERT(YES) +\n MCATYPE(PROCESS) +\n HBINT(300) +\n BATCHINT(0) +\n NPMSPEED(FAST)Can I use theALTERcommand? if I delete the channel and redefine it will it cause any problem to existing channels and queues?### Assistant: You can use theALTER CHANNELcommand like this:-ALTER CHANNEL(CHANNELNAME) CHLTYPE(SDR) CONNAME('yy.yy.yyy.yy(1414)')You only need to supply the attributes that you need to change, plus always theCHLTYPE.You don't need toDELETEand re-DEFINEthe channel object, and doing so would cause the run-time state such as channel sequence numbers to get out of step.Additional ReadingALTER CHANNEL reference documentation\n"}
+{"text": "### Human: I'm using Spring's JMS (v. 3.1.2)listener-containerwith a JMS connectionFactory coming from WebSphere 7's JNDI settings. The application processes messages (put/get) correctly, but thebackoutsettings set in the MQ Queue Manager don't seem to work.To fail a message consumption, I use spring transactions with asetRollbackOnly(), and it does increase the property \"Backout count\" as I can see that number increasing with the \"WebSphere MQ Explorer\" pointed to the remote queue.Reading through a few IBM docs, it describes that the IBM MQ JMSclientneeds to move the bad message to the backout queue. Spring'slistener-containerdoesn't seem to be using the MQ client in a way that enables that behaviour. The backout count just keeps increasing, as if the requeue command wasn't working.Is Spring JMS able to use that functionality? Is there anything that needs to be set in thelistener-containerfor it to be able to process the move to IBM MQ backout queues?My configuration is as follows:\n\n\n \n \n \nThe IBM MQ queue is set up with \"Backout Requeue Queue\" set toONEQUEUE.BOQ, and \"Backout Threshold\" to5.My Spring message driven POJO java code is as follows:@Transactional\npublic class MyQueueMDBean implements javax.jms.MessageListener {\n public void onMessage(javax.jms.Message msg) {\n try {\n // some code that throws some exception ...\n } catch (Exception e) {\n TransactionInterceptor.currentTransactionStatus().setRollbackOnly(); \n }\n }\n}The Stacktrace ERRORAfter the message has been rolled back 5 times, the listener starts failing to connect, as output to the logs:[org.springframework.jms.listener.DefaultMessageListenerContainer#3-14870] WARN org.springframework.jms.listener.DefaultMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'ONEQUEUE' - trying to recover. Cause: MQJMS1079: Unable to write message to dead letter queue.; nested exception is com.ibm.mq.MQException: MQJE001:Completion Code '2', Reason '2035'.It looks like something is going on with the permission to backout the message, or the actual backout queue is not being retrieved correctly, which was unexpected since the get/puts were working OK. Still looking for an answer whether this is a valid approach though.### Assistant: JMS Client will put poison messages to the backout queue defined on the queue's BackoutRequeueQueue (BOQNAME) after the number of roll backs exceeds that defined in the BackoutThreshold (BOTHRESH). This means that the user running the JMS application not only needs access to the application queue, it also needs access to put to the named backout queue too.If the backout queue cannot be accessed or is not defined, the queue manager's dead letter queue (DEADQ attribute) will attempt to be used.Failure to grant the user ID+putaccess to the backout queue and/or the DLQ will result in a MQRC_NOT_AUTHORIZED (2035) reason code when a poison message meets the criteria to be requeued to the backout queue.The 2035 will be reported by the JMS exceptions, and the exact missing authorities on the exact queue name for the exact user ID will be reported in the queue manager error log.Related ReadingHandling poison messages in WebSphere MQ classes for JMS\n"}
+{"text": "### Human: I have an application that I'd like to consume messages from queue A, but if queue A is empty, I'd like it to consume messages from queue B instead of sitting idle. I only ever want it to process 1 message at a time, and if the consumer is busy processing a message (from either queue), other pending messages (on either queue) should remain on their queue until the consumer is idle again (this gives other consumers a chance to process the new message).So, for example, if a message arrives on either queue A or queue B while the consumer is idle (waiting), then the consumer picks it up. If a message arrives on either queue while the consumer is currently processing a message, nothing happens until the consumer has finished processing the current message. And if a message is available on both queue A and queue B, the consumer prefers to pick the message from queue A.Edit: actually I'd be equally happy to be informed that messages are available to consume on both A & B, and implement my own logic to choose which one I actually want to pull from the queue.Subscribing to both queues at once in separate threads doesn't appear to work because:if a messageMarrives on queue A, the consumer will have to unsubscribe from queue B while it's processing messageM, then resubscribe once messageMis handled. Otherwise, \nif a message arrives on queue B, it might get picked up and dispatched simultaneously - I don't want to handle more than one message at a time.if a message arrives on both queues at once (or a message is already available on both queues when the consumer starts up or finishes processing the previous message), then it's possible that both messages will be picked up before the consumer has the chance to unsubscribe from queue B. If this happens I'd have to roll one of the messages back, but if this happens frequently the message will exceed the rollback count and get moved to a failure queue.Ideally I'd like to generalise this to the N queues case. I'm interested in solutions that ideally work via JMS, but if I have to use the IBM MQ-specific API to do this that's OK too. Is there a usage pattern, or library, that will help achieve this? Are there alternative queueing approaches/techniques/technologies that allow it?Pulling all messages off all queues and putting them onto a single queue is a no-go; we need to be able to clear individual queues independently, and different consumers may subscribe to different subsets of the N queues.### Assistant: I don't know if this will be a big change for your code, but have you thought of adding Spring Framework and especially Spring Integration in your project? Such issues as you describe are already handled there.This problem would be solved with two endpoints with event driven consumers on the two queues and a single thread pool.http://www.eaipatterns.com/EventDrivenConsumer.htmlhttp://en.wikipedia.org/wiki/Thread_pool_pattern[Edit]If you want the message to stay in the Queue until the thread is released you can follow the pattern of polling consumerhttp://www.eaipatterns.com/PollingConsumer.htmlwhich can chose as you wish from which queue to request a message first. Keep in mind that with this technique if your system processes messages faster than they arrive, you will experience some redundant polls to the queues.\n"}
+{"text": "### Human: This code sends the message to Q. MQEnvironment static values are set . But MQEnvironment isnot referencedanywhere in the manager. Then how the properties (hostname, channel,port,CCSID) are provided to connect to MQ?MQEnvironment.hostname =\"10.XX.XXX.XX\";\n\n MQEnvironment.channel = \"SYSTEM.DEF.SVRCONN\";\n\n MQEnvironment.port = 1415;\n\n MQEnvironment.CCSID = 819;\n\n System.out.println(\"connecting MQQueueManager...\");\n try {\n MQQueueManager manager = new MQQueueManager(\"SXX\");\n\n MQQueue queue = null;\n\n int openOptions = MQC.MQOO_OUTPUT; //MQC.MQOO_INPUT_AS_Q_DEF |\n\n queue = manager.accessQueue(\"Q_NAME\",\n openOptions,\n null, null, null);\n // send message\n MQMessage sendMessage = new MQMessage();\n\n sendMessage.writeObject(\"TEST MESSAGE@@@@@@@@@@@@@@@@@\");\n MQPutMessageOptions pmo = new MQPutMessageOptions();\n\n queue.put(sendMessage, pmo);### Assistant: The MQQueueManager object checks to see if those values have been set in the MQEnvironment class before it makes a connection to the queue manager.Also, do NOT use the SYSTEM.DEF.SVRCONN channel as (1) it is against best practices and (2) it is a SYSTEM object that is ONLY to be used by the queue manager. Simply create or have the MQAdmin create a SVRCONN channel for you. i.e. TEST.CHL\n"}
+{"text": "### Human: I'm in the process of converting a manual server provisioning process into a Ansible playbook. Part of the process involves installing WebSphere MQ client. One step involves manually running a script,mqlicense.sh, and accepting a licensing agreement in response to a prompt. How can I accomplish this in Ansible?If I run the script, the ansible process hangs. If I skip that step, I get the following error:ERROR: Product cannot be installed until the license\n agreement has been accepted.\n Run the 'mqlicense' script, which is in the root\n directory of the install media, or see the\n Quick Beginnings book for more information.UpdateFurther Googling brought me tothis ibm.com page, where it states:If want to accept the license without it being displayed, you can run\n the mqlicense.sh script with the -accept option../mqlicense.sh -acceptHowever, that does not seem to work in my case. When I run that command from the command line, the interactive prompt still comes up.### Assistant: The issue turned out to be with the mqlicense.sh script. Apparently, it uses some syntax incompatible with bash. So when I ran it on my Debian server, the script complained:./mqlicense.sh: 99: ./mqlicense.sh: [[: not foundThe solution, alluded to inthis ibm.com forum thread, was to install the korn shell (ksh), and use that to accept the license. The following tasks were included in my playbook:Includekshwith system packages:- name: Install debian packages\n apt: pkg=${item} state=installed\n with_items:\n - alien\n - kshCall the script usingksh:# Need to run this with ksh; script syntax is not bash-compliant\n- name: Accept MQ Client license\n command: ksh mqlicense.sh -accept chdir=${vsphere_wd}Ansible playbook can be found here:https://gist.github.com/klenwell/cdf2dc92ddfe2e7e18fc\n"}
+{"text": "### Human: In trying to connect from an MQSeries 7.5 client to a 7.5 local server I'm getting a CSIException: JMSCS0002 which when I look up the error in the IBM codes says:JMSCS0002 \nThe call could not be completed because CommonServices has not been initialized.CommonServices is an internal component and needs to be initialized at startup but has failed.Check that the installation and classpath setup is correct.But both my compile and run classpaths include com.ibm.mq.commonservices.jar, com.ibm.msg.client.commonservices.jar, and com.ibm.msg.client.commonservices.j2se.jarI'm was using Oracle JDK 1.6. I tried using the WS MQ java but it made no difference.Any help appreciated. Thanks.Caused by: com.ibm.msg.client.commonservices.CSIException: JMSCS0002\nat com.ibm.msg.client.commonservices.workqueue.PIWorkQueueManager.enqueueItem(PIWorkQueueManager.java:67)\nat com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:225)\nat com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:194)\nat com.ibm.msg.client.wmq.common.internal.WMQThreadPool.enqueue(WMQThreadPool.java:91)### Assistant: I had been using jar files from an uninstalled MQSeries 7.5 Client because I wanted to make sure that the functionality I was using would work just with the jars provided by the free client license. According to IBM documentation taking uninstalled jars is problematic.When I switched to the jars from the installed server trial then things works ok.\n"}
+{"text": "### Human: One of the vendors that we trade MQ data with has a monitor that shows the following:I've written a C# monitor of my own that takes a snap shot of the queue depth every x minutes, but I would like to know how to get the number of message enqueued and dequeued. These two stats seem to me to be of a different nature. To me queue depth is at a given point in time. The report above is actually showing \"High Q Depth\" for a 5 minute time period.Can someone point me to something in the C#/.NET MQ API guide on how these statistics can be gathered? If not, what trick or tool might be able to get these stats?### Assistant: MQ .NET has undocumented \"support\" for PCF underIBM.WMQ.PCFnamespace. There are classes likePCFAgent, PCFMessageand so on. These can be used to read PCF messages.For statics monitoring, you can turn on \"Queue Statics\" on queue. As describedherequeue statics messages include information like number of messages put or retrieved from a queue.Sample code: This code inquires a queue manager for a queue with name Q1.public void InquireQmgr()\n {\n try\n {\n PCFMessageAgent messageAgent = new PCFMessageAgent(\"QM\");\n\n PCFMessage pcfMsg = new PCFMessage(MQC.MQCMD_INQUIRE_Q);\n pcfMsg.AddParameter(MQC.MQCA_Q_NAME, \"Q1\");\n\n PCFMessage[] pcfResponse = messageAgent.Send(pcfMsg);\n int pcfResponseLen = pcfResponse.Length;\n\n for (int pcfResponseIdx = 0; pcfResponseIdx < pcfResponseLen; pcfResponseIdx++) \n {\n PCFParameter [] parameters = pcfResponse[pcfResponseIdx].GetParameters();\n foreach(PCFParameter pm in parameters)\n {\n Console.WriteLine(pm.Parameter + \" - \" + pm.GetValue());\n } \n }\n messageAgent.Disconnect();\n }\n catch(MQException ex)\n {\n Console.Write(ex);\n }\n }\n"}
+{"text": "### Human: Having trouble with Ibm mq to load it in 64-bit windows machines.Dim objMQ As Object\nobjMQ=CreateObject(\"MQAX200.MQSession\")I get\"Cannot create ActiveX component.\"in 64-bit machines and it works fine in 32-bit machines OS.My question is how do i alter the above piece of code to work in 64-bit OS?### Assistant: On Windows 7 64 bit, that piece of code works fine for me. I am using MQ v7.1 though.Is there a specific reason you want to use MQAX200? There have been no updates to this interface for a long time. Instead of MQAX200, you can use the MQ .NET interface which is more up to date and has much more features than MQAX200.MQ .NET interface is shipped in \"amqmdnet.dll\" assembly and can be found in \"bin\" folder of your MQ installation. There is only one assembly that works for both 32 and 64 bit architecture. You just need to reference \"amqmdnet\" in your project. There are also number of samples under \"\\tools\\dotnet\\samples\\cs\\base\" folder.Edit: Sample code:properties = new Hashtable();\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n properties.Add(MQC.HOST_NAME_PROPERTY, hostName);\n properties.Add(MQC.PORT_PROPERTY, port);\n properties.Add(MQC.CHANNEL_PROPERTY, channelName);\n\n MQQueueManager queueManager = new MQQueueManager (queueManagerName,\n properties);\n queue = queueManager.AccessQueue(queueName, \n MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);\n"}
+{"text": "### Human: I have observed that when msg is read from the queue(destructive call) later if TX is rolled back(MDB container managed TX) msg are placed back to the queue(Original or back out queue depending the on backcount & threshold settings for queue). Lets say if something happens(Repeated Network issue or some issue) due to which rollback of TX got failed then Msgs are lost.Is it true??Thanks### Assistant: As I noted in the comments to the earlier question, the short answer is \"no, WMQ will not lose those messages if theCOMMITfails\" but let us look in a bit more detail.When the client makes a connection to MQ over the network, what happens under the covers is that MQ starts a process that creates a shared-memory connection to MQ and a socket connection to the client application. The thing holding the transaction open is the shared memory process which is called a 'channel agent' in WMQ terminology.There are two cases where theCOMMITappears from the application's perspective to have failed. In the first of these, theCOMMITis delivered to the channel agent and executed, but the acknowledgement never makes it back to the application due to a network problem. From MQ's perspective, the message is not 'lost' because the app intentionally committed theGETcalls.The second case is that the network failure occurs before theCOMMITarrives at the channel agent. In this case, theCOMMITtruly has failed because it is not possible for the app to recover the connection handle in which the transaction lives. When the channel agent realizes that the TCP connection has failed, it backs out the transaction and closes the channel. The wrinkle in this process is that it may take a while for the channel agent to realize that the connection has died. In fact, the default TCP timeout on most platforms is two hours. Depending on your server's TCP settings, the transactedGETmay hold that message under syncpoint for up to two hours, making it appear to have been consumed. This is one reason that using a current level of QMgr and client is highly recommended - they rely less on TCP and more on an internal channel heartbeat protocol to detect lost connections.From the application's perspective both of these cases appear to be the same - app callsCOMMITand gets back 2009MQRC_CONNECTION_BROKEN. But in the first case, the message is gone due to theCOMMITand in the second case, the message may be delivered again. Because of this ambiguity, the app must be able to detect and gracefully handle dupe messages.Now before declaring that this is a defect in MQ, let me point out that this ambiguity of outcomes is inherent when using messaging over the network and not anything specific to WebSphere MQ. In fact, theJMS 1.1 specificationaddresses this directly in 4.4.13 where it says:If a failure occurs between the time a client commits its work on a\n Session and the commit method returns, the client cannot determine if\n the transaction was committed or rolled back. The same ambiguity\n exists when a failure occurs between the non-transactional send of a\n PERSISTENT message and the return from the sending method.It is up to a JMS application to deal with this ambiguity. In some\n cases, this may cause a client to produce functionally duplicate\n messages.A message that is redelivered due to session recovery is not\n considered a duplicate message.So the use of syncpoint can eliminate the case of lost messages because anyGETmust be followed by aCOMMITin order to permanently remove the message from the queue. By definition, theCOMMITcannot arrive until the application has seen the message. However, syncpoint cannot eliminate the possibility of duplicate messages because if aCOMMITof aGETfails, the app may see the message again. Similarly, if theCOMMITof aPUTfails, the app has no way to know whether theCOMMITfailed before or after reaching the channel agent and has no choice but to reconnect andPUTthe message again.If in fact you are experiencing 'lost' messages, the possibilities are that:The putting app failed on theCOMMITbut did not put another copy of the message.TheGETting app failed on theCOMMITand the message is not lost but actually under syncpoint. In that case, stop any orphaned channels to roll back the transaction.Other than those two cases, WMQ will not lose that persistent message.\n"}
+{"text": "### Human: I'm getting below exception when i run my program as below,java -jar MQprogram.jarI have set classpath correctly which is referring to all required jars , \n\"com.ibm.mq.jmqi.jar\" also referred in classpath which has MQException.`Exception in thread \"main\" java.lang.NoClassDefFoundError: com/ibm/mq/MQException\nCaused by: java.lang.ClassNotFoundException: com.ibm.mq.MQException\n at java.net.URLClassLoader$1.run(Unknown Source)\n at java.security.AccessController.doPrivileged(Native Method)\n at java.net.URLClassLoader.findClass(Unknown Source)\n at java.lang.ClassLoader.loadClass(Unknown Source)\n at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)\n at java.lang.ClassLoader.loadClass(Unknown Source)\n at java.lang.ClassLoader.loadClassInternal(Unknown Source)\nCould not find the main class: com.test.bo.MQprogram. Program will exit.\n`I'm still unclear where the bug is.### Assistant: This is almost always caused by a combination of an incomplete client install and/or a CLASSPATH issue. Many people grab the jar files rather than performing the complete install and do not necessarily get all of them. Sometimes they just keep looking up jar files and grabbing them, without regard to different versions. IBM performed a major refactor of the Java/JMS classes as of V7.0 and made some updates since then as well. As of V7.0.1, WMQ can be installed to arbitrary directory paths and multiple installs on a server. This meant that there can now be multiple JRE/s, multiple client installs, etc. This didn't affect the CLASSPATH so much but did change dependencies such as NLS support, tracing and other things the Java classes depend on/interact with.The recommendation is to install a full WMQ client and point the CLASSPATH at the install directory. If that is not possible, then install a full clientsomewhereand grab the complere set of jars from the known-good installation. Then at least you know you have all the same version, etc.Should you decide to install the full client from IBM's distribution media, you get several additional capabilities such as diagnostics and low-level trace. It also assures that maintenance can be applied. For example, you have a problem that is corrected in a Fix Pack, you simply install the Fix Pack over top of the existing client install. The Fix Pack won't install if all you have are the jar files.The WMQ clients are available asSupportPacs. You can download one of the following:WMQ V7.0 Client ==SupportPac MQC7WMQ V7.1 Client ==SupportPac MQC71WMQ V7.5 Client ==SupportPac MQC75Be sure to use the Infocenter for the version of client you are using!WMQ V7.0 InfocenterWMQ V7.1 InfocenterWMQ V7.5 Infocenter\n"}
+{"text": "### Human: I have a .NET TransactionScope that needs to contain both a MSSQL database and a IBM MQ queue.I'm using .NET 4.0 (VS2010), SQL 2008R2, MQ Server 6.0, MQ Client 7.0.1.9 in fully managed mode. All components are running on different machines.From what I've found the following pattern should work:http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/index.jsp?topic=%2Fcom.ibm.mq.doc%2Fun11400_.htmImplicit Transaction\n The following piece of code describes how a WebSphere MQ .NET application puts a message using .NET implicit transaction\n programming.Using (TransactionScope scope = new TransactionScope ()) { Q.Put\n (putMsg,pmo); scope.Complete (); }Q.close(); qMgr.Disconect();}In my code this looks like:// mq properties\n properties = new Hashtable();\n properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n properties.Add(MQC.HOST_NAME_PROPERTY, HOSTNAME);\n properties.Add(MQC.PORT_PROPERTY, PORTNUMBER);\n properties.Add(MQC.CHANNEL_PROPERTY, CHANNELNAME);\n\n _queueManager = new MQQueueManager(queueManagerName, properties);\n _queue = _queueManager.AccessQueue(queueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);\n _gmo = new MQGetMessageOptions();\n _gmo.Options |= MQC.MQGMO_WAIT;\n _gmo.Options |= MQC.MQGMO_SYNCPOINT;\n _gmo.WaitInterval = 1000; // 1 seconds wait\n\n // in a loop\n using (TransactionScope t = new TransactionScope())\n {\n\n var message = new MQMessage();\n try\n {\n _queue.Get(message, _gmo);\n }\n catch (MQException mqe)\n { \n message = null;\n if (mqe.ReasonCode == 2033)\n {\n Console.WriteLine(\"No message available\");\n }\n else\n {\n throw;\n }\n }\n t.Complete();\n }\n\n//Afterwards:\n\n if (_queue != null)\n {\n _queue.Close();\n _queue = null;\n }\n if (_queueManager != null)\n {\n _queueManager.Disconnect();\n _queueManager.Close();\n _queueManager = null;\n }The problem with this is that all messages re-appear in the queue after the application is closed, while the work in the SQL database is committed.\nIf an exception happens inside the transactionscope, the SQL transaction rolls back while the messages in MQ appear to stay removed (until I restart the application).\nAlso, I don't see any DTC activity between the .NET client and the MQ server (is that expected?)I'm kind of lost here, any help is greatly appreciated.Which MQ client should I use? Managed, Unmanaged, XA ?Should I see DTC activity? How would I get the managed client to participate?Which objects should be created inside the transactionscope?Why do messages re-appear on the queue when the application ends even when I commit the transactionscope?UPDATEI've had this working with 7.1 on both client and server, but to get that (server) version deployed on our production environment would take too long.So I need to work with version 7.0.x on the server side, clientside I can use whatever I need.Connecting to a MQ6 server using the 7.1 client fails with errorcode 2354### Assistant: Well, you need to have at least WebSphere MQ v7.1, both client and queue manager, installed to run global transactions in fully managed mode using the TransactionScope. MS DTC will be the transaction coordinator in this case. The InfoCenter link you posted about is actually pointing to WebSphere MQ v7.1.Update:Prior to MQ v7.1, XA transactions are supported only in Unmanaged mode with MTS as the transaction coordinator. Sample code for distributed transaction in unmanaged mode ishere. You will require an additional component, Extended Transaction Client(XTC) to be installed. As per latest announcements the XTC is available for free. The installable can be found in your MQ Server installation image.When a MQ connection is disconnected (basically MQDISC is called), any uncommitted messages in a transaction will be rolled back. Because of this messages reappear on the queue.\n"}
+{"text": "### Human: It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,visit the help center.Closed10 years ago.How can i create custom channel for the websphere MQ and how to configure with java client program ,Which channel i want to create for send message to websphereMQ (Server-connection-Channel is ok)### Assistant: You will need to create a Server connection (SVRCONN) channel for your client application to send messages to a WebSphere MQ Queue. It does not matter whether the application is developed in Java, C, C# etc.You can either use MQ Explorer (GUI) or RUNMQSC(cmd line) for creating a SVRCONN channel. In MQExplorer right click on \"Channels\" and select \"Server-Connection channel\" menu. A wizard pops up which will guide you to create a channel.You can also use \"RUNMQSC\" command line tool. From a command prompt run \"runmqsc \" which opens a MQ shell. In the shell run the below command (replace <> with your preferred names) in simplest form.DEFINE CHANNEL() CHLTYPE(SVRCONN)You can also specify a number of other attributes for this command which describedhereA number of Java/JMS samples are shipped with MQ. SimplePTP.java explains how to use a SVRCONN to connect to a queue manager and send/receive messages.\n"}
+{"text": "### Human: Is there a way to remove a JMS message from an IBM MQ Queue using JMSMessageId ina Java application(not using tools)? Also are such operations vendor-specific?Looked through the API for receive operations which are used to remove messages, but for removing specific messages, do we need to filter using MessageSelector and remove appropriately, or is there a more simple way? [checking for any available method which can be directly used]Can you please provide tutorials/examples [can be links too] to show the API usage for such operations?### Assistant: When you useJMSMessageIDas the only message property in a selector, WMQ optimizes the lookup to be the same as a native WMQ API get byMQMD.MessageIDwhich is an indexed field in the queue. Please see theJMS Message Selectiontopic for more details.QueueReceiver rcvr = sess.createReceiver(inputQ, \"JMSCorrelationID = '\"+msgId+\"'\")You can also do the same thing using native WMQ API calls using Java native code. You would do a normalGEToperation but specify the message ID in theMQMDstructure.myMsg.messageId = someMsgID; \nMQGetMessageOptions gmo = new MQGetMessageOptions(); \nmyQueue.get(myMsg, gmo);\n"}
+{"text": "### Human: We need to execute SET AUTHREC PROFILE($cname) OBJTYPE(CHANNEL) GROUP('mq-user') AUTHADD(...) so that the channels show up WMQ Explorer, it that correct? Current the access is prevented.### Assistant: Yes. With theAUTHRECprofiles defined in this and previous questions you have authorized the user to connect to the QMgr, put requests to the command queue and receive replies on a model queue. The command server needs to know what operations on other objects the group is authorized for. As an example, it won't display or let members of the group control channels until you authorize them.A quick way to see what objects need to be authorized is the Role Based Authorities Wizard in WMQ Explorer. Right-click on the QMgr, select Object Authorities, then Add Role Based Authorities like so:Next, select Group and put in the group name:The wizard outputssetmqautcommands which you can issue from the command line asmqm. There are equivalentAUTHRECcommands for these. Rather than convert them manually, I'd recommend running thesetmqautversions, then capturing the rule using thedmpmqcfgcommand.The actual commands created in the wizard using the settings above are:setmqaut -m QM75_1 -t qmgr -g mq-user +connect +inq +dsp\nsetmqaut -m QM75_1 -n \"**\" -t q -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t topic -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t channel -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t process -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t namelist -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t authinfo -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t clntconn -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t listener -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t service -g mq-user +dsp\nsetmqaut -m QM75_1 -n \"**\" -t comminfo -g mq-user +dsp\n\nsetmqaut -m QM75_1 -n SYSTEM.MQEXPLORER.REPLY.MODEL -t q -g mq-user +dsp +inq +get\nsetmqaut -m QM75_1 -n SYSTEM.ADMIN.COMMAND.QUEUE -t q -g mq-user +dsp +inq +put\n"}
+{"text": "### Human: I'm new to WebSphere MQ. I was practicing the tutorials on the IBM site, I want to know if I need two separate computer machines to send a message to a remote queue? \nI'm using a laptop, I was wondering if I create another user account, can I use that user account to send message to a remote queue?### Assistant: A remote queue in WebSphere MQ terms is simply a queue that exists on another queue manager. You do not need another server, nor even another account. Just define two queue managers on the same server, under the same account and connect them.crtmqm QMGR1\nstrmqm QMGR1\n\ncrtmqm QMGR2\nstrmqm QMGR2\n\nrunmqsc QMGR1\nDEFINE LISTENER(TCP.1414) TRPTYPE(TCP) PORT(1414) CONTROL(QMGR)\nSTART LISTENER(TCP.1414)\n\nDEFINE QL(QMGR2) USAGE(XMITQ) TRIGGER\nDEFINE CHL(QMGR1.QMGR2) CHLTYPE(SDR) TRPTYPE(TCP) + \n CONNAME('127.0.0.1(1415)') XMITQ(QMGR2) REPLACE\n* Next one not needed for the demo but usually there's\n* a channel for reply messages to return on.\nDEFINE CHL(QMGR2.QMGR1) CHLTYPE(RCVR) TRPTYPE(TCP) REPLACE\n\nSTART CHL(QMGR1.QMGR2) \n\nDEFINE QREMOTE(TARGET.QUEUE) RQMNAME(QMGR2) RNAME(TARGET.QUEUE)\nEND\n\n\nrunmqsc QMGR2\nDEFINE LISTENER(TCP.1415) TRPTYPE(TCP) PORT(1415) CONTROL(QMGR)\nSTART LISTENER(TCP.1415)\n\nDEFINE QL(QMGR1) USAGE(XMITQ) TRIGGER\nDEFINE CHL(QMGR2.QMGR1) CHLTYPE(SDR) TRPTYPE(TCP) + \n CONNAME('127.0.0.1(1414)') XMITQ(QMGR1) REPLACE\nDEFINE CHL(QMGR1.QMGR2) CHLTYPE(RCVR) TRPTYPE(TCP) REPLACE\n\nDEFINE QL(TARGET.QUEUE)\nENDYou can have as many QMgrs on one machine as resources allow. I have seem people with as many as 20 QMgrs on a server but one is the recommended number.If you have WMQ v7.0 or earlier you can have only one installation of WMQ on a machine. If you have v7.1, which is current as of this writing, then it is possible to have multiple installations on the same machine. But either way, all QMgrs on that machine run under themqmaccount (or on Windows, whatever account you installed and run WMQ under).\n"}
+{"text": "### Human: I am building a Java application that should be able to connect to an IBM WebSphere MQ queue manager and I cannot understand why I keep getting this error.I already gave administration privileges to my userID usingsetmqautthrough MQ Explorer. I also defined theMCAUSERin my channel and I also associated the user with the MQ Windows group.Can anyone please give a short tutorial/example of how to connect a Java program with a WebSphere MQ installation on a Windows Environment?### Assistant: If you have setMCAUSERin the channel, then this overrides any ID presented by the client. If you still get a 2035 then there are two possibilities. The first is that the ID inMCAUSERhasn't been properly authorized usingsetmqautcommands. The second (at least for Windows) is that it's not the right ID. For example, if the channel definition hasMCAUSER(userx)instead ofMCAUSER('userx@domain')then it is entirely possible that the ID presented is not the same SID that WMQ resolves. This can happen whenuserxis defined on a laptop and on the WMQ server. The servermustbe able to resolve the ID presented to the SID that comes with it.There are additional considerations for WMQ v7.1 regarding CHLAUTH rules. If the ID presented has administrative privileges, WMQ will block it on all channels by default. This is because an administrative ID has full access to WMQ and can remotely execute code on the QMgr's host server using the WMQ services or triggering functionality. So if you have WMQ v7.1 you either need to enable WMQ admin access on the desired channel or use a non-administrative user ID to connect.Finally, the easiest way to debug all of this is to enable authorization events on the QMgr and installSupportPac MS0Pinto WMQ Explorer. This will generate an event message every time there's a 2035 and then the MS0P plugin will parse that into human-readable format. The message will tell you...What API call failed. (CONNECT,OPEN,CLOSE)The options specified on the API callThe ID making the API callThe object against which the API call was madeThis can be helpful in determining whether you have provided all the right permissions. For example, the Java and JMS classes will inquire on every object they touch. This is how they discover the DLQ name when connecting or the BOQNAME when opening a queue. So if you didn't provide+inqon the QMgr and queue you get a 2035 and the event message will show you the object and options used. Similarly, if you read a poison message and the ID doesn't have rights to the backout queue or the Dead Queue then you get a 2035 which appears (until you look at the event message) to have occurred on a queue from which you have been happily consuming messages. So please be sure to enable Auth events and use MS0P.If you want a friendly tutorial to WMQ security, there are several conference presentations archivedhere.\n"}
+{"text": "### Human: My company is considering moving from Solaris to Linux, but some FUD has been raised concerning how well WebSphere MQ and Message Broker perform on RHEL. There are also concerns about support from IBM. Does anyone have experience using these tools in this environment?Thanks.### Assistant: I have had a lot of experience on WMQ and WMB on Linux and even z\\Linux both RHEL and SuSE. Both perform very well. The performance papers at IBM are a good place to start, but be aware that the testing in message broker is with small messages and a very simple flow.From an administrative point of view, they are no different then UNIX.\n"}
+{"text": "### Human: Can anyone help in doing the code in java of getting the depth of the queues. We are having 4 queues in IBM WebSphere MQ and inside them there are messages.I want to write a jsp to read the queue names and their depth while running the report. How do I do that?\nCan anyone help in getting the full solution because I don't know what to do### Assistant: I doens't think there is a way to retrieve the queue depth using JMS. You can however use MQ Series specific Java API to retrieve this information. Here is the sample code. Pay attention toint openOptions = MQC.MQOO_INQUIRE;Here is thereference guideint depth = 0;\nMQQueueManager qMgr; // define a queue manager object\nString mqHost = \"\";\nString mqPort = \"\";\nString mqChannel = \"\";\nString mqQMgr = \"\";\nString mqQueue = \"\";\ntry {\n // Set up MQSeries environment\n MQEnvironment.hostname = mqHost;\n MQEnvironment.port = Integer.valueOf(mqPort).intValue();\n MQEnvironment.channel = mqChannel;\n MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,\n MQC.TRANSPORT_MQSERIES);\n qMgr = new MQQueueManager(mqQMgr);\n int openOptions = MQC.MQOO_INQUIRE;\n MQQueue destQueue = qMgr.accessQueue(mqQueue, openOptions);\n depth = destQueue.getCurrentDepth();\n destQueue.close();\n qMgr.disconnect();\n} catch (Exception err) {\n err.printStackTrace();\n}\n"}
+{"text": "### Human: Can anyone help in doing the code in java of getting the depth of the queues. We are having 4 queues in IBM WebSphere MQ and inside them there are messages.I want to write a jsp to read the queue names and their depth while running the report.\nHow do I do that?### Assistant: Seehttp://blog.guymahieu.com/2008/06/11/getting-the-depth-of-an-mqseries-queue-from-java/.I re-implemented this as follows:import com.ibm.mq.*;\n\npublic class QueueManager {\n\n private final String host;\n private final int port;\n private final String channel;\n private final String manager;\n private final MQQueueManager qmgr;\n\n public QueueManager(String host, int port, String channel, String manager) throws MQException {\n this.host = host;\n this.port = port;\n this.channel = channel;\n this.manager = manager;\n this.qmgr = createQueueManager();\n }\n\n public int depthOf(String queueName) throws MQException {\n MQQueue queue = qmgr.accessQueue(queueName, MQC.MQOO_INQUIRE | MQC.MQOO_INPUT_AS_Q_DEF, null, null, null);\n return queue.getCurrentDepth();\n }\n\n @SuppressWarnings(\"unchecked\")\n private MQQueueManager createQueueManager() throws MQException {\n MQEnvironment.channel = channel;\n MQEnvironment.port = port;\n MQEnvironment.hostname = host;\n MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);\n return new MQQueueManager(manager);\n }\n}Put the following jars on your classpath:com.ibm.mq*jarj2ee.jar\n"}
+{"text": "### Human: Is it possible to implement message segmentation using JMS as it is in using Native IBM API asshown here. One posible solution I have read is message grouping for JMS. is anyone using this an alternative solution to Segmentation, using JMS?### Assistant: Yes, you can implement message segmentation using JMS as describedhere.\n"}
+{"text": "### Human: I'm just little bit lost in usage of topics in WebSphere MQ 7. Suppose simple scenario:I have a process publishing messages to a topic.I have zero or more subscribers receiving the message.Any subscriber can decide to react on received message = optional \"reply\". (Side note: Initial decision was to use topics for replies as well but I will change it to queue if necessary) The published message can have eitherReplyToQueueNameconfigured or it can be system level configuration on client.The response must be correlated to original published \"request\" (because there can be more then one published request).Now how to do this? I tried to use common approach from MQ queues where the initiator choose either:Set report toMQRO_COPY_MSG_ID_TO_CORREL_ID. Receiver will take message ID from request and pass it as Correlation ID in response.Set report toMQRO_PASS_CORREL_ID+ set Correlation ID in the request message. The receiver will take Correlation ID from request and set it as Correlation ID in response message.In both cases the sender is aware of message ID or correlation ID passed to request so it can correctly correlate messages but this doesn't work with MQ topics.If I try to follow the mentioned approaches I have a problem immediately when publishing the request - the message ID is not set on publisher side (it is empty) so the first approach is not possible. If I try to set correlation ID on publisher side I will get different one on subscriber side so I cannot use it for message correlation (= second approach is not possible as well).Here is some example what happens when using topics (IDs are in Base64):Test usingMQRO_COPY_MSG_ID_TO_CORREL_ID:Send request: // After sending message publisher doesn't know its ID!\nMessage Id: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nCorrelation Id: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n\nReceived request: // Subscriber gets some ID and correlation ID (but publisher didn't set any)\nMessage Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYH\nCorrelation Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYF\n\nSend response: // Subscriber correctly uses message ID of incoming request\nMessage Id: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nCorrelation Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYH\n\nReceived response: // Publisher gets in response completely different IDs!\nMessage Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYP\nCorrelation Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYNTest usingMQRO_PASS_CORREL_ID:Send request: // Publisher doesn't know its ID but it generated some random correlation ID.\nMessage Id: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nCorrelation Id: Chhv8KT+zhTjfAEdzeiB3cizw9vRy9Pf\n\nReceived request: // Subscriber got ANOTHER correlation ID!\nMessage Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYY\nCorrelation Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYW\n\nSend response: // Subscriber is using incorrect correlation ID.\nMessage Id: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nCorrelation Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYW\n\nReceived response: // Publisher gets in response completely different IDs!\nMessage Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYg\nCorrelation Id: QU1RIExNLnF1ZXVlLm1hbp2OiU4g6AYeHow to force MQ to not alter my IDs? I wrote test applications in both Java and .NET and both behaves in the same way. Or what is correct approach for my use case?### Assistant: Have you considered coding it with JMS (MQ as the implementation) instead of the MQ api directly?JMS already has the concept of areplyToin the published message and already has the concept of acorrelation idto link messages together. For the replyTo, either a queue or topic can be specified by the publisher, so you are not tied to either on the receiving end.\n"}
+{"text": "### Human: I'm new trying to configure MQ servicefollowing this tutorialbut when I tried to alter the serviceSYSTEM.BROKERit says that it cannot be found. What possibly am I doing wrong?I'm using Version 7.0 of WebSphere MQ.### Assistant: Note that the article applies to WMQ v6.0 whereas in v7.0 there is no pub/sub broker. In v7.0 and higher, pub/sub is natively supported as part of the queue manager.After a quick review of the tutorial, I believe that you can safely skip all ofStep C: Set Up Pub/Sub. This step creates the queues that the V6 pub/sub broker required and then started it. V7 neither requires these queues nor has a separate pub/sub broker component to start.You can actually see this in action in the last 45 seconds or so ofthis videowhere a new QMgr is created and then, without any additional setup, a message is published and received with a subscriber.So skip Step C and continue on with the tutorial and you should be OK.\n"}
+{"text": "### Human: I am working on a project where MQ client (Support PAC 7) is installed on one 64-bit Linux machine and it sends messages to server.On client machine we are using 64-bit linux JDK 1.6.25java -versionjava version \"1.6.0_25\"I have following environment variable set upMQSERVER='my_channel/tcp/SRVD10995(1414)'\n MQ_INSTALL_ROOT=/var/mqm/\n MQ_JAVA_DATA_PATH=/var/mqm/\n MQ_JAVA_INSTALL_PATH=/opt/mqm/java/\n MQ_JAVA_LIB_PATH=/opt/mqm/java/lib64\n LD_LIBRARY_PATH=/opt/mqm/java/lib64\n CLASSPATH= /opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:/opt/mqm/samp/jms/samples:/opt/mqm/samp/wmqjava/samplesbut when I run following commanddspmqver -p 6For native libraries I am seeing following message:Name: IBM WebSphere MQ\n Version: 7.0.1.6\n CMVC Level: k701-106-110721 mqjbnd=CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. [3=mqjbnd]::no mqjbnd in java.library.path\n Build Type: ProductionI am also getting same error message when I execute JMS code to connect to server. I do not have libmqjbnd.so is not in the /opt/mqm/java/lib64 folder, and not even in 32 bit folder.I have couple of questions :1) How do I fix this problem for client installation?\n2) Does the library file (.so) need to be there in that directory ?I will be thankful if anyone provides me answer to above questions, I have already invested many hours in this but no joy.### Assistant: There's a Technote on this specific questionhere. Let us know if the solution presented there does not resolve your problem.Update: I noticed a mismatch between your CLASSPATH which is pointing to the 32-bit libs and the other variables pointing to the 64-bit libs. WMQ provides scripts that set the variables for youas described in the Infocenter:On a UNIX system, you can use the script setjmsenv (if you are using a 32-bit \nJVM) or setjmsenv64 (if you are using a 64-bit JVM) to set the environment\nvariables. On AIX, these scripts are in the /usr/mqm/java/bin directory and,\non HP-UX, Linux, and Solaris, they are in the /opt/mqm/java/bin directory.Many people source the scripts in their .profile. Have you tried running these? Remember that simply running the script.../opt/mqm/java/bin/setjmsenv64...does not result in the env vars being set in the current shell. The script must be sourced using the dot syntax as follows:. /opt/mqm/java/bin/setjmsenv64What results do you get after sourcing the appropriate setjmsenv or setjmsenv64 script?\n"}
+{"text": "### Human: Transactional log file system(/var/mqm/log) become full and i am getting MQRC 2102 resource problem with Queue Manager while attempting client connection to this queue manager. What course of action we can do to resolve this?LogPrimaryFiles=2 \nLogSecondaryFiles=8 \nLogFilePages=16384 \nLogType=CIRCULAR \nLogBufferPages=0 \nLogPath=/var/mqm/log/QMGRA/ \nLogWriteIntegrity=TripleWriteIs adding additional disk space to /var/mqm/log is the only solution?I have few queues that were full,but queue storage file system were only 60% used.Please give me some ideas on this.### Assistant: Log file pages are 4096 bytes each so a setting ofLogFilePages=16384results in log files extents of 64MB each. With a setting ofLogPrimaryFiles=2andLogSecondaryFiles=8there can be up to 10 log files for a total of 640MB. If the file system that the circular logs resides on is less than this amount, it may fill up.The optimum solution here is to increase the size of the log file disk allocation to something a little larger than the log file extents require. If that is not possible or you need a temporary fix then it is necessary to change the size of the log file requirement by reducing the number of extents and restarting the QMgr. Note that you can adjust the number of log extents but not the size of the extents. If it becomes necessary to change theLogFilePages=16384parameter then it is necessary to rebuild the QMgr.The number and size of of extents represents the total amount of data that can be under syncpoint at once but 640MB is generous in most cases. In terms of time, it also limits the longest possible duration of a unit of work on an active QMgr. This is because an outstanding transaction will be rolled back if it happens that the head pointer in the log file ever overtakes the tail pointer. For example, suppose a channel goes into retry. This holds a batch of messages under syncpoint and holds that log extent active. As applications and other channels perform their normal operations, additional transactions drive the head pointer forward. Eventually all extents will be used, and although there may be very few outstanding transactions the oldest one will be rolled back to free up that extent and advance the tail pointer forward. If the error log shows many transactions are rolled back to free log space then you really would need to allocate more space to the log file partition and bump the number of extents.\n"}
+{"text": "### Human: I am trying to migrate an application from Websphere 6.1 to 7.0I noticed that many of the ibm MQ/JMS classes have changed/disappeared =)In particular, I am getting errors oncom.ibm.msg.client.jms.JmsQueue\ncom.ibm.mq.jmqi.JmqiObjectit is saying \"...cannot be resolved. It is indirectly referenced from required .class files\"Does anyone know what I can do to get this to compile?thanks### Assistant: Hard to say exactly from the description so I'll provide some general pointers that may be of help.The WMQ JMS and Java support was completely rewritten in V7 to use a common JMQI layer. This will affect the jar files that are referenced as well as the CLASSPATH and a few other things.If you have bundled the WMQ jar files into your application, you will want to delete them and reference the ones installed with WAS instead.If you used MDB listeners, you will need to switch to Activation Specs.For more info, see theIntegration of WebSphere MQ classes for JMS with WebSphere Application Serversection in theWMQ V7 Migrationmanual and the CLASSPATH settings from theEnvironmentsection in theWMQ V7 Using Javamanual.TheWebSphere Application Server V7 Migration Guidedoes not address WMQ in depth but it does have pointers to additional migration resources such as IBM Education Assistant as well as specific application and profile migration advice.\n"}
+{"text": "### Human: I've got a model queue (say, MY.MODEL.QUEUE). I'm opening it in process A and get a dynamic queue created (say, AMQ.WHATEVER). I send a message to another queue, specifying AMQ.WHATEVER as a ReplyTo queue.Now, process B receives the message, and replies to the dynamic queue. However, in B I need to know what model queue AMQ.WHATEVER is related to.I couldn't find any MQINQ Selector to inquire for that. Is there any way?### Assistant: You can't get there from here. :-)There is no reverse-resolution of queues, QMgrs, etc. If you need to know the model queue that was used, it will be necessary for the programs involved to specify enough of a root name to make the dynamic queues identifiable.For example, when you open MY.MODEL.QUEUE, specify a DynamicQName of MY.MODEL.QUEUE.* or similar. Then instead of a dynamic queue AMQ.WHATEVER you end up with a dynamic queue name of MY.MODEL.QUEUE.WHATEVER. You can set the dynamic queue prefix in the administered objects for JMS or as part of the API for JMS and all the other languages.Hereis the doc page that explains the name prefixing.\n"}
+{"text": "### Human: If I have a Websphere MQ queue defined on another queue manager in the cluster, is there a way I can open it for writing using the Perl interface? The code below brings back mqrc 2085.$messageQ = MQSeries::Queue->new\n (\n QueueManager => $qMgr,\n Queue => $queue,\n Options => $openOpt\n ) or die \">>>ERROR2: Unable to open the queue: $queue\\n\";\n}### Assistant: Yes! The Perl modules are a thin veneer over the WMQ API and expose all the basic options and most of the really esoteric stuff as well.When you open a queue, WebSphere MQ performs name resolution on the values you provide for Queue and QMgr names. If you provide both a Queue and a QMgr name then the object reference is fully qualified and WMQ will attempt to open it as named. So if the name you provide is the local QMgr and the clustered queue does not have a locally defined instance, the open will fail with a 2085 Unknown Object Name.The trick to opening a clustered queue is to provide a null value for the QMgr name. This causes name resolution to check the local QMgr for a queue of the same name, then finding none it checks the cluster repository and resolve the open to the clustered queue. Note that the queue must be advertised to the cluster for this to work. Specifically, the CLUSTER or CLUSNL attribute of the target queue must be non-blank and refer to a cluster that the source QMgr participates in. Similarly, the destination QMgr must also participate in the same cluster as the source QMgr.Note also that if you specify a QMgr name on the open that isnotthe local QMgr, then WMQ will attempt to resolve the QMgr name only. If it can resolve a route to that QMgr then it will send the message there. This means that in a cluster you can send a message to any queue on any QMgr so long as you know the fully-qualified name.Finally, you can define a local alias over a clustered queue. For example if you are on QMGRA and DEF QA(TARGET.QUEUE) TARGQ(TARGET.QUEUE) and then on QMGRB and QMGRC in the same cluster you DEF QL(TARGET.QUEUE) CLUSTER(MYCLUS) then it is possible to open QMGR=QMGRA QUEUE=TARGET.QUEUE and still have it work as expected. Note that the alias is NOT advertised to the cluster but the target queue is. The only issue with this approach is that the first time it is opened the API call may fail if the cluster query takes too long. When I do this in Production, I always use amqsput on the alias ahead of time to make the QMgr query the repository before the actual application opens the queue. Why would you do this? If security is a concern you probably don't want to authorize all apps directly to the cluster XMitQ because, as noted above, they could then put a message ontoanyqueue on any QMgr in the cluster, including SYSTEM.ADMIN.COMMAND.QUEUE. The alias gives you a place to hang authorizations and restrict the user to specific destinations in the cluster.So short answer, make sure you provide a null QMgr name on the Open call or set up a local alias over the clustered queue. For more about the security aspects of this, see the WMQ Security presentation athttp://t-rob.net/links\n"}
+{"text": "### Human: I got a .p12 file from our server team. I need to connect MQ server using this. What i need to amqputc to work. is there any config entries i need perform before i use this.### Assistant: Short answer: Not enough info to answer your question. This topic is quite deep and a lot depends on whether your app is C or Java and whether the WMQ channel is set for mutual authentication or not.Long answer: Here's what you need to find out and why...WMQ programs use either a .kdb format key store or they use a .jks keystore. The .jks format is for Java/JMS programs and the .kdb format is generally for C programs. Since amqsputc is definitely not the thing you will be using in Production, the first thing to do is determine what you will be using in Production so that you get the right key store type. No sense in getting amqsputc to work using a kdb if your actual app needs a .jks keystore. Once you know whether you need a kdb or a jks you can proceed accordingly.The .p12 you were given will need to be loaded into the .kdb or .jks file before a WMQ program can use it. The important thing here is to understand whether the .p12 file containsyourprivate key or the QMgr's public key. Depending on whether the channel is set to require mutual authentication, either of these scenarios is valid. A program like amqsputc that accesses a kdb file looking for your private key will search for a specific label to find the right certificate. So if it's a private key you need to know that and you'll need to know the user ID that will access it because that's part of the label when you install the cert.If you use a kdb file then you need to use IBM's tooling to manage it. If you use a jks you can use IBM's tools, Sun's keytool or any compatible tool. IBM provides a GUI and a command-line tool. I recommend the command-line tool gskcapicmd for which you can find the user manualhere.To do some of the heavy lifting when creating and managing WMQ certificates, feel free to grab theWMQ Security Lab downloadsfrom my web site. The zip file contains scripts that generate kdb files and certificates. They don't do exactly what you need but you will get a good idea of how the command does most basic tasks.Take a look at theWMQ SupportPac MO04 SSL Wizard. You tell it what kind of app you have and what platform and it spits out the commands to generate keystores and certs. It will get you half way there. It would get you all the way there if you didn't have this mystery .p12 to deal with.TheWMQ product manuals are your friend. You will become quite familiar with the WMQ Security and WMQ Client manuals before you are done. If your app is Java or JMS you will also want to look at the Using Java manual.Finally, there's a lot of links to various WMQ security resourceson my web site. Some of these may be helpful.\n"}
+{"text": "### Human: I feel like this is probably a pretty simple question, but this is my first foray into JMS, so I am a little unsure.I am trying to write to an existing JMS queue (and then read from another queue), for which I know the queue name, host, queue manager, and channel. How do I get a reference to this queue in the form of ajavax.jms.Destinationobject?All of the examples I have found involve callingjavax.jms.Session.createQueue(String), but since this queue already exists, I don't want to create another one, right? Or am I misunderstanding what is going on?If it matters, I am using the com.ibm.msg.client.jms driver.Thanks!### Assistant: Normally, the container in which your application runs will bind theQueuein its naming service. An application in the container can look it up with JNDI and use it.\n"}
+{"text": "### Human: I have a simple JMS application deployed on OC4J under AIX server, in my application I'm listening to some queues and sending to other queues on a Websphere MQ deployed under AS400 server.The problem is that my connections to these queues are terminated/closed when it stays idle for some time with the errorMQJMS1016(this is not the problem), and when that happens I attempt to recover the connection and it works, however, the old connection is stuck at the MQ and would not terminate until it is terminated manually.The recovery code goes as follows:public void recover() {\n cleanup();\n init();\n}\n\npublic void cleanup(){\n if (session != null) {\n try {\n session .close();\n } catch (JMSException e) {\n }\n }\n if (connection != null) {\n try {\n connection.close();\n } catch (JMSException e) {\n }\n }\n}\n\npublic void init(){\n // typical initialization of the connection, session and queue...\n}### Assistant: The MQJMS1016 is an internal error and indicates that the connection loss is due to something wrong with the code or WMQ itself. Tuning the channels will help but you really need to get to the problem of why the app is spewing orphaned connections fast enough to exhaust all available channels.The first thing I'd want to do is check the versions of WMQ and of the WMQ client that are running. If this is new development, be sure you are using the WMQ v7 client because v6 is end-of-life as of Sept 2011. The v7 client works with v6 QMgrs until you are able to upgrade that as well. Once you get to v7 client and QMgr, there are quite a bit of channel tuning and reconnection options available to you.The WMQ v7 client download is here:http://bit.ly/bXM0q3Also, note that the reconnect logic in the code above does not sleep between attempts. If a client throws connection requests at a high rate of speed, it can overload the WMQ listener and execute a very effective DOS attack. Recommended to sleep a few seconds between attempts.Finally, please, PLEASE print the linked exceptions in your JMSException catch blocks. If you have a problem with a JMS transport provider, the JMS Linked Exception will contain any low-level error info. In the case of WMQ it contains the Reason Code such as 2035 MQRC_AUTHORIZATION_ERROR or 2033 MQRC_NO_MSG_AVAILABLE. Here's an example:try {\n .\n . code that might throw a JMSException\n .\n} catch (JMSException je) {\n System.err.println(\"caught \"+je);\n Exception e = je.getLinkedException();\n if (e != null) {\n System.err.println(\"linked exception: \"+e);\n } else {\n System.err.println(\"No linked exception found.\");\n }\n}If you get an error at 2am some night, your WMQ administrator will thank you for the linked exceptions.\n"}
+{"text": "### Human: Any help or hint would be greatly appreciated it.\nMy ibm mq is running on dockers.\nI logged into the console using the following id and password:https://localhost:9443/ibmmq/console\nid:admin\npassword:passw0rdIn the java code below I used the same id and password.\nThe \"DEV.QUEUE.1\" exist(please see image below).com.ibm.msg.client.jms.DetailedJMSSecurityRuntimeException: JMSWMQ2013: The security authentication was not valid that was supplied for queue manager 'QM1' with connection mode 'Client' and host name 'localhost(1414)'.\nPlease check if the supplied username and password are correct on the queue manager to which you are connecting. For further information, review the queue manager error logs and the Securing IBM MQ topic within IBM Knowledge Center./*\n * (c) Copyright IBM Corporation 2018\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n package com.ibm.mq.samples.jms;\n\n\n import javax.jms.Destination;\n import javax.jms.JMSConsumer;\n import javax.jms.JMSContext;\n import javax.jms.JMSException;\n import javax.jms.JMSProducer;\n import javax.jms.TextMessage;\n\n import com.ibm.msg.client.jms.JmsConnectionFactory;\n import com.ibm.msg.client.jms.JmsFactoryFactory;\n import com.ibm.msg.client.wmq.WMQConstants;\n\n /**\n * A minimal and simple application for Point-to-point messaging.\n *\n * Application makes use of fixed literals, any customisations will require\n * re-compilation of this source file. Application assumes that the named queue\n * is empty prior to a run.\n *\n * Notes:\n *\n * API type: JMS API (v2.0, simplified domain)\n *\n * Messaging domain: Point-to-point\n *\n * Provider type: IBM MQ\n *\n * Connection mode: Client connection\n *\n * JNDI in use: No\n *\n */\n public class JmsPutGet {\n\n // System exit status value (assume unset value to be 1)\n private static int status = 1;\n\n // Create variables for the connection to MQ\n private static final String HOST = \"localhost\"; // Host name or IP address\n private static final int PORT = 1414; // Listener port for your queue manager\n private static final String CHANNEL = \"DEV.APP.SVRCONN\"; // Channel name\n private static final String QMGR = \"QM1\"; // Queue manager name\n private static final String APP_USER = \"admin\"; // User name that application uses to connect to MQ\n private static final String APP_PASSWORD = \"passw0rd\"; // Password that the application uses to connect to MQ\n private static final String QUEUE_NAME = \"DEV.QUEUE.1\"; // Queue that the application uses to put and get messages to and from\n\n\n /**\n * Main method\n *\n * @param args\n */\n public static void main(String[] args) {\n\n // Variables\n JMSContext context = null;\n Destination destination = null;\n JMSProducer producer = null;\n JMSConsumer consumer = null;\n\n\n\n try {\n // Create a connection factory\n JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\n JmsConnectionFactory cf = ff.createConnectionFactory();\n\n // Set the properties\n cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, HOST);\n cf.setIntProperty(WMQConstants.WMQ_PORT, PORT);\n cf.setStringProperty(WMQConstants.WMQ_CHANNEL, CHANNEL);\n cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\n cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, QMGR);\n cf.setStringProperty(WMQConstants.WMQ_APPLICATIONNAME, \"JmsPutGet (JMS)\");\n cf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true);\n cf.setStringProperty(WMQConstants.USERID, APP_USER);\n cf.setStringProperty(WMQConstants.PASSWORD, APP_PASSWORD);\n //cf.setStringProperty(WMQConstants.WMQ_SSL_CIPHER_SUITE, \"*TLS12\");\n\n // Create JMS objects\n context = cf.createContext();\n destination = context.createQueue(\"queue:///\" + QUEUE_NAME);\n\n long uniqueNumber = System.currentTimeMillis() % 1000;\n TextMessage message = context.createTextMessage(\"Your lucky number today is \" + uniqueNumber);\n\n producer = context.createProducer();\n producer.send(destination, message);\n System.out.println(\"Sent message:\\n\" + message);\n\n consumer = context.createConsumer(destination); // autoclosable\n String receivedMessage = consumer.receiveBody(String.class, 15000); // in ms or 15 seconds\n\n System.out.println(\"\\nReceived message:\\n\" + receivedMessage);\n\n context.close();\n\n recordSuccess();\n } catch (JMSException jmsex) {\n recordFailure(jmsex);\n }\n catch(Exception e) {\n System.out.println(\"exception:\"+e.getMessage());\n }\n\n System.exit(status);\n\n } // end main()\n\n /**\n * Record this run as successful.\n */\n private static void recordSuccess() {\n System.out.println(\"SUCCESS\");\n status = 0;\n return;\n }\n\n /**\n * Record this run as failure.\n *\n * @param ex\n */\n private static void recordFailure(Exception ex) {\n if (ex != null) {\n if (ex instanceof JMSException) {\n processJMSException((JMSException) ex);\n } else {\n System.out.println(ex);\n }\n }\n System.out.println(\"FAILURE\");\n status = -1;\n return;\n }\n\n /**\n * Process a JMSException and any associated inner exceptions.\n *\n * @param jmsex\n */\n private static void processJMSException(JMSException jmsex) {\n System.out.println(jmsex);\n Throwable innerException = jmsex.getLinkedException();\n if (innerException != null) {\n System.out.println(\"Inner exception(s):\");\n }\n while (innerException != null) {\n System.out.println(innerException);\n innerException = innerException.getCause();\n }\n return;\n }\n\n }UpdateCommented out these two lines:cf.setStringProperty(WMQConstants.USERID, APP_USER);\ncf.setStringProperty(WMQConstants.PASSWORD, APP_PASSWORD);Outcome:Sent message:\n\n JMSMessage class: jms_text\n JMSType: null\n JMSDeliveryMode: 2\n JMSDeliveryDelay: 0\n JMSDeliveryTime: 1626132731104\n JMSExpiration: 0\n JMSPriority: 4\n JMSMessageID: ID:414d5120514d312020202020202020203c98ea6001540140\n JMSTimestamp: 1626132731104\n JMSCorrelationID: null\n JMSDestination: queue:///DEV.QUEUE.1\n JMSReplyTo: null\n JMSRedelivered: false\n JMSXAppID: JmsPutGet (JMS) \n JMSXDeliveryCount: 0\n JMSXUserID: app \n JMS_IBM_PutApplType: 28\n JMS_IBM_PutDate: 20210712\n JMS_IBM_PutTime: 23321072\nYour lucky number today is 837\n\nReceived message:\nYour lucky number today is 837\nSUCCESS### Assistant: For channel DEV.APP.SVRCONN and QMgr QM1 authorisation is disabled by default.Try to remove APP_USER and APP_PASSWORD. Notice: admin and passw0rd are only for admin console.Or see my this answer and disable authorisation:IBM MQ authentication\n"}
+{"text": "### Human: We have 2 appl. In which App2 sending & App1 is receiving msg. Below is the configuration.App1 => Q Name : GIBTNBN.RCV.SYS1.TO.SYS2\n ChannelName: GIBTNBN.SVRCONN\n QMgr: M1\nApp2 => Q Name : IBLPWTW.SYS1.TO.SYS2.STATUS\n ChannelName: IBLPWTW.SVRCONN.TLS\n QMgr: M2I know only about SDR/RCVR type of channels. But here I see at both appl's side type of Channel is Server Connection. As per IBM specs => \"To send messages using a server channel, you must also create, on the other queue manager, a receiver channel with the same name as the server channel.\" I am wondering how despite of having different channel name and channel Type (as per spec it should be RCVR Type & with same name 'IBLPWTW') at receiver side , communication is still happening.Please help me out to identify how SVRCONN channel type work.### Assistant: SDR/RCVR channels are used to allow for one direction communication between two queue managers.SVRCONN channels are used to allow applications to connect to a queue manager over the network, the application can both send and receive data over the SVRCONN channel. If the application happens to use CCDTs to specify the client end of the connection details these are called CLNTCONN channels and would pair with a SVRCONN channel. CCDTs are not required, applications can specify connection details programmatically or via JMS/XMS JNDI such as \".bindings\" files.In your setup you may have both types in use, if you don't see SDR/RCVR channels then perhaps the two queue managers communicate over a MQ cluster using CLUSSDR/CLUSRCVR channels.\n"}
+{"text": "### Human: I'm trying to create an extension using quarkus in order to use ibm mq as for a native executable.\nUntil now I've created (in the runtime module) the ConnectionFactory producer:@ApplicationScoped\npublic class ConnectionFactoryProducer {\n\n @Produces\n @ApplicationScoped\n @DefaultBean\n public JmsConnectionFactory connectionFactory() throws JMSException {\n\n JmsFactoryFactory ff;\n JmsConnectionFactory factory;\n ff = JmsFactoryFactory.getInstance(JmsConstants.WMQ_PROVIDER);\n factory = ff.createConnectionFactory();\n // Always work in TCP/IP client mode\n factory.setIntProperty(CommonConstants.WMQ_CONNECTION_MODE, CommonConstants.WMQ_CM_CLIENT);\n factory.setStringProperty(CommonConstants.WMQ_HOST_NAME, \"localhost\");\n factory.setIntProperty(CommonConstants.WMQ_PORT, 1414);\n factory.setStringProperty(CommonConstants.WMQ_CHANNEL, \"DEV.ADMIN.SVRCONN\");\n factory.setStringProperty(CommonConstants.WMQ_QUEUE_MANAGER, \"QM1\");\n factory.setStringProperty(WMQConstants.USERID, \"admin\");\n factory.setStringProperty(WMQConstants.PASSWORD, \"passw0rd\");\n return factory;\n }\n\n}The deployment module contains the processor:public final class IbmExtProcessor {\n\n private static final String FEATURE = \"ibm-ext\";\n\n @BuildStep\n FeatureBuildItem feature() {\n return new FeatureBuildItem(FEATURE);\n }\n\n}Where FEATURE is the name of the extension.But when I try to execute the code using the extension by importing it as a dependency in my project nothing happens. \nIt looks like classes that use the dependency are no more in the application context.\nExample of a message producer:public class NumberProducer implements Runnable {\n\n private final Random random = new Random();\n private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();\n @Inject\n private ConnectionFactoryProducer cf;\n private ConnectionFactory c;\n\n\n\n void onStart(@Observes StartupEvent ev) throws JMSException {\n c=cf.connectionFactory();\n scheduler.scheduleWithFixedDelay(this, 0L, 1L, TimeUnit.SECONDS);\n }\n\n void onStop(@Observes ShutdownEvent ev) {\n scheduler.shutdown();\n }\n\n @Override\n public void run() {\n JMSContext context = c.createContext();\n Queue destination=context.createQueue(\"queue:///DEV.QUEUE.1\");\n try {\n TextMessage message = context.createTextMessage(String.format(\"Value : %d\", random.nextInt(100)));\n JMSProducer producer = context.createProducer();\n producer.send(destination, message);\n System.out.println(message);\n } catch (Exception e) {\n throw e;\n }\n }\n}In this case i will never get the print of the message variable. Anyone can help? I think i've missed something in the extension but i can't figure out what could be.### Assistant: AMQP will not work when you have to connect to a classic IBM MQ channel. It that cases you have to use thecom.ibm.mq.allclientjar. Despite the introspection and thread spawning it is possible to use thecom.ibm.mq.allclientin a Quarkus native image. You will need the followingquarkus.native.additional-build-args:-J-Dcom.ibm.mq.cfg.useIBMCipherMappings=false,\\\n-J-Dcom.ibm.msg.client.commonservices.ffst.suppress=-1,\\\n--initialize-at-run-time=org.apache.http.impl.auth.NTLMEngineImpl\\,com.ibm.mq.jmqi.remote.impl.RemoteReconnectThread\\,com.ibm.mq.jmqi.JmqiDefaultThreadPool\\,com.ibm.msg.client.wmq.compat.jms.internal.MQJMSMessage\\,com.ibm.msg.client.commonservices.workqueue.WorkQueueManager,\\\n-H:ResourceConfigurationFiles=resources-config.json,\\\n-H:ReflectionConfigurationFiles=reflection-config.json,\\\n-H:+ReportUnsupportedElementsAtRuntime,\\\n--report-unsupported-elements-at-runtimeThe first system property is needed when using a non IBM JDK.I've added the second system property to avoid FFDC logging; (which will try to write to a local filesystem).\nThe first class mentionedinitialize-at-run-timestuff is because of the use of a SecureRandom.The rest is for the two class loading paths to the WorkQueueManager. The WorkQueueManager itself is needed because it spawns Threads at runtime.Regarding reflection you have to define a reflection-config.json for the classescom.ibm.msg.client.jms.internal.JmsFactoryFactoryImplcom.ibm.mq.jmqi.remote.api.RemoteFAPcom.sun.security.cert.internal.x509.X509V1CertImplThe last class is needed when you use SSL/TLS in your connection to the MQ channel.Also a resources-config.json is needed with{\"pattern\": \".+properties$\"}because the IBM MQ code uses ResourceBundles with a number of properties files for error messages.When using SSL/TLS you have to explicitly set the SSLSocketfactory on the JmsConnectionFactory:connectionFactory.setObjectProperty(\"XMSC_WMQ_SSL_SOCKET_FACTORY\", sslSocketFactory);Depending on how you configure the JmsConnectionFactory and the version of thecom.ibm.mq.allclientjar you might get errors on \"XMSC_WMQ_HOST_NAME\" configuration. These errors are bugs in the IBM-code and have nothing to do with the native image.\n"}
+{"text": "### Human: Is there any way to purge IBM MQ Queue programmatically? I have few messages lying in the Queue but when I read the messages using Consumer code , the messages are still present in the queue. I am assuming there are some uncommitted messages present in queue. I do not have access to MQ explorer so I want to clear the queue programmatically. (either through JMS code or IBM MQ implementation way)Currently my consumer has jar filecom.ibm.mq-6.0.2.1.jarSo I prefer to use WMQ classes rather than JMS.### Assistant: Here is a fully functioning Java/MQ program called 'EmptyQ.java' that will delete all messages on a queue until the queue is empty. Note: It is one of the sample MQ/Java programs that I postedhere.import java.text.SimpleDateFormat;\nimport java.util.Date;\nimport java.util.Hashtable;\n\nimport com.ibm.mq.MQException;\nimport com.ibm.mq.MQMessage;\nimport com.ibm.mq.MQGetMessageOptions;\nimport com.ibm.mq.MQQueue;\nimport com.ibm.mq.MQQueueManager;\nimport com.ibm.mq.constants.CMQC;\n\n/**\n * Program Name: \n * EmptyQ\n *\n * Description: \n * This java class will connect to a remote queue manager with the\n * MQ setting stored in a HashTable, loop to retrieve (delete) all messages from\n * a queue then close and disconnect.\n *\n * Sample Command Line Parameters: \n * bindings mode: \n * -m MQA1 -q TEST.Q1 \n * \n * client mode:\n * -m MQA1 -q TEST.Q1 -h 127.0.0.1 -p 1414 -c TEST.CHL -u UserID -x Password\n *\n * @author Roger Lacroix\n */\npublic class EmptyQ\n{\n private static final SimpleDateFormat LOGGER_TIMESTAMP = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss.SSS\");\n\n private Hashtable params;\n private Hashtable mqht;\n\n /**\n * The constructor\n */\n public EmptyQ()\n {\n super();\n params = new Hashtable();\n mqht = new Hashtable();\n }\n\n /**\n * Make sure the required parameters are present.\n * \n * @return true/false\n */\n private boolean allParamsPresent()\n {\n boolean b = params.containsKey(\"-m\") && params.containsKey(\"-q\");\n\n if (params.containsKey(\"-c\"))\n {\n b = b && params.containsKey(\"-c\") && params.containsKey(\"-h\") && params.containsKey(\"-p\");\n }\n\n if (b)\n {\n try\n {\n if (params.containsKey(\"-p\"))\n Integer.parseInt((String) params.get(\"-p\"));\n }\n catch (NumberFormatException e)\n {\n b = false;\n }\n }\n\n return b;\n }\n\n /**\n * Extract the command-line parameters and initialize the MQ HashTable.\n * \n * @param args\n * @throws IllegalArgumentException\n */\n private void init(String[] args) throws IllegalArgumentException\n {\n int port = 1414;\n if (args.length > 0 && (args.length % 2) == 0)\n {\n for (int i = 0; i < args.length; i += 2)\n {\n params.put(args[i], args[i + 1]);\n }\n }\n else\n {\n throw new IllegalArgumentException();\n }\n\n if (allParamsPresent())\n {\n if (params.containsKey(\"-c\"))\n {\n try\n {\n port = Integer.parseInt((String) params.get(\"-p\"));\n }\n catch (NumberFormatException e)\n {\n port = 1414;\n }\n\n mqht.put(CMQC.CHANNEL_PROPERTY, params.get(\"-c\"));\n mqht.put(CMQC.HOST_NAME_PROPERTY, params.get(\"-h\"));\n mqht.put(CMQC.PORT_PROPERTY, new Integer(port));\n if (params.containsKey(\"-u\"))\n mqht.put(CMQC.USER_ID_PROPERTY, params.get(\"-u\"));\n if (params.containsKey(\"-x\"))\n mqht.put(CMQC.PASSWORD_PROPERTY, params.get(\"-x\"));\n }\n\n // I don't want to see MQ exceptions at the console.\n MQException.log = null;\n }\n else\n {\n throw new IllegalArgumentException();\n }\n }\n\n /**\n * Connect, open queue, loop and get all messages then close queue and\n * disconnect.\n *\n */\n private void receive()\n {\n String qMgrName = (String) params.get(\"-m\");\n String inputQName = (String) params.get(\"-q\");\n MQQueueManager qMgr = null;\n MQQueue queue = null;\n int openOptions = CMQC.MQOO_INPUT_AS_Q_DEF + CMQC.MQOO_INQUIRE + CMQC.MQOO_FAIL_IF_QUIESCING;\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n gmo.options = CMQC.MQGMO_FAIL_IF_QUIESCING + CMQC.MQGMO_ACCEPT_TRUNCATED_MSG;\n MQMessage receiveMsg = null;\n int msgCount = 0;\n boolean getMore = true;\n\n try\n {\n if (params.containsKey(\"-c\"))\n qMgr = new MQQueueManager(qMgrName, mqht);\n else\n qMgr = new MQQueueManager(qMgrName);\n EmptyQ.logger(\"successfully connected to \" + qMgrName);\n\n queue = qMgr.accessQueue(inputQName, openOptions);\n EmptyQ.logger(\"successfully opened \" + inputQName);\n\n while (getMore)\n {\n receiveMsg = new MQMessage();\n\n try\n {\n // get the message on the queue - request only 1 byte - make it go as fast as possible.\n queue.get(receiveMsg, gmo, 1);\n msgCount++;\n }\n catch (MQException e)\n {\n if ( (e.completionCode == CMQC.MQCC_FAILED) && \n (e.reasonCode == CMQC.MQRC_NO_MSG_AVAILABLE) )\n {\n // All messages read.\n getMore = false;\n break;\n }\n else if ( (e.completionCode == CMQC.MQCC_WARNING) && \n (e.reasonCode == CMQC.MQRC_TRUNCATED_MSG_ACCEPTED) )\n {\n msgCount++;\n }\n else\n {\n EmptyQ.logger(\"MQException: \" + e.getLocalizedMessage());\n EmptyQ.logger(\"CC=\" + e.completionCode + \" : RC=\" + e.reasonCode);\n getMore = false;\n break;\n }\n }\n }\n }\n catch (MQException e)\n {\n EmptyQ.logger(\"CC=\" + e.completionCode + \" : RC=\" + e.reasonCode);\n }\n finally\n {\n EmptyQ.logger(\"deleted \" + msgCount + \" messages\");\n\n try\n {\n if (queue != null)\n {\n queue.close();\n EmptyQ.logger(\"closed: \" + inputQName);\n }\n }\n catch (MQException e)\n {\n EmptyQ.logger(\"CC=\" + e.completionCode + \" : RC=\" + e.reasonCode);\n }\n try\n {\n if (qMgr != null)\n {\n qMgr.disconnect();\n EmptyQ.logger(\"disconnected from \" + qMgrName);\n }\n }\n catch (MQException e)\n {\n EmptyQ.logger(\"CC=\" + e.completionCode + \" : RC=\" + e.reasonCode);\n }\n }\n }\n\n /**\n * A simple logger method\n * \n * @param data\n */\n public static void logger(String data)\n {\n String className = Thread.currentThread().getStackTrace()[2].getClassName();\n\n // Remove the package info.\n if ((className != null) && (className.lastIndexOf('.') != -1))\n className = className.substring(className.lastIndexOf('.') + 1);\n\n System.out.println(LOGGER_TIMESTAMP.format(new Date()) + \" \" + className + \": \" + Thread.currentThread().getStackTrace()[2].getMethodName() + \": \" + data);\n }\n\n /**\n * main line\n * \n * @param args\n */\n public static void main(String[] args)\n {\n EmptyQ write = new EmptyQ();\n\n try\n {\n write.init(args);\n write.receive();\n }\n catch (IllegalArgumentException e)\n {\n System.err.println(\"Usage: java EmptyQ -m QueueManagerName -q QueueName [-h host -p port -c channel] [-u UserID] [-x Password]\");\n System.exit(1);\n }\n\n System.exit(0);\n }\n}\n"}
+{"text": "### Human: I have a requirement to get just a specific message from a queue based on its correlation ID.Is there a way where we can get a message for the corresponding correlation ID and remove only that message from the queue without deleting the others.The options which I have tried they retrieve the message but removing the other messages from the queue as well while finding my messageI have used the following openOptions in accessQueue method while browsing the queueMQC.MQOQ_INPUT_SHARED | MQC.MQOO_FAIL_IF_QUIESCING | MQC_MQOO_INQUIRE | MQC.MQOOBROWSEAnd the following options to get the messageString correlation ID = \n\n MQMessage respMessage = new MQMessage();\n\n respMessage.correlationId = correlation ID.getBytes();\n\n MQGetMessageOptions msg = new MqGetMessageOptions(); \n msg.options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT + MQC.MQGMO_BROWSE_NEXT\n\n msg.matchOptions = MQC.MQMO_MATCH_MSG_ID\n\nmsg.waitInterval = 2000;\n\nqueue.get(respMessage, msg);### Assistant: You have many issues with your code.(1) As Morag said, remove the MQGMO_BROWSE_NEXT option if you want to remove the message from the queue (i.e. destructive get).respMessage.correlationId = correlation ID.getBytes();\nmsg.matchOptions = MQC.MQMO_MATCH_MSG_ID(2) You are setting the CorrelId but then requesting to match on MsgId. That won't work. You will get reason code of MQRC_NO_MSG_AVAILABLE (2033).(3) MsgIds and/or CorrelIds should never be converted to a string or start as a string. MsgIds and/or CorrelIds will contain binary data. Hence, MsgIds and CorrelIds should always be a byte array. i.e. byte[]Here is a screenshot of a message's MsgId and CorrelId:(4) You have MQGMO_NO_WAIT option but you set waitInterval to 2000. If you want to wait for up to 2 seconds for a message to arrive then you need to use the MQGMO_WAIT option.MQGetMessageOptions msg = new MqGetMessageOptions();(5) \"msg\" is a terrible variable name. It will only confuse people because they will think it references a message. i.e. MQMessage class. It is far better to call the variable \"gmo\".i.e.MQGetMessageOptions gmo = new MqGetMessageOptions();\ngmo.options = CMQC.MQGMO_WAIT + CMQC.MQGMO_FAIL_IF_QUIESCING + CMQC.MQGMO_CONVERT;\ngmo.waitInterval = 2000;\ngmo.matchOptions = CMQC.MQMO_MATCH_CORREL_ID;\n"}
+{"text": "### Human: I'm trying to send a message to a IBM MQ queue from my spring boot service. Configuration is as follows:Application.propertiesibm.mq.queueManager=QM1\nibm.mq.queue=DEV.QUEUE.1\nibm.mq.channel=DEV.APP.RECEIVER\nibm.mq.host=localhost\nibm.mq.port=1414ConectionFactory Bean@Bean\n public MQQueueConnectionFactory mqQueueConnectionFactory() {\n MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n mqQueueConnectionFactory.setHostName(host);\n try {\n mqQueueConnectionFactory.setTransportType(WMQConstants.ADMIN_QUEUE_DOMAIN);\n mqQueueConnectionFactory.setCCSID(1208);\n mqQueueConnectionFactory.setChannel(channel);\n mqQueueConnectionFactory.setPort(port);\n mqQueueConnectionFactory.setQueueManager(queueManager);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return mqQueueConnectionFactory;\n }IBM MQ Explorer picturesqueuechannellistenerWhen i try to send a message i get the error:'2' ('MQCC_FAILED') raz\u00f3n '2539' ('MQRC_CHANNEL_CONFIG_ERROR').What i'm missing? The error sugest than my chammel type is not adecuate to my request, but i don't know waht does it means.Thanks in advance.### Assistant: Client programs connect to SVRCONN channels, not RECEIVERs.\n"}
+{"text": "### Human: Client Details:The issues occurs with code acting as a producer pushing messages into IBM MQ queues and topics. The producer is exposed as a REST interface using WebApi2 and is deployed on IIS. We are using C# .NET (4.5.2) client to connect to IBM MQ. We connect using the CCDT file AMQCLCHL.TAB to get the client connection details. The underlying libraries used are Apache NMS (1.8.0.4573) and IBM XMS (2.5.0.3).Exception Received:CWSMQ0006E: An exception was received during the call to the method ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2058.Error Details:The client correctly works and we are able to push hundred thousands messages through to MQ queues and topics. However, after a random period of time ranging from few hours to more than 1 week, the client starts failing with the error noted above. Few more details:The error is resolved by restarting the IIS pool or reloading the applicationConnecting to the same MQ server from another client (IIS server 2) continues to work when first client (IIS server 1) continues to have issuesError seen in AMQERR01.LOG file.AMQ9516: File error occurred.\n\nEXPLANATION: The filesystem returned error code 6 for file'\\\\...\\AMQCLCHL.TAB'. \n\nACTION: Record the name of the file '\\\\...\\AMQCLCHL.TAB' and tell the systems administrator, who should ensure that file '\\\\...\\AMQCLCHL.TAB' is correct and available.Error code 6 isERROR_INVALID_HANDLE.### Assistant: This happens when the connection was closed (could be remote server restart, network issues, etc...). This really takes me back - I remember dealing with this back in 2002 connecting a Java J2EE application to MQ on an OS/390.Recently IBM has implemented auto reconnect settings that can be set in the CCDT or manually on the C# object. This is summarized on theXMS page, andthe documentation for implementing that is here.The properties Client Reconnect Options, Client Reconnect Timeout, and Connection Namelist can also be set via Client Channel Definitions Table (CCDT) or by enabling the client reconnection via the mqclient.ini file.\n"}
+{"text": "### Human: I am running below command from (commandline only not web client) Webspere MQ client v 8.0.0.9 and i am not able to connect MQ server/opt/mqm/samp/bin/amqsgetc Q-name Q-manageri am exportingexport MQCHLTAB=xxx.TAB ---------xxx.TAB under /var/mqm\nexport MQCHLLIB=/var/mqm\nexport MQSSLKEYR=/var/mqm/ssl/cms/cert -------- cert.kdb under cms dir using\nexport MQSERVER=channel-name/TCP/'xx.xx.xx.xx(xxx)'Error i am getting is07/04/2018 09:22:20 AM - Process(6024.1) User(username) Program(amqsgetc)\n Host(hostname) Installation(Installation1)\n VRMF(8.0.0.9) QMgr(.)\n\nAMQ9641: Remote CipherSpec error for channel 'ch-name' to host\n'MQ-server-ip(port)'.\n\nEXPLANATION:\nThe remote end of channel 'ch-name' on host 'MQ-server-ip(port)' has had\na CipherSpec error. The channel did not start.\nACTION:\nReview the error logs on the remote system to discover the problem with the\nCipherSpec.\n----- cmqxrfpt.c : 573 --------------------------------------------------------### Assistant: The short answer is to remove theMQSERVERenvironment variable. For further details and references read below.If you specify theMQSERVERenvironment variable MQ will only use this information and ignore the the CCDT environment variables (MQCHLLIBandMQCHLTAB).This is referenced in the IBM MQ Knowledge Center pageConfiguring > Configuring connections between the server and clients > Using IBM MQ environment variables > MQSERVER > Using MQSERVER.If you use the MQSERVER environment variable to define the channel\n between your IBM\u00ae MQ MQI client machine and a server machine, this is\n the only channel available to your application, and no reference is\n made to the client channel definition table (CCDT).Further information on how MQ application will determine connection details is referenced in the IBM MQ Knowledge Center pageDeveloping applications > Developing MQI applications with IBM MQ > Writing client procedural applications > Running applications in the IBM MQ MQI client environment > Connecting IBM MQ MQI client applications to queue managersWhen an application running in an IBM MQ client environment issues an\n MQCONN or MQCONNX call, the client identifies how it is to make the\n connection. When an MQCONNX call is issued by an application on an IBM\n MQ client, the MQI client library searches for the client channel\n information in the following order:Using the contents of the ClientConnOffset or ClientConnPtr fields of the MQCNO structure (if supplied). These fields identify the\n channel definition structure (MQCD) to be used as the definition of\n the client connection channel. Connection details can be overridden by\n using a pre-connect exit. For more information, see Referencing\n connection definitions using a pre-connect exit from a repository.If the MQSERVER environment variable is set, the channel it defines is used.If an mqclient.ini file is defined and contains a ServerConnectionParms, the channel that it defines is used. For more\n information, see Configuring a client using a configuration file and\n CHANNELS stanza of the client configuration file.If the MQCHLLIB and MQCHLTAB environment variables are set, the client channel definition table they point to is used.If an mqclient.ini file is defined and contains ChannelDefinitionDirectory and ChannelDefinitionFile attributes, these\n attributes are used to locate the client channel definition table. For\n more information, see Configuring a client using a configuration file\n and CHANNELS stanza of the client configuration file.Finally, if the environment variables are not set, the client searches for a client channel definition table with a path and name\n that are established from the DefaultPrefix in the mqs.ini file. If\n the search for a client definition table fails, the client uses the\n following paths:UNIX and Linux systems: /var/mqm/AMQCLCHL.TABWindows: C:\\Program Files\\IBM\\WebSphere MQ\\amqclchl.tabIBM i: /QIBM/UserData/mqm/@ipccIBM MQ Appliance: _AMQCLCHL.TAB. They appear under the mqbackup:// URI.You cannot specify Cipherspec using theMQSERVERenvironment variable. This is referenced in the IBM MQ Knowledge Center pageConfiguring > Configuring connections between the server and clients > Using IBM MQ environment variables > MQSERVERMQSERVER environment variable is used to define a minimal channel.\n MQSERVER specifies the location of the IBM\u00ae MQ server and the\n communication method to be used.You cannot use MQSERVER to define an SSL channel or a channel with\n channel exits. For details of how to define an SSL channel, see\n Protecting channels with SSL.\n"}
+{"text": "### Human: We are using IBM MQ XMS C# client ver 9.0 (on .NET 4.6.2 framework) to work with IBM MQ. I just need to know of all the messages on a given queue without removing them off the queue.We also got the Consumers set up for the queue. Need both consumers & browsers working in tandem. Browser should not remove messages but still need to get all the messages.So I have set up a QueueBrowser like below, but queueBrowser.GetEnumerator() doesn't get messages at all.With the same code if Create a MessageConsumer and attach a listener, it will get the messages posted the queue. So issue with QueueBrowser only.Can anyone point out why its happening like this. Why queueEnumerator.MoveNext() always return false, indicating no messages on the queue.XMSFactoryFactory xMSFactoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n\n // Create WMQ Connection Factory.\n IConnectionFactory connectionFactory = xMSFactoryFactory.CreateConnectionFactory();\n\n connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, \"hostname\");\n connectionFactory.SetIntProperty(XMSC.WMQ_PORT, portNumber);\n connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, \"channelName\");\n connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\n connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"QueueManagerName\");\n\n // Create connection.\n connectionWMQ = connectionFactory.CreateConnection();\n connectionWMQ.ExceptionListener = new ExceptionListener(OnXMSException);\n\n // Create session\n ISession sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n\n IDestination destination = sessionWMQ.CreateQueue(\"QueueName\"); \n\n\n IQueueBrowser queueBrowser = sessionWMQ.CreateBrowser(destination);\n\n connectionWMQ.Start();\n\n Thread thread = new Thread(KeepBrowsingMessaegs);\n thread.Start();\n\n --end of the method\n\n private void KeepBrowsingMessaegs()\n {\n IEnumerator queueEnumerator = queueBrowser.GetEnumerator();\n while (!cancellationTokenSource.IsCancellationRequested)\n {\n\n if (queueEnumerator.MoveNext())\n {\n ITextMessage textMessage = queueEnumerator.Current as ITextMessage;\n if (textMessage != null)\n {\n System.Diagnostics.Trace.Write(textMessage);\n }\n }\n }\n }### Assistant: OP mentioned the following in the comments:We have consumers running to read the message as part of business case and want to set up browser so that we just get a copy of message so that we can track it in a separate application to log of all the message received.I am providing some options below.Option 1Do not have a separate application just for the purpose of log the messages received, instead have your \"business case\" application log the messages as part of the processing.Option 2Setup two queues, the first would receive the inbound messages and be consumed by an application that would log the messages and then put a copy of it to a second queue which would be consumed by your \"business case\" application.Option 3Use IBM MQ pub/sub features to create two copies of the message, one of which will be consumed by an application that would log the messages and the other would be consumed by your \"business case\" application. Note this only copies the message body, the MQ Message Descriptor (MQMD) which is meta data about the messages (things like put time, put date, message id, userid) will not be duplicated. Many apps do not look at the MQMD so it may not be a issue for you.The setup would look like this:Create aQALIASfor the inbound messages, this alias will point to a topic string by specifying the target is a topic object:DEFINE QALIAS(INBOUND.QUEUE) TARGET(INBOUND.TOPIC) TARGTYPE(TOPIC)Define theTOPICobject:DEFINE TOPIC(INBOUND.TOPIC) TOPICSTR(INBOUND/TOPIC)Create twoQLOCALobjects, one to be consumed by the application that would log the messages and the other to be consumed by your \"business case\" application:DEFINE QLOCAL(INBOUND.QUEUE.LOGGER)\nDEFINE QLOCAL(INBOUND.QUEUE.PROCESSOR)Define two administrativeSUBSCRIPTIONobjects to subscribe both queues to the topic topic string:DEFINE SUB(INBOUND.QUEUE.LOGGER.SUB) TOPICSTR(INBOUND/TOPIC) DEST(INBOUND.QUEUE.LOGGER)\nDEFINE SUB(INBOUND.QUEUE.PROCESSOR.SUB) TOPICSTR(INBOUND/TOPIC) DEST(INBOUND.QUEUE.PROCESSOR)The result of the above setup is that every message that is put to a queue calledINBOUND.QUEUEwill have a copy published to the two queuesINBOUND.QUEUE.LOGGERandINBOUND.QUEUE.PROCESSOR.Option 4You could setup threeQLOCALobjects, one would be the queue for inbound messages, you would have a program read from this queue and then write a copy of the message to the other two queues. There is an open source tool maintained by Capitalware calledMessage Multiplexer (MMX)which can read from a source queue and write to one or more queues, this does duplicate the MQMD along with the message body.The setup would look like this:Create threeQLOCALobjects, the first one to be consumed an application which will make a copy to the second to be consumed by the application that would log the messages and the third to be consumed by your \"business case\" application:DEFINE QLOCAL(INBOUND.QUEUE)\nDEFINE QLOCAL(INBOUND.QUEUE.LOGGER)\nDEFINE QLOCAL(INBOUND.QUEUE.PROCESSOR)Option 5There is a commercial product calledMQ Message Replication (MQMR)that can make an exact copy of the message going to your \"business case\" application queue to one or more other queues using a MQ API exit. I have not used this personally but the setup would be just two QLOCAL queues, the first would be consumed by your \"business case\" application, the second would be consumed by the application that would log the messages.DEFINE QLOCAL(INBOUND.QUEUE)\nDEFINE QLOCAL(INBOUND.QUEUE.LOGGER)\n"}
+{"text": "### Human: I could successfully connect to IBM MQ from a camel route and initialize the connection factory bean but now I want to connect with SSL.I create the key store on the server side for the queue manager and create the certificate and add it to it.I create a trust store on the client side and add the certificate to it.And now I want the MQ connection factory to refer to the trust store while connecting to the server.Here is what I tried:\n \n \n \n \n \n \n \n But this doesn't work. The following exception was returned:JMSWMQ0018: Failed to connect to queue manager 'QM_TEST_SSL' \n with connection mode 'Client' and host name '10.3.13.161(1415)'.; \n nested exception is com.ibm.mq.MQException: JMSCMQ0001: \n WebSphere MQ call failed with compcode '2' ('MQCC_FAILED')\n reason '2397' ('MQRC_JSSE_ERROR').Can anyone please help to direct me how to do that?### Assistant: From a security standpoint the Client should only receive generic error messages which could relate to a number of problems. The best place to find out exactly why you client was rejected is the Queue Manager logs. I would suggest looking there to see if there are any errors that help you further determine the problem.\nFrom the info given i can think of 3 problems it could be:The Queue Manager channel is set with an attribute of SSLCAUTH(REQUIRED) however from the description you've given here the client doesn't appear to be using it's own certificate to connect. SSLCAUTH(REQUIRED) will mean that the Queue Manager will only accept connections on the particular channel where the client is connecting with a certificate it trusts. Check the channel definition and setSSLCAUTH(OPTIONAL)Depending on your version of IBM MQ the CipherSpec you have used (SSL_RSA_WITH_NULL_MD5) is considered weak and will not be accepted by default. You can reenable these deprecated CipherSpecs and the instructions on how to do so can be found on thefollowing Knowledge Center pageThe truststore \"C:/Servers/TrustStore/truststore.jks\" is not being picked up by the client and so the client cannot trust the Queue Manager's certificate. Double check the path you have supplied and remove the \"file:\" you have added to the path (unless you were specifically instructed to include it).\n"}
+{"text": "### Human: I am trying to connect to Queue Manager using MQ api and I am able to connect to queue managerMQQueueManager queueManager=new MQQueueManager(qmgrName);\nqueueManager.accessQueue(qName,MQOO_OUTPUT);But when I try to connect to the same queue manager using JMS it fails with 2058 code.Not sure if I am missing something with JMSMQQueueConnectionFactory qcf=new MQQueueConnectionFactory();\n qcf.setQueueManager(qmgrName);\n qcf.setPort(1414);\n qcf.setHostname(\"localhost\");\n qcf.createQueueConnection();### Assistant: You have two or more queue managers on the local host. In your first example you connect in bindings mode so the queue manager is selected by name and you get the right one. In the second example the connection is being made over a client connection and so is received by the QMgr listening on 1414 which is not the one that you intend so the connection is rejected.Please note that if both QMgrs have a listener on 1414 the connection will succeed or fail depending on which QMgr was started first. Only one can bind to that port so the first one started on it gets to use it. This might lead to what appears to be inconsistent behavior.Please seeConnection modes for IBM MQ classes for JMSwhich advises \"To change the connection options used by the IBM MQ classes for JMS, modify the Connection Factory propertyCONNOPT.\" The acceptable values are provided on the page but you almost always want it to set for Standard Bindings (MQCNO_STANDARD_BINDING).\n"}
+{"text": "### Human: As stated in the title. I have queue manager with IPADDR configured as (IPV4). However any time I start listener on that queue manager it listens trough TCP6.WebSphere Version: 7.5### Assistant: Please note the documentation on theMigrating a queue manager to IPv6page which states that:The preferred IP version that two systems use for communicating (if\n both IPv4 and IPv6 are available) is determined by a new queue manager\n attribute IPADDRV.This parameter only has an effect if the hostname\n resolves ambiguously to both an IPv4 address and an IPv6 address.(Emphasis added.) Note that a parameter whose effect depends on resolving a DNS name would apply mainly tooutboundconnections.What you want is theIPADDRparameter of theDEFINE LISTENERcommand which states:IP address for the listener specified in IPv4 dotted decimal, IPv6\n hexadecimal notation, or alphanumeric host name form. If you do not\n specify a value for this parameter, the listener listens on all\n configured IPv4 and IPv6 stacks.This is the exception to theIPADDRVguidance about name resolution applying to outbound connections. If you put a DNS name in theIPADDRof the listener, then the listener will use whichever IP version address to which that name resolves, or if it resolves to both IPV4 and IPV6 will take the version set inIPADDRV.Since you reportIPADDRVas having no effect then the listener is either bound to an IPV6 address or DNS name, or else the listener is not bound to any particular address and is listening promiscuously on all interfaces.\n"}
+{"text": "### Human: ByIn MQ HA server (multi-instance) both the queue managers shows the status us Running Else where.\nUnable to stop or start the queue manager.\nNo queue manager logs or error logs are getting created.\nMQ file system seems to be good.### Assistant: Verify that you have the latest fixpack installed to be sure you have fix forAPAR IV50422which reports a multi-instance queue manager as running elsewhere when it is not.Please also confirm the shared file system you are using meets therequirements.The way that the MQ multi-instance feature works is as follows:One qmgr is started on one node. Another qmgr is started on another \nnode. Both qmgrs access the same qmgr data. Both try to get the lock on \nthe same \"master\" file. The successful qmgr regards itself as the active\nqmgr, writes identification information into the \"master\" file, and \nholds onto the lock. It commences full running as the active qmgr.The unsuccessful qmgr regards itself as the standby qmgr and simply \nretries trying to obtain the lock on \"master\".The active qmgr \"monitors\" the \"master\" file, reading it every 10s to \ncheck that the information it wrote into it when it became the active \nqmgr is unchanged.If the active qmgr ends for whatever reason, the lock on \"master\" is \ndropped and the standby qmgr then gains the lock and becomes the active \nqmgr, writing its info into \"master\" and starting up full running.It seems to me your problem may be with the lock on the master file. \nThe switching between active and standby queue managers is governed by \nlocks on files (\"active\", \"master\" and \"standby\") in the queue manager \ndata directory.In WebSphere MQ the following files are created by the queue manager /var/mqm/qmgrs/QMGR/active /var/mqm/qmgrs/QMGR/master These files contain status information. \nPlease check to see if these files are locked and if you are unable to \nrelease the file lock.There are 4 files that come into play to determine what mode and status \nmulti-instance qmgrs are in: \namqmfsck.lck, active, standby, master. These files are used by various \nmq process to determine status and functions of the qmgrs. Check the status of those files, as they may falsely be indicating qmgr as running when it is not.\n"}
+{"text": "### Human: I have written an ant script to transfer a single file using IBM WebSphere MQ File Transfer Edition.\n \n \n \nFor two files, the script would look like below:\n \n \n \n \nHow can I modify the script so that it can support multiple files by accepting a string (e.g. a.txt,b.txt,c.txt) as parameter?### Assistant: How can I modify the script so that it can support multiple files?Since your example already sends multiple files, presumably you are asking how to transfer avariablenumber of files to be determined at run time. There are a few options.Use a wildcarded filespec. All matching files will be transferred.Transfer an entire directory recursively.Dynamically generate the file transfer XML so as to include a filespec for each individual file.Use a monitor that starts file transfers based on trigger criteria.Based on the update, the requirement is to pass a string containing file names. Most likely, you will want to use Option #3 above. Pass the string of file names to something that can parse them, then generate the XML. This can be done with shell scripting, or in Ant using something likeant-contrib, or many other ways. There is nothing in the XSD for MQMFT that allows specification of file names natively as a delimited string.\n"}
+{"text": "### Human: When using IBM.XMS to send messages to a topic that does not exist no exception is thrown. When trying the same with a queue, I am kindly notified that the queue manager or queue don't exist.This is how I create a connection and send messages to a topic:XMSFactoryFactory xmsFactoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\nIConnectionFactory ibmConnectionFactory = xmsFactoryFactory.CreateConnectionFactory();\nibmConnectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, \"frimasrv\");\nibmConnectionFactory.SetIntProperty(XMSC.WMQ_PORT, 1415);\nibmConnectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, \"CH1\");\nibmConnectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\nibmConnectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"API\");\n\nIConnection connection = ibmConnectionFactory.CreateConnection();\nconnection.ClientID = \"client id\";\nISession session = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n\nIDestination destination = session.CreateTopic(\"this.does.not.exist\");\nIMessageProducer producer = session.CreateProducer(destination);\nIMessageConsumer durableConsumer = session.CreateDurableSubscriber(destination, \"subscriptionName\");\n\nIMessage myMessage = session.CreateTextMessage(\"text\");\nproducer.Send(myMessage);Supplement the call of session.CreateTopic(...) with session.CreateQueue(...) and session.CreateProducer(...) will fail. This is the behaviour I also expect when using topics.My questions are:How come that no problems arise when sending to a topic that does not exist? \nIs part of my configuration wrong?\nIs there some other way to verify if a topic actually exists?### Assistant: How come that no problems arise when sending to a topic that does not\n exist?Because the moment you send a message to a topic or subscribe to a topic it exists. The queue manager will auto-vivify it for you.According to the JMS 2.1 specification:Some products require that topics be statically defined with\n associated authorization control lists, and so on; others don\u2019t even\n have the concept of topic administration.IBM MQ is one of the products that does not require topics to be statically defined.You may have misunderstood IBM MQ's use of topic objects. These do not define the topics themselves, but rather they provide a pointer to the place in the topic hierarchy where an access control list applies. For example, consider the following topic hierarchy:Produce\n Fruits\n Apple\n Banana\n Cranberry\n Vegetables\n Asparagus\n Beet\n CeleryIf youdefine a topicFruitsand point it at the topic stringProduce/Fruitsyou can then authorize people to publish or subscribe to the portion of the topic tree from Produce/Fruits on down. Those with the authorization will not be able to accessProduce/Vegetablesunless you provide them access through a topic object pointing there.As a rule, it is best to define topic objects all at a certain level of the topic tree. As you can see above, defining a topic object atProducegrants access to the entire topic tree, but you need only one topic object. Define the objects at the second level and you need two to cover the tree (one atFruitsand one atVegetables) but have more granularity in the security model. Define the topics at the third level and you have extreme granularity, but also have many more topic objects to administer.IBM MQ defines a default topic objectSYSTEM.BASE.TOPICwhich points to the root of the global topic space. Anyone with access toSYSTEM.BASE.TOPICcan access any topic. By default, this includes only MQ administrators.If you define a topic calledFruitsand point it at the topic stringProduce/Fruitsthen you have two choices when you want to open that topic. If you open the topicobjectwhich results in IBM MQ substituting the topicstringto which the object points. You can also open the topicstringdirectly. Either of these results in the same effective authorization since IBM MQ always authorizes based on the final topic string.If you specify both a topic objectanda topic string, the topic string in the defined object is used as the prefix to the string that you provide. The two are concatenated to produce the full topic string. For example, if you specify both the topic objectFruits(which points to the stringProduce/Fruitsin the example above)andthe stringProduce/Fruits, MQ concatenates these and vivifies a topic calledProduce/Fruits/Produce/Fruits. Try not to do that. IF you do need to do that, make sure you understand the mechanics as described in theCombining topic stringspage.If you check the IBM MQ Pub/Sub API or the IBM implementation of the topic connection factory, you will see that these contain two fields, one for the topic object and one for the topic string.When you specify a topicobjectin your connection factory, that objectmustexist. Specify a topicstringand MQ will auto-vivify it for you if you are authorized to that string.I am guessing the ID you are using has admin rights or has been granted access toSYSTEM.BASE.TOPICsince you are able to publish at all. You will therefore not receive any errors for any topic string to which you publish.Please see also theTopic Stringspage in the manual for a general background of how IBM MQ manages topics.\n"}
+{"text": "### Human: Tomcat has a built-in JDBC connection pooling, but unfortunately no built-in JMS connection pooling.We are migrating a legacy Tomcat web application from WebSphere MQ version 6 to 7. \nUnfortunately, connection pooling has been removed in WebSphere MQ 7 as described here:http://www-01.ibm.com/support/docview.wss?uid=swg21665128Now we are afraid that we will run into troubles if we just use the following code for configuring MQ in Tomcat:The reason for our concerns is that this will not use a pooled JMS provider when using MQ 7. For details, see alsohttp://activemq.apache.org/jmstemplate-gotchas.htmlAlternative solutions we see are:1) Use of AtomikosAtomikos has a com.atomikos.jms.AtomikosConnectionFactoryBean that can be used instead of MQQueueConnectionFactory\nBut using an XA transaction manager is a huge overhead when we don't need XA2) Use Spring's CachingConnectionFactorylooks like a good solution, but unfortunately our legacy application does not use Spring.\nSo we assume that using CachingConnectionFactory would mean quite some effort.3) Use Apache Commons Poollooks promising too, but implementing it correctly for JMS will require some good JMS knowledgeOur questions:is there a JMS provider that can be used to wrap MQQueueConnectionFactory and that will pool connections, sessions, producers and consumers?did anyone succeed in implementing one of the alternative solutions we outlined above?### Assistant: As proposed by Umapathy in option 3, we now opted for the approach using Spring's CachingConnectionFactory, and it works well even for a non-Spring application. All you need to do is add the Spring Jars to the classpath, and wrap the MQQueueConnectionFactory with a CachingConnectionFactory.We chose to create our own Tomcat QueueConnectionFactoryFactory that enables us to leave the original application code completely untouched, you just need to replace the original MQ connection factory from the Tomcat configuration file (shown above in the question) with the following XML definition:Here is the (simplified) code (without error checking) for the RSFCachingMQQueueConnectionFactoryFactory:public class RSFCachingMQQueueConnectionFactoryFactory implements ObjectFactory{\n\npublic Object getObjectInstance (Object obj, Name name, Context nameCtx, Hashtable,?> environment)\n throws NamingException {\n Reference ref = (Reference) obj;\n String beanClassName = ref.getClassName();\n Class> beanClass = Class.forName(beanClassName);\n if (CachingConnectionFactory.class.isAssignableFrom(beanClass)){\n MQQueueConnectionFactoryFactory cff = new MQQueueConnectionFactoryFactory();\n Reference mqReference = new Reference(\n MQQueueConnectionFactory.class.getName());\n\n Enumeration allAddrs = ref.getAll();\n while (allAddrs.hasMoreElements()){\n mqReference.add(allAddrs.nextElement());\n }\n\n MQQueueConnectionFactory cf = (MQQueueConnectionFactory)cff.getObjectInstance(mqReference, name, nameCtx, environment);\n CachingConnectionFactory ccf = (CachingConnectionFactory)beanClass.newInstance();\n ccf.setTargetConnectionFactory(cf);\n return ccf;\n }\n }\n"}
+{"text": "### Human: Currently on our Tomcat configuration with JNDI is based on this recommendation which currently is working.How do I connect to a Websphere MQ (MQ Series) server using JMS and JNDI?Since we are upgrading to v8 I would like to take advantage of the JMS 2.0 features. This would require updating the jar files to the JMS 2.0 versions.So I have removed the following jars from the tomcat lib folder.com.ibm.mq.jarcom.ibm.mqjms.jarconnector.jardhbcore.jargeronimo-j2ee-management_1.0_spec-1.0.jargeronimo-jms_1.1_spec-1.0.jarAnd replaced them with these jars. Base on thislinkcom.ibm.mq.allclient.jarcom.ibm.mq.traceControl.jarMy JNDI configuration matches this configuration.\"\n PORT=\"1414\"\n CHAN=\"\"\n TRAN=\"1\"\n QMGR=\"\"/>Now with the updated jar files I'm getting the following exceptions.Caused by: java.lang.NoClassDefFoundError: javax/jms/JMSRuntimeException\n at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:69)\n at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:141)\n at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)\n at org.apache.naming.NamingContext.lookup(NamingContext.java:842)\n at org.apache.naming.NamingContext.lookup(NamingContext.java:153)\n at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)\n at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)\n at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)\n at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:138)\n at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:110)\n at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:82)\n at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)\n at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)\n at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)\n at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:347)\n at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:724)\n at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)\n ... 7 moreQuestions:Should I be including another jar file to the class path?Or has the configuration of JNDI changed for v8?### Assistant: Please doNOTtry adding the JMS Jar found in the MQ installation. IBM has as of v8.0 repackaged JMS so that a stand-alone install of the jar files is now supported. But only if you use the complete and intact set of jars and do not mix and match them on a whim. To do so would be reckless and ill-advised.You are on the right track but for your purposes I would go grab the file fromthe latest 8.0.0.x MQ Client Fix Pack. I would then go tothe Technote that explains the install procedureand try that.I'm sure that IBM has a process for grabbing jars from the server install, however since these appear to be packaged differently, I'd put my money on the package designed and tested for stand-alone delivery - e.g. the one I linked to above.By the way, since this is now supported if it doesn't work you can open a PMR, tell IBM you followed their instructions to the letter, and make them walk through fixing it with you. (Then post here what it was that fixed it.)But they won't do that if you just go grabbing random jar files and hope it works.\n"}
+{"text": "### Human: Just want to confirm the correct way the MQ delivers messages to the MQOutput node. Recently came across a situation where i a felt bit confused. Here is the scenario.I have a local queue on Qmgr,say(A) which receives messages from applications and have a local broker associated with this qmgr(A) with a message flow deployed, which consumes messsages from this queue and drops it to another local(L.B) queue on Queue manager (B).To successfully deliver the messages to qmgr(B) do i have toCreate a remote queue definition on Qmgr(A) with transmission queue name matching the remote queue manager name, here(B) \nMQOutput node value set as, queue->remote queue definition name on (A) and queue manager value as blankorto create only the transmission queue that matches with the name of the remote queue manager name, here(B).\nMQOutput node value set as queue-> target local queue (L.B) and Queue manager value as (B).When i follow with the first process, noticed messages reaching the destination and when i follow with the later one, noticed messages sitting up in the local queue itself.Is there any necessity to always create 'n' number of remote queue definitions when it needs to drop messages to 'n' number of local queues?Kindly guide me to better understand this. Thanks in advance to each of you.### Assistant: There is no necessity to create n remote queue definitions, MQ is happy to accept output marked as destined for \"Queue Name\" on \"Queue Manager Name\".You say that when using method 2. that your messages are \"sitting up in the local queue\". There are a few things you must check to solve this problem.I assume the named queue L.B is defined on QMgr B and not QMgr A?I assume the local queue the messages are sitting on is a transmission queue?Have you defined a channel to read messages from the transmission queue they are stuck on?Have you started the channel which should be moving the messages off the transmission queue to QMgr B?\n"}
+{"text": "### Human: We are working on Integrating websphere MQ with boomi,The Configuration in Boomi for JMS connector is as follows:For JMS Connection :Authentication Present:\nUser : adminstrator\npassword : xxxxx\nJMS Server : Websphere MQ\nConnection type : Single QM connection\nQueue Manager : BoomiQMGR\nChannel Name : BoomiSCFor JMS operation:Destination : queue:BoomiQ(where BoomiQ is the Queue Name, \"queue:\" as mentioned in the boomi Documentation)But the Problem is, \nwith these configuration we encounter the below error in boomi:*\"Test execution of TestProcess completed with errors. Embedded message: Unable to retrieve JMS message; Caused by: JMSCC0005: The specified value 'queue:BoomiQ' is not allowed for 'XMSC_DESTINATION_NAME'.\"From what we can tell in reading around this occurs due to WebSphere MQ destination naming restrictions, we are using WEBSPHERE version : WS_MQ_V8.0_TRIAL_FOR_WINDOWS_ML(downloaded from IBM Site)Can someone help us out on this?Please suggest if we are missing anything.\nThanks in Advance.### Assistant: The problem looks to be the format of the Queue Name: queue:BoomiQ isn't valid for the WMQ JMS client.If the Queue on the QueueManager was say MyQueue, then either ensure that MyQueue is passed to JMS or queue:///MyQueue.\n"}
+{"text": "### Human: I'm new to active MQ.I have a requirement to create a local Active MQ and connect it to a remote IBM MQ.Can anyone help me on how to connect to Distributed Queue manager and Queues .### Assistant: You can use Apache Camel to bridge between the two providers. The routes can be run from within the broker, pull from the ActiveMQ queue and push to the WMQ Queue (or the other way around). The concept is almost like the concept of a Channel in WMQ pulling from a transmit queue and pushing it to the appropriate destination on the remote queue manager.Assuming you are using WMQ V7+ for all QMgrs and Clients, its simply a matter of learning how to set up the route and configure the connection factories. Older versions of WMQ and you may have to understand how to deal with RFH2 headers for native WMQ clients if they are the consumers.The most simple route configured in spring would look like:\n \n \nThe \"wmq\" and \"amq\" would point to beans where the JMS components are configured. This is where you would set up you connection factories to each provider and how the clients behave (transacted or not for example), so I'll hold off on giving an example on that.This would go in the camel.xml (or whatever you name it) and get imported from your broker's XML. ActiveMQ comes with several examples you can use to get you started using Camel JMS components. Just take a look at the default camel.xml that comes with a normal install.\n"}
+{"text": "### Human: Is there a way to find the total number of messages that pass through an IBM websphere MQ queue manager over a specific period of time?### Assistant: This sounds like a perfect use of the MQ Accounting and Statistics feature. Among other things, these features record the number of messages (with a persistent and non-persistent count) and also number of bytes (not all messages are the same size).You can turn on Accounting and Statistics for just a selection of queues and/or channels or for everything.Further Reading:Accounting and statistics messagesTurning on Queue AccountingTurning on Queue StatisticsSupplied tool to view the output\n"}
+{"text": "### Human: I'm trying to configure a clustered websphere application server that connects to a clustered MQ.However, the the information I have is details for two instances of MQ with different host names, server channels and queue manager which belongs to the same MQ cluster name.On the websphere console, I can see input fields for hostname, queue manager and server channel, I cannot find anything that I can specify multiple MQ details.If I pick one of the MQ detail, will MQ clustering still work? If not, how will I enable MQ clustering given the details I have?### Assistant: WebSphere MQ clustering affects the behavior of how queue managers talk amongst themselves. It doesnotchange how an application connects or talks to a queue manager so the question as asked seems to be assuming some sort of clustering behavior that is not present in WMQ.To set up the app server with two addresses, please seeConfiguring multi-instance queue manager connections with WebSphere MQ messaging provider custom propertiesin the WAS v7 Knowledge Center for instructions on how to configure a connection factory with a multi-instanceCONNAMEvalue.If you specify a valid QMgr name in the Connection Factory and the QMgr to which the app connects doesn't have that specific name then the connection is rejected. Normally a multi-instanceCONNAMEis used to connect to a multi-instance QMgr. This is a single highly available queue manager that can be at one of two different IP addresses so using a real QMgr name works in that case. But if the QMgrs to which your app is connecting are two distinct and different-named queue managers, which is what you described, you should specify an asterisk (a*character) as the queue manager name in your connection factory as describedhere. This way the app will not check the name of the QMgr when it gets a connection.If I pick one of the MQ detail, will MQ clustering still work? If not,\n how will I enable MQ clustering given the details I have?Depends on what you mean by \"clustering\". If you believe that the app will see one logical queue which is hosted by two queue managers, then no. That's not how WMQ clustering works. Each queue manager hosting a clustered queue gets a subset of messages sent to that queue. Any apps getting from that queue will therefore only ever see the local subset.But if by \"clustering\" you intend to connect alternately to one or the other of the two queue managers and transmit messages to a queue that is in the same cluster but not hosted on either of the two QMgrs to which you connect, then yes it will work fine. If your Connection Factory knows of only one of the two QMgrs you will only connect to that QMgr, and sending messages to the cluster will still work. But set it up as described in the links I've provided and your app will be able to connect to either of the two QMgrs and you can easily test that by stopping the channel on the one it connects to and watching it connect to the other one.Good luck!UPDATE:To be clear the detail provide are similar to hostname01, qmgr01,\n queueA, serverchannel01. And the other is hostname02, qmgr02, queueA,\n serverchannel02.WMQ Clients will connect to two different QMgrs using a multi-instanceCONNAMEonly when...The channel name used on both QMgrs is the exactly the sameThe application uses an asterisk (a*character) or a space for the QMgr name when the connection request is made (i.e. in the Connection Factory).It is possible to have WMQ connect to one of several different queue managers where the channel name differs on each by using a Client Connection Definition Table, also known as a CCDT. The CCDT is a compiled artifact that you create usingMQSCcommands to defineCLNTCONNchannels. It contains entries for each of the QMgrs the client is eligible to connect to. Each can have a different QMgr name, host, port and channel. However, when defining theCCDTthe administrator defines all the entries such that the QMgr name is replaced with the application High Level Qualifier. For example, the Payroll app wants to connect to any 1 of 3 different QMgrs. The WMQ Admin defines a CCDT with three entries but usesPAY01,PAY02, andPAY03for the QMgr names. Note this does not need to match the actual QMgr names. The application then specifies the QMgr name asPAY*which selects all three QMgrs in the CCDT.Please seeUsing a client channel definition table with WebSphere MQ classes for JMSfor more details on the CCDT.Is MQ cluster not similar to application server clusters?No, not at all.Wherein two-child nodes are connected to a cluster. And an F5 URL will\n be used to distribute the load to each node. Does not WMQ come with a\n cluster url / f5 that we just send message to and the partitioning of\n messages are transparent?No. The WMQ cluster provides a namespace within which applications and QMgrs can resolve non-local objects such as queues and topics. The only thing that ever connects to a WebSphere MQ cluster is a queue manager. Applications and human usersalwaysconnect to specific queue managers. There may be a set of interchangeable queue managers such as with the CCDT, but each is independent.With WAS the messaging engine may run on several nodes, but it provides a single logical queue from which applications can get messages. With WMQ each node hosting that queue gets a subset of the messages and any application consuming those messages sees only that subset.HTTP is stateless and so an F5 URL works great. When it does maintain a session, that session exists mainly to optimize away connection overhead and tends to be short lived. WMQ client channels are stateful and coordinate both single-phase and two-phase units of work. If an application fails over to another QMgr during a UOW, it has no way to reconcile that UOW.Because of the nature of WMQ connections, F5 isneverused between QMgrs. It is only used between client and QMgr for connection balancing and not message traffic balancing. Furthermore, the absence or presence of an MQ cluster is entirely transparent to the application which, in either case, simply connects to a QMgr to get and./or put messages. Use of a Multi-InstanceCONNAMEor a CCDT file makes that connection more robust by providing multiple equivalent QMgrs to which the client can connect but that has nothing whatever to do with WMQ clustering.Does that help?Please see:ClusteringHow Clusters WorkQueue manager groups in the CCDTConnecting WebSphere MQ MQI client applications to queue managers\n"}
+{"text": "### Human: I am trying to connect a queue manager from a standalone program and am getting the following error.Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').I understand that the connecting ID needs to be configured at the MQ to allow this connection.But strangely, when I try to connect from Websphere Application Server (WAS), I am successfully connected to the queue.\nMy standalone program is using the same JDK as WAS.Should the JVM ID for both these programs be the same?I am using a CCDT file to connect to the queue.### Assistant: Well it is authorization error on client connection. No doubt about that. Seeherefor troubleshooting technote.For start make sure that user which are you using is given proper rights (it isn't). Make sure that you are not using MQ administrator account with WMQ v7.1 or newer. \nSince 7.1 MQ Administrators are not allowed to create client connection with default configuration. This default can be changed. Seehere.One option is to use MCA user on client channel. This overrides whatever user you are passing. It is explainedhere.WAS is either using different user or bindings connection mode.\n"}
+{"text": "### Human: I have zero experience with Websphere MQ Messenger. I need to build a .NET application that will read from an 7.1 MQ Series queue, manipulate the message and write it to another queue.I want to try and build a POC to do this. Is it possible to install a Websphere MQ server and client on a non networked Windows 7 machine to build this POC. If so, what MQ software do I need and are their trial versions available?Thanks### Assistant: You can install WebSphere MQ on a stand alone machine. Both queue manager and your .NET application must run on the same machine in that case. Download WMQ v7.5 server installation from IBM site. While installing choose to install Windows Client also. Server component is installed by default. After installation use WebSphere MQ Explorer to create queue manager. Many .NET samples are shipped with the product and you can find them in tools directory of WMQ. installation.\n"}
+{"text": "### Human: I am working with someone who is trying to achieve a load-balancing behavior using JMS Queues with IBM Websphere MQ. As such, they have multiple Camel JMS consumers configured to read from the same Queue. Despite that this behavior is undefined according to the JMS spec (last time I looked anyway), they expect a sort of round-robin / load-balancing behavior. And, while the spec leaves this undefined, I'm led to believe that the normal behavior of Websphere MQ is to deliver the message to only one of the consumers, and that itmaydo some type of load-balancing. See here, for example:When multi MessageConsumer connect to same queue(Websphere MQ),how to load balance message-consumer?But in this particular case, it appears thatbothconsumers are receiving the same message.Can anyone who is more of an expert with Websphere MQ shed any light on this? Is there any situation where this behavior is expected? Is there any configuration change that can alleviate this?I'm leaning towards telling everyone here to use the native Websphere MQ clustering facility and go away from having multiple consumers pointing at the same Queue, but that will be a big change for them, so I'd love to discover a way to make this work.Not that I'm a fan of relying on anything that's undefined, but if they're willing to rely on IBM specific behavior, I'll leave that up to them.### Assistant: The only way for them to both receive the same messages are:There are multiple copies of the message.The apps are browsing the message without a lock, then circling back to delete it.The apps are backing out a transaction and making the message available again.The connection is severed before the app acknowledges the message.Having multiple apps compete for messages in a queue is a recommended practice. If one app goes down the queue is still served. In a cluster this is crucial because the cluster will continue to direct messages to the un-served queue instance until it fills up.If it's a Dev system, installSupportPac MA0Wand tell it to trace just that one queue and you will be able to see exactly what is happening.See the JMS spec in section 4.4. The provider must never deliver a second copy of an acknowledged message. Exception is made for session handling in 4.4.13 which I cover in #4 above. That's pretty unambiguous and part of the official spec so not an IBM-specific behavior.\n"}
+{"text": "### Human: In WAS console, on the Queues page, there is an option called 'Target Client' and the options are MQ and JMS. Now MQ i understand is websphere MQ, but what is JMS? Any JMS provider other than Websphere MQ? Because in my case the target is actually websphere MQ but i have selected JMS here and it still works fine.### Assistant: Target client defines how the message will intepreted by the receiving application.\nIf you choose MQ, then a RFH2 header will be added with MQ specific info otherwise JMS info will be added (jms_bytes, jms_text etc..).IBM has some info about it\n"}
+{"text": "### Human: I am choosing between two options for a client server application -First - Go for a TCP/IP (Pure socket based) approach with multithreaded server and manage the synchronization of send and receive myself.Second - use and WebSphere MQ approach (MQI). Basically one input Queue and one output Queue for the server. The clients write to the server input queue and the server puts the reply in output queue with some correlation identifier etc. So only 2 queues needed.The server program is multithreaded (thread pools) and multiple threads will read on the input queue and write on the output queue.Question - I am leaning towards the second approach but have few doubts -Are MQI calls thread safe? Do I have to use some mutual exclusion forMQGETandMQPUTfor the queues.Will the performance of MQ based approach be lower than socket based. By performance I mean two things.a. Are IBM MQ queue operation slower than direct socket connections in general?b. Will the mutual exclusion locks onMQGETandMQPUTslow down the message processing?c. I plan to have a load of around 10000 messages per second (each around 100 bytes). The replies will be about 5 KB (XML messages). Is this a practical load for IBM MQ based approach?Note - The language is C++ and operating system for the server is Solaris.### Assistant: The use case you are describing is incredibly narrow. It's never just a case of \"sockets or queues\" but other considerations must factor into the business case:How will the thing be monitored and managed? Will it be necessary to write all the parts that report system health to the NOC and provide message stats, or can I use what MQ provides?Do I need queuing or is this truly a synchronous app?Is this really point-to-point or do the apps involved participate in an ecosystem of services and upstream/downstream connections? What else does it need to integrate with?Is there a need for message enrichment, routing, fan-in, fan-out, pub/sub or other functionality? Write code or use WMQ/WMQ Broker native features?Do the connections require authentication? Encryption? Write code or use WMQ native features?Are there regulatory compliance factors involved and if so what's the cost of auditing custom code vs. COTS transport?Does the shop have deep C++ skills and prepared to maintain that depth of bench for the lifetime of the code?How is the connection configuration managed and does it support HA and DR seamlessly? Write code or use WMQ native features?How will exception logic and automatic reconnect be managed? Write code or use WMQ native features?The business case has to consider a lot more than raw speed. This is especially true when both alternatives are capable of meeting the throughput requirement as should be the case here. Once the functional requirements are met it is all these other aspects (and more I haven't thought of off the top of my head) that must be considered in the business case.As for the specific questions...Access to the queues is managed the way you'd hope. Multiple threads compete for the same messages but a message delivered to one is not delivered to another thread. Exceptions are if the message is rolled back and becomes available again or the app is using pub/sub and intentionally receiving more than one copy of the message.On the app side, the calls are thread safe within a session. So all threads using the same sessionCOMMITtogether. Usually a pair of threads using request/reply operates cooperatively. Otherwise, one session per thread gives you what you need.As for performance, this is an apples-to-oranges comparison. The question is whether a C++ sockets program that provides all the services, diagnostics, resiliency and other features of an async messaging transport performs on par with that transport. The answer there is usually no. WMQ has been optimized for 20 years to do one thing and to do it extremely well. A new custom C++ sockets program will move data faster but not provide the same functionality. So it comes down to whether the app needs so little of WMQ's functionality that it's cheaper in the long run to custom code the few functions it needs, then maintain that for the life of the app. Again, the answer is usually no.For specifics on message throughput rates, go to theSupportPacspage and look for the ones with names beginning MP__ for theplatform and version you need. Achieving 10k MPS for small messages is possible on even modest hardware.\n"}
+{"text": "### Human: I am trying to put some messages from a JMS code to a local queue defined in local queue manager. I have defined a local QueueLQin WebSphere MQ and using JMS code to put messages. Am I doing it proper here. I am not seeing the messages in WebSphere queue.Here is the code:try {\n MQQueueConnectionFactory cf = new MQQueueConnectionFactory();\n //set up the Connection Configuration values\n\n // Set the properties\n cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, \"HostName\");\n cf.setIntProperty(WMQConstants.WMQ_PORT, 1414);\n cf.setStringProperty(WMQConstants.WMQ_CHANNEL, \"SYSTEM.DEF.SVRCONN\");\n cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\n cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, \"TEST.JMS\");\n\n //JNDI is Not used Here\n MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();\n\n MQQueueSession session = (MQQueueSession) connection.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);\n MQQueue queue = (MQQueue) session.createQueue(\"queue:///LQ\");\n MQQueueSender sender = (MQQueueSender) session.createSender(queue);\n MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue);\n\n long uniqueNumber = System.currentTimeMillis() % 1000;\n\n JMSTextMessage message = (JMSTextMessage) session.createTextMessage(\"MQJMSTest \"+ uniqueNumber); \n //MQMessage message = (MQMessage) session.createTextMessage(\"MQJMSTest \"+ uniqueNumber);\n\n\n // Start the connection\n connection.start();\n\n sender.send(message);\n System.out.println(\"Sent message:\\\\n\" + message);\n\n //JMSMessage receivedMessage = (JMSMessage) receiver.receive(10000);\n // System.out.println(\"\\\\nReceived message:\\\\n\" + receivedMessage);\n\n sender.close();\n receiver.close();\n session.close();\n connection.stop();\n connection.close();\n\n System.out.println(\"\\\\nSUCCESS\\\\n\");\n\n} catch (JMSException e) {\n // TODO Auto-generated catch block\n //e.printStackTrace();\n System.out.println(e);\n System.out.println(\"\\\\nFAILURE\\\\n\");\n}\n catch (Exception e){\n System.out.println(e);\n System.out.println(\"\\\\nFAILURE\\\\n\");\n}### Assistant: According to this, you've created a transacted session:connection.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);According tothe docs,When an application closes a transacted session, an implicit rollback\n occurs. When an application closes a connection, an implicit rollback\n occurs for all the connection's transacted sessions.A rollback would remove any messages on the queue before they ever became visible outside the application that PUT them. So I'm thinking you might want to COMMIT the transaction, yes?sender.send(message);\n\n // ADD THIS HERE ===========================\n session.commit();\n // ADD THIS HERE ===========================\n\n System.out.println(\"Sent message:\\\\n\" + message);\n\n // THE COMMIT MUST HAVE OCCURRED BEFORE YOU CAN GET THE MESSAGE\n // BACK OUT OF THE QUEUE IN THE NEXT LINES\n\n //JMSMessage receivedMessage = (JMSMessage) receiver.receive(10000);\n // System.out.println(\"\\\\nReceived message:\\\\n\" + receivedMessage);\n\n // ===================================================\n // DON'T FORGET TO COMMIT THE MESSAGE ON THE WAY BACK OUT OR IT WILL\n // JUST GE TPUT BACK ON THE QUEUE AGAIN.\n // session.commit();\n // ===================================================\n\n\n sender.close();\n receiver.close();\n session.close();PS: Please see the section onJMS Exception handling. The JMS Exception is a multi-tiered structure in which it is expected that vendor-specific diagnostics are placed in the lower-level elements. Only by printing those lower-level elements is it possible to know what the transport layer thinks is wrong.\n"}
+{"text": "### Human: I have a simple code to put 2 messages into a queue.1) I set the connectionNameList with two servers.2) Those two servers are independent, but have the same Queue Manager and Queue defined with same name, such as \"QMgr\" and \"TEST.IN\"3) I set the setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT);I hope when the first server is down, it should send the messages to 2nd one.The test I did:a) I send first message, sender.send(message); It worked.b) sleep 30 seconds.During this time, I shutdown the first serverc) then sleep done, try to send 2nd message, but it failed to send immediatelyFurther more, I tried more, I did try{} catch{} for 2nd message, and in the catch{}, I try to sender.send(message), it still fails.Any idea why it is different than what I expected. I will really appreciate your reply.public static void main(String[] args) throws Exception\n{\n MQQueueConnectionFactory cf = new MQQueueConnectionFactory();\n cf.setConnectionNameList(\"10.230.34.191(1418),10.230.34.169(1418)\");\n\n cf.setQueueManager(\"QMgr\");\n cf.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n cf.setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT);\n cf.setClientReconnectTimeout(600);\n\n System.out.println(\"connect list \" + cf.getConnectionNameList());\n\n MQQueueConnection connection = (MQQueueConnection) cf\n .createQueueConnection(\"mqm\", \"passwd\");\n MQQueueSession session = (MQQueueSession) connection.createQueueSession(false,\n Session.AUTO_ACKNOWLEDGE);\n MQQueue queue = (MQQueue) session.createQueue(\"queue:///TEST.IN\");\n MQQueueSender sender = (MQQueueSender) session.createSender(queue);\n\n long uniqueNumber = System.currentTimeMillis() % 1000;\n JMSTextMessage message = (JMSTextMessage) session.createTextMessage(\"SimplePTP \"\n + uniqueNumber);\n\n // Start the connection\n connection.start();\n\n sender.send(message);\n System.out.println(\"Sent message:\\\\n\" + message);\n\n System.out.println(\"sleep 30 seconds\");\n Thread.sleep(30000);\n uniqueNumber = System.currentTimeMillis() % 1000;\n message = (JMSTextMessage) session.createTextMessage(\"SimplePTP \" + uniqueNumber);\n sender.send(message);\n\n sender.close();\n session.close();\n connection.close();\n\n System.out.println(\"\\\\nSUCCESS\\\\n\");\n }### Assistant: Well this is the simplest test case and should have worked. How did you bring down the first queue manager? Did you down it with a-roption. Remember, without the-roption the clients will not reconnect when queue manager is ended withendmqmcommand.endmqm -r Assuming you used-roption and it still did not work, then my suggestion would be to try the following:Set an exception listener to know what is going on with reconnection. Exception listener would be invoked when the connection is broken and reconnection attempt starts till either reconnection is successful or fails. Exception listener sample code would be something like this:conn.setExceptionListener(new ExceptionListener() {\n\n public void onException(JMSException e) {\n System.out.print(e);\n }\n});\n"}
+{"text": "### Human: I'm about to prepare a deployment specification for the Websphere MQ production environment. As always I hate reinventing the wheel hence the question:\nIs there an article, specififaction of best practices when it comes to deploying and maintaining the Webshpere MQ production environment?Here are more specific doubts of mine:Configuration versioning (MQSC, dmpmqcfg, etc).Deploying new objects (MQSC or manual instructions?)Deployment automation (maybe basing on the diff of dmpmqcfg?).Deploying and versioning configuration alterations.Currently I am simply creating MQ objects manually and versioning the output of dmpmqcfg. However, in a while there are going to be too many deployments to handle it like this.### Assistant: That's an extremely broad question so I'll try to respond before a moderator deletes it. :-)The answer depends on many things such as whether MQ clusters are in use, the approaches to high availability and disaster recovery, the security requirements, whether the QMgrs are configured as dedicated or shared infrastructure, etc. However, there are a few patterns that I follow in almost all cases, including non-Production. This is because things like monitoring and security tend to get dropped at deployment time if not tested in Dev and don't work as expected in Prod.I use a script to create my QMgrs in Production to insure that basics like generating the X.509 certificate (or CSR) is always done according to standards, that any exits or exit parm files are present, that certain SupportPac executables (likeq) are present in/opt/mqm/bin,circular queues, etc. It also checks for negative factors such as GSKit not being installed.I have a baseline script that is run against all QMgrs. This script sets up the DLQ, any queues for monitoring agents, enables events as required, sets up system services, trigger monitors, listeners, etc. The exception is B2B gateway QMgrs which are handled in a class all their own and have very specific configurations not used on the internal network.\ncluster.I have several classes of QMgr with specific configuration requirements. These include cluster repositories (where primary and secondary are distinct sub-types), service-provider QMgrs, and service consumer QMgrs. These all have secondary scripts run against them.I have scripts per-cluster to join or suspend a QMgr in cases where clustering is used (which for me is almost 100% since v7.1).These set up a QMgr's infrastructure. Then I maintain scripts for each application. So for example, if there's a Payroll app, I'll have queues and possibly topics with names containing aPAYnode such asPAY.EMPLOYEE.UPDT.REQ.V032.PRD. Corresponding to that will be a single script for allPAY.**queues. Used to be one forsetmqautcommands too, but these are now in the same script as the objects. I only ever have one version of the script and keep a history of changes in the script. This way when I need to recreate a QMgr, I just run all the scripts for it. Similarly, if I need to deploy thePAYobjects on another QMgr, I just copy the script to that server.When defining objects for clusters, I always do aDEFINE NOREPLACEthat contains all the run-time attributes such as whether the queue is enabled in the cluster. The queue is always defined as disabled in the cluster and for triggering but because I useNOREPLACEre-running the script doesn't change whatever state it has in, say, a month. Those things that are configuration and not run-time, such as the description, are handled in anALTERimmediately after theDEFINEand theseareupdated each time the script is run. There's an article on thishere.Finally, the scripts I use are of the self-executing, self-documenting variety. For example, many people put all the MQSC commands into a script then do something like:runmqsc < payroll.mqsc > payroll.outTONS of problems here. The main one is that it relies on the operator to know a lot and execute the script right all the time. For example, suppose (s)he forgets to capture the output? Or overwrites a previous output? Or doesn't getSTDERRbecause (s)he needs to do the2>&1at the end and doesn't know redirection that well?So my scripts are all written inkshhandle all the capturing of output, complete with time and date stamping andSTDERR, can freely mix MQSC with OS commands, etc. All you do is go to the scripts directory for that QMgr and. ./*kshto build/rebuild a QMgr.I do of course also take regular configuration dumps, but these are more for running queries and reports like \"how many QMgrs have this channel defined and where are they?\" kind of thing.Also, when taking backups there is almost NEVER a good reason to back up a QMgr at a point in time. However, if it is required be sure to stop the QMgr first. Also, think long and hard about capturing certificates in a backup. Many people are good about locking the certificate directory so onlymqmcan read it but often the backups are unprotected. As long as you aren't trying to restore on top of Production, many shops let you restore the Production/var/mqm/*files to your own sandbox. If the QMgr's KDB files are included, you just lost them. An alternative is to put the certificates in/etcor some other directory that is protected but not backed up with the QMgr's directories.\n"}
+{"text": "### Human: We are developing a console application using c# to access IBM WMQ. We are using IBM Message Service Client for .net (XMS) and WebSphere MQ Client. Here are the code example:XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n IConnectionFactory cf = xff.CreateConnectionFactory();\n cf.SetStringProperty(XMSC.WMQ_HOST_NAME, \"host\");\n cf.SetIntProperty(XMSC.WMQ_PORT, 1445);\n cf.SetStringProperty(XMSC.WMQ_CHANNEL, \"channel\");\n cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\n cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"queueManager\");\n cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1);\n cf.SetStringProperty(XMSC.USERID, @\"userid\");\n cf.SetStringProperty(XMSC.PASSWORD, @\"\");\n\n IConnection conn = cf.CreateConnection();\n conn.ExceptionListener = new ExceptionListener(OnXMSExceptionReceived);\n Console.WriteLine(\"connection created\");\n ISession sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge);We kept getting the following error:\n CWSMQ0044E: The user is not authorized to connect to the queue manager. The application has tried to connect to a queue manager without authorization. Ensure th\nat appropriate authority exists on the queue manager for this user.But we have no problem to access the same MQ using spring integration. here is the settings for spring integration:\n \n \n \n \n \n\n\n\n \n \nI am new to XMS and .net, do not know how to pass the authentication info for connecting to MQ. any recommendations are highly welcome!### Assistant: XMS .NET and MQ JMS clients work little different. When connecting to queue manager, XMS .NET first sends the currently logged in Windows user id and then sends the application specified user id. If these two user ids are same, then connection is created. But if they are different then you will getCWSMQ0044Eerror. This is basically MQ Reason code 2035, MQRC_NOT_AUTHORIZED. However in case of MQ JMS, only the application specified user id is sent, Windows user id is not sent. Hence you don't see the error.There are number of ways to address the issue you are seeing when using XMS .NET:1) Use a MQ Server side Security Exit.2) Channel Authentication Records (Available from MQ v7.1 onwards)This issue has been discussedhere.\n"}
+{"text": "### Human: This a follow-up based onMQ (Websphere 7) persist message to file system.How do you set up an .exe program from an MQ support pack (such as the Q utility in MA01) to execute each time a message is received? Can this be setup in MQ Explorer? (We are using 7.0 on Windows 2008/R2).### Assistant: There are a few ways to do this.Set the application up under Windows control (since you mentioned the QMgr is on Windows.) The app would run as a service, with recovery options to restart it if the service fails. The application would be programmed (or configured in the case of Q) to process the queue using GETs with a VERY long wait period. Some additional error handling is required to do something sensible when the QMgr is not available. This works great for copying messages to multiple queues but isn't appropriate for queue-to-file since the file would never close.Run the application as a WebSphere MQ service. Defining theSERVICEobject usingCONTRIL(QMGR)causes MQ to start the service when the QMgr boots and stop it when the QMgr is shut down. Since the service is a child process of the QMgr, no need to worry about how to handle errors when the QMgr isn't available.Trigger the program based on non-zero queue depth. Define a process object describing the command to be executed, enable triggering on the queue withTRIGTYPE(FIRST)and run a trigger monitor. Whenever the queue has depth > 0 and no open input handles, the process object fires and executes the command. The thing you start must know how to parse the command line so the easiest thing to do if you have someone else's executable is use a script to start it. The script parses the trigger message and fires off the executable. Or perhaps the script ignores the trigger message and just runs the exe. I generally use Korn Shell or Perl and both are available on Windows.I wrote an article showing how to keep event queues from filling using a triggered version of Q. The article assumes you want the queues to remain mostly full so uses triggering on depth of about 80%. The same techniques could be used (in a much simpler implementation, by the way) to fire off the Q program whenever the queue depth became non-zero.UPDATEProbably should have linked the article. ;-)Mission:Messaging: Easing administration and debugging with circular queues\n"}
+{"text": "### Human: I am working in a new project.The project consists of using websphere MQ, Websphere server.\nWe have queue in the Websphere MQ including Queue manager.We also have the queue and connection factory defined in the websphere application server. Now, my question here is why we need o create queue and connection factory in the websphere application server, even they are defined in the WEBSPHERE MQ.Can't our application directly use the queue defined in the Websphere MQ?Please clear my query.Thank you in advance.### Assistant: Actually, the Connection factory isnotdefined in WebSphere MQ. The queue is but it's not the same as what you are creating in WAS.When using JMS the objects have two interfaces. The JMS API is the interface seen by the code and developers. The Service Provider Interface is the part that interacts with a particular JMS transport provider. It takes both of these to make a JMS object such as a QCF or Destination.When you create an object definition in WAS (or any JNDI repository, for that matter) what is created is an object that the program can refer to (the JMS API part) but that also \"knows\" how to talk to the specific transport provider as well (the SPI part). So when you define a queue in WAS it is a directory entry that points to an actual physical queue defined in the transport provider, in this case WebSphere MQ. Similarly, when you define a Connection Factory, it is also nothing more than a directory entry that conforms to the JMS API and also \"knows\" how to talk to the transport provider using its proprietary protocol and wire formats. In this case since the transport provider is WebSphere MQ, that Connection Factory directory entry has to know about things like QMgr name, host, port, channel, SSL/TLS details, etc.In some cases where the app serveristhe transport provider (i.e. WAS with Service Integration Bus as the JMS transport) creating the JMS object definition creates the physical object at the same time.The reverse is also true. In WebSphere MQ when you crate a queue or topic using WebSphere MQ Explorer, you have the opportunity to define the JMS object definition, provided that you have configured WMQ Explorer to talk to the repository where the managed objects are stored. For example, you can use LDAP to store managed object definitions, point both WebSphere MQ Explorer and WAS at the LDAP directory and manage all the JMS objects there.So to reiterate, defining the JMS object in WAS creates only the directory entry and not the actual WMQ object. This is true for any external JMS transport that you use with WAS.\n"}
+{"text": "### Human: How to identify a channel type(sender or receiver) through the event messages sent by the queue manager to queue SYSTEM.CHANNEL.EVENT.QUEUE during a channel stopped or retrying state ?I'm reading it using class PCFMessage.### Assistant: The event message contains the channel name but not the type. (SeeChannel and Bridge Eventstopic in the Infocenter for specifics.)My approach for this is that when my monitoring program starts up, I issue a PCF message to display all the channel names and their type and then store this information in a table. (The PCF equivalent ofDIS CHL(*) CHLTYPE.) Then as the channel events arrive, match the channel name to the table entry to retrieve the channel type. It is of course possible to cache any number of the static channel attributes such asCONNAME,MCAUSER, etc. and you can ask for as many as you need in the PCF command.If an event shows up for a channel not in the table, you can always issue a new PCF command to look up the new channel on the fly and then add the attributes to the cache you built when the program started. Hopefully, your QMgr is not so volatile as to define new channels so often that this would be a problem. However, if that were the case you could enable configuration events and then you'd be notified when new channels were defined.\n"}
+{"text": "### Human: I'm developing integration solution withmessage broker. Solution communicates with the back-end system usingwebsphere mq. During development process I don't have an access to the real back-end service so I have to mock it somehow. Mock implementation has to read message from queue, perform simple transformation, and put message back to queue. To achieve that, I've considered creating separate message flow but what I'm actually looking for is ready-made solution which I could leverage these tasks to.Does anybody know any tool that might be useful for that purpose?### Assistant: How about setting up your own QMgr? Or even your own broker and QMgr? According to the license terms of recent versions of WebSphere Message Broker, anyone with a single paid license is entitled to install any or all of the broker components on developer desktops (Windows and Linux). The InfocetnerLicense Requirementstopic states:Your license also covers use of the product for development and unit\n test purposes. All developers in your organization, who are working on\n resources and applications for WebSphere Message Broker, can install\n one copy of all components on their computer. They can create and\n configure a broker environment without any functional or resource\n restrictions. Installation of the WebSphere Message Broker Toolkit\n limits this use to Windows, Linux on x86, and Linux on x86-64\n computers. The unit test environment is limited to these three\n platforms even if you have purchased a license for WebSphere Message\n Broker for z/OS.\n"}
+{"text": "### Human: Every change in the production environment has to be versioned and tracked down to specific person who changed it and why.Is there a possibility to use some tool for that? If not, how to use SVN or GIT for MQ configuration?What are the best practices for changes inWebsphere MQconfiguration?I know that all of the configuration lays in the/var/mqm/qmgrs/QMNAMEdirectory. But these are not text files, hence simple SVN won't tell me what got changed.### Assistant: WebSphere MQ isn't like a static compiled artifact but rather is a living system that is in part self-managing. Things like clusters, triggers, instrumentation and even applications all can change settings on MQ objects at run time.What many shops choose to do is to store the object definitions and authorization control lists in MQSC scripts and keep those files in SVN or other change control system. Then to capture live changes they enable and monitorConfiguration Eventswhich report details of changes and the user ID that initiated them.In particular, objects in a WMQ cluster are more volatile at run time and so the scripts should reflect this fact. The object attributes can be categorized as to whether they are static properties or represent run-time state. MQSC scripts can take advantage of this by defining the static properties and the dynamic properties in separate steps. By using theREPLACEandNOREPLACEoptions it is possible to write the script so that cluster state is preserved whenever the script is re-run. This supports a change control methodology of storing all relevant objects in versioned scripts rather than writing a new script for each change to the system. Capturing the delta between the script versions gives you all the static properties and monitoring and the event messages gives you a view of all changes, including updates to dynamic properties that aren't captured in the scripts.The 2-step object definition looks like this:* Stateful attributes use NOREPLACE so rerunning the script does not\n* reset them to default values at run-time\nDEFINE QLOCAL (APP.FUNCTION.SUBFUNCTION.QA) +\n GET(DISABLED) +\n PUT(DISABLED) +\n NOTRIGGER +\n NOREPLACE\n\n* Static values use the REPLACE option to make sure any changes\n* are recorded next time the script runs\nALTER QLOCAL (APP.FUNCTION.SUBFUNCTION.QA) +\n DESCR('APP service queue for QA') +\n DEFPSIST(NO) +\n BOTHRESH(5) +\n BOQNAME('APP.FUNCTION.BACKOUT.QA') +\n CLUSTER('DIV_QA') +\n CLUSNL(' ') +\n DEFBIND(NOTFIXED)There is more detail on this methodology inMission:Messaging: Migration, failover, and scaling in a WebSphere MQ cluster.\n"}
+{"text": "### Human: I have a process that usesJMSTemplateto selectively dequeue from an MQ queue based on JMS header values.When the dequeue query matches messages at the front of the queue, the dequeue rate is approximately 60-70 msg/second. However, when the query matches messages only 50, 100 or 200 messages deep the dequeue rate drops to 1 msg / 3-4 seconds.The fast dequeue query isThreadId='24' or ThreadId='PRIMARY'. The slow dequeue query isThreadId='24'.The real reason for the slow processing times might be something else, but I observe the change in processing times with nothing more than the change in deselect query.I suspect this processing speed is not usual. What could possibly be going wrong?### Assistant: Querying deep queues by headers is not really recommended as the headers are not indexed. This might be the issue. Queries on CorrelationId and MessageId (if they are on the format 'ID:48-hex-digits') will be indexed and are very quick (~1ms / query on very deep queues, depending on setup).We faced this issue as well and choose to encode a correlation identifier in the correlation id header instead of in JMS string properties (MQRFH2/usr) headers.This was on MQ 7.0\n"}
+{"text": "### Human: Is there a way to consume messages from a WebSphere MQ queue in batches? e.g.messages = queue.receiveBatch( BATCH_SIZE )Where it would return a collection of messages ( e.g. List[Message] ) up to aBATCH_SIZEin asingle \"receive\"?(I can call receiveBATCH_SIZEtimes within a transaction, but that is not what I am looking for)Ifmessage groupscan solve it, what would it look like? Although it does not seem to be the right solution as \"message groups\" seem to be reading messages one by one.### Assistant: No. WMQ has read-ahead in which non-persistent messages are streamed to the client but even there the client executes a singleGET(or language equivalent) per message.One of the attributes of async messaging is supposed to be that messages are atomic. Any dependency of messages on other messages is called an affinity and message affinities break the async model. (However every transport makes some accommodation for affinities and message grouping is an example of that.) So aGETis the atomic unit of work which has a 1:1 correspondence to a message.WMQ messages can be of arbitrary size up to 100MB and messages larger than that can be segmented where one logical message is split across multiple physical messages. In the case of a segmented message, oneGETwill result in consumption of multiple messages, however to the app only one logical message is returned.WMQ Channels use batches and until recently these were constructed strictly by message count. However the aforementioned variability in message sizes made tuning channels extremely difficult if both large and small messages traversed the same channel. In v7.1 of WMQ channel batches now are bounded by a message count or a byte count, whichever is hit first. Any notion of messageGETbatching would require similar tuning functionality in order to prevent severe impacts to memory. There would be additional interactions with logging, queue sizes, etc. Note also that if one message failed, the entire batch would have to be rolled back.If the intent is to improve performance, use transactions. When receiving messages under syncpoint you can tune the number of messages toGETbetweenCOMMITcalls. You can considerably improve performance withCOMMITintervals > 1, however this falls off above a threshold which you can determine with a bit of trial and error. The Performance Reports can help determine the best number for your platform. These are available from theSupportPacs main page. Look for the entries with names like MPxx.If the messages are non-persistent and you can afford to lose some of them on disconnect, then you can use read-ahead - assuming you have a modern version of WMQ. This will stream messages to the application's WMQ client so that the next message is already in the local buffer whenGETis called.By the way, the link in the original post was to the WMB docs. The WMQ docs can be foundhere.\n"}
+{"text": "### Human: Two separate processes are communicating via JMS over MQ.The writer sets a string property:new MessageAction() {\n public void actOn(Message message) throws JMSException {\n logger.debug(\"Setting message property (GmmThreadId, CASHFLOW-1234)\");\n message.setStringProperty(\"GmmThreadId\", \"CASHFLOW-1234\");\n }\n});ThisMessageActionis executed, as shown in the logs:Setting message property (GmmThreadId, CASHFLOW-1234)The reader uses a message selector to obtain this message. (using Spring's JmsTemplate v1 -an old version I know, but it's baked into our vendor's framework and we're compelled to use it.)template.receiveSelected(queue, \"GmmThreadId = 'CASHFLOW-1234' or GmmThreadId IS NULL\");The only messages on the queue are ones for which the logs show that the writer set the message property. In the logs for the reader, I enumerate the properties and also try to log the value of GmmThreadId. It also shows that the property GmmThreadId does not exist.message property JMS_IBM_PutDate = 20111003\nmessage property JMSXAppID = WebSphere MQ Client for Java\nmessage property JMS_IBM_Format = MQSTR\nmessage property JMS_IBM_PutApplType = 28\nmessage property JMS_IBM_MsgType = 8\nmessage property JMSXUserID = MUSR_MQADMIN\nmessage property JMS_IBM_PutTime = 23551798\nmessage property JMSXDeliveryCount = 2\nmessage had GmmThreadId property of nullNote, if my message selector is only\"GmmThreadId = 'CASHFLOW-1234'\"then nothing is dequeued.Using WebSphere MQ Explorer to view the message, I cannot find anywhere to view the application set message properties. The message type is MQSTR, if that makes any difference.Both reader and writer applications are running in WebSphere v6.Where am I going wrong?### Assistant: As indicated bythis threadthe message properties will be suppressed if the destination type is 'MQ'. For me, this is configured in the WebSphere App Server console. I changed the queue type to 'JMS' and the message properties were persisted.\n"}
+{"text": "### Human: I am working on a Spring application where we have implemented code to send messages through IBM MQ.Now we have been advised not to directly use MQ APIs directly and instead use JMS.The steps I followed :created a JNDI name to connect to the Message queue configured as:\n >/>\nI need a connecton factory object to connect to the JMS Provider and I have configured it as:\n \n \n \n \nFurther I have injected the above 2 beans in JMSTemplate class:\n \n \n Now since my purpose is to remove dependency on MQ APIs, do you think the configuration above (especially for connection factory) looks good?### Assistant: Ifyour code doesn't refer to any of the MQ classes (i.e. it references that bean only as a JMSConnectionFactoryandyou don't rely on any other non-standard features of MQ, then this should make your code reasonably easy to port.I wouldn't bet that switching to another product would require zero code changes (many JMS implementations seem to have some interesting peculiarities), but you're definitely on the right way.\n"}
+{"text": "### Human: We have a queue which needs to be monitored for message not being processed for a long time.\nwe setQSVCINT(1800000)that is 30 mins.This event occurs only if there is no successful get operations orMQPUTcalls have been detected within an interval greater than the limit specified. (30 minutes)In our case queue is continuously getting message(MQPUT) in 30 minutes interval of time, so service interval high is not triggered.Do we have any alternative to check the age of the message and get alerted?### Assistant: Before answering the question, let's reset a slight misconception in the premise. Queue Service Interval measures the time between aPUTto an empty queue or aGETthat does not empty the queueand the nextGET. So the reason that you are not getting any event messages is not due to PUT activity but ratherto a lack of GET activity that would trigger an event. In other words, once the queue has depth, you will not get anyQSVCINTVLevents until aGEToccurs. Also, the events toggle betweenOKandHIGHso that once you get aHIGHyou will not get anotherHIGHbut should eventually see anOK. Once you get theOKevent you won't get another until aHIGHcondition occurs as a result of a lateGET.So imagine that a program puts 10 messages on the queue and another reads the first message and then dies. ThePUTcalls will not generate an event but will start the timer. Since the now-non-empty queue defaults to anOKinterval state, no event is enerated on the firstGETwhich we stipulated occured immediately. Since there were no subsequentGETcalls, the timer continues to run but no event will be generated. New messages can continue to arrive but the event will only trigger at this point on aGETcall that occurs 30 or more minutes after the one successfulGET.If you were hoping to get aQSVCINTVL(HIGH)event base don noGETactivity for more than 30 miniutes, it does not work that way.Still with me? Great! Now on to the answer.If you display the queue status (for example using theDIS QS(QUEUE.NAME)command) it provides the lastGETtime and date. TheDIS QL(QUEUE.NAME) CURDEPTHcommand provides the depth of the queue. These two commands can be issued to runmqsc in scripts or directly to the command server using PCF commands and will allow you to directly inquire as to the time since the last successfulGETon the queue, irrespective of anyGETactivity such as that required to drive events.Using this method you can first validate that the queue has depth (because presumably we don't care if there are noGETcalls on an empty queue) and then if so, see how long it's been since the lastGETeven if the consuming program has died and there are noGETcalls being made.Hope that helps.\n"}
+{"text": "### Human: Has anyone experienced an issue where WAS does not use the Windows username when connecting to a Websphere MQ resource? None of our developer boxes have ever experienced this problem in the past, they've been able to send the username through for MQ to do authorization. But we have a new developer machine that does not appear to be sending the username, and thus the connection to MQ can't be made.We tried specifying a J2C authentication alias to the QCF with a DefaultPrincipalMapping, but that didn't work.SOLUTION:Found out that the problem was that the server was installed and running as a Windows service. When we created a new server profile which was run by the user and not as a service, it used the Windows username when connecting to MQ.### Assistant: I suspect the problem might actually be the opposite of what you are describing. In older versions of WAS if theUser ID field of the Connection Factory panelwas left blank, WAS would send a blank ID. WebSphere MQ would have no value to pass along to the Object Authority Manager and so the channel would run under authority of the Message Channel Agent's process - which is always administrative. Thus, older versions of WAS commonly ran with administrative rights, although this was not widely recognized as such. You can verify this by looking at the status of the running channel and see if the MCAUSER field is blank.Newer versions of WAS now try a bit harder to find an ID to send to WMQ if the configuration panel is blank. Because of this new installations and upgrades of existing installations often fail to authorize to WMQ using the same channel that previously worked.The interesting part of all this is that the only way this is an issue is if the QMgr has a blank value on the MCAUSER channel attribute. If the QMgr has a blank MCAUSER and no exit is setting MCAUSER at CONNECT time, then the channel allows administrative access. If the channel does not have SSL with SSLPEER set or an exit to authenticate the connection then that administrative access is available to anonymous users. Why is this an issue? Because WebSphere MQ comes with the ability to initiate OS commands based on arrival of a message. This means that any user with WMQ admin rights can remotely execute arbitrary OS commandsas a feature of the software. It follows that this capability MUST be locked down, even from legitimate applications if there is to be any accountability of the messages flowing through the network.The fact that your app is able to present an ID that succeeds and another ID that fails would seem to indicate that the QMgr is allowing administrative access and, I would wager, doing so for anonymous connections. D'oh! MUCH better to fix the QMgr's security than to fix the connection problem by setting the \"right\" ID in WAS. For more on this, see theHardening WebSphere MQpresentation from the IMPACT conference.\n"}
+{"text": "### Human: I've a VB6 application with MQSeries Automation Classes for ActiveX. The problem is when i'm writing the message con the queue. I use this code :This is how I open the connection and the relative queue :Set MQSess = New MQSession\n//Access Queue\nSet QMgr = MQSess.AccessQueueManager(QueueManagerName)\n\nDim Queue As MQQueue\nDim msg As MQMessage\nDim pmo As MQPutMessageOptions\n\nDim ArrCar() As Byte\n\nSet pmo = New MQPutMessageOptions\n\nSet Queue = QMgr.AccessQueue(QueueName, OpenOption , RemoteQueueManagerName)\n//OpenOption is a integer with value of 16 (MQOO_OUTPUT) \n\nstrMsgAppo = Translate(\"*MESSAGE_TO_INSERT*\", ASCII_To_EBCDIC_Table())\n\nReDim ArrCar(Len(strMsgAppo) - 1)\nFor lngI = 1 To Len(strMsgAppo)\n ArrCar(lngI - 1) = Asc(Mid(strMsgAppo, lngI, 1))\nNext lngI\n\nCall msg.Write(ArrCar) //Write the ByteArray\n\nCall Queue.Put(msg, pmo)The ASCII_To_EBCDIC_Table is a function used to change the encoding.The error i'm getting from MQ is :MQAX200.MQMessage::Write CompletionCode = 2, ReasonCode = 2043, ReasonName = MQRC_OBJECT_TYPE_ERRORIs Anyone using this activex and can help me on how to write message in a queue?### Assistant: In the code snippet provided, I'm not seeing where the connection to the QMgr is made nor where the queue is opened. Both of these steps must be completed before it is possible to put messages on the queue.The 2043 reason code occurs when there is an invalid option in the Message Options field for aPUTor anOPEN. In this case the problem could either be on the PUT or an implicitOPEN, depending on what's in the code that was not provided and whether it contains anOPEN.My suggestion would be to refer to the .Net samples provided in the installation and reconcile between those and your application. The samples reside atC:\\Program Files (x86)\\IBM\\WebSphere MQ\\tools\\dotnet\\samplesin a default V7 installation.\n"}
+{"text": "### Human: I trying to create queues using PCF command in the WebSphere API as detailed in$MQM_HOME/samp/pcf/samples/PCF_CreateQeue.java. The creation fails when i add a descriptioncommand.addParameter(PCFConstants.MQCA_Q_DESC, \"Created using MQMonitor\");I get the error:com.ibm.mq.pcf.PCFException: MQJE001: Completion Code 2, Reason 3015 : MQRCCF_CFST_PARM_ID_ERRORIs there another way of setting the description, i'm using version 6 of the API.### Assistant: TheCommands pagein the PCF manual states that:The required parameters and the\n optional parameters are listed. On\n platforms other than z/OS\u00ae, the\n parametersmust occur in the order:All required parameters, in the order stated, followed byOptional parameters as required, in any order, unless specifically\n noted in the PCF definition.The sectionChange, Copy and Create Queuelists the required parameters in the following order:MQCA_Q_NAMEMQIA_Q_TYPEOptional parameters, including QDescThe same manual provides required parameters and their order for all PCF commands so no need to play hide-and-seek trying out parms and orders in the future.\n"}
+{"text": "### Human: I would like to authenticate the user against the MQ Series before user places the Queue message in Queue manager. I am using the IBM MQ Series V7. I would like to know how does the authentication and Key certificate works in terms of validation. It will be great if i can get any helpful links on the same.### Assistant: These might be of some help...Mission:Messaging: Scripted WebSphere MQ key file management for UNIX and Windowshttp://bit.ly/3L1njaMission:Messaging: Planning for SSL on the WebSphere MQ networkhttp://bit.ly/3loirThey key is that you authenticate using SSL and SSLPEER or an exit. But the user can still present any ID and it is accepted. You enforce the authentication against a particular user ID by placing the ID in the MCAUSER field of the channel. If it's a channel with only one authorized user, hard code this. If the channel has many authorized users, use an exit such as BlockIP2 fromhttp://mrmq.dkto map the SSL DN to an ID and set the MCAUSER at connect time. Make sure if you use the exit to set MCAUSER in the channel definition to 'nobody' so that if the exit is misconfigured the channel will fail safe instead of wide open.See my Hardening WebSphere MQ Security presentation athttp://t-rob.net/linksfor additional details.\n"}
+{"text": "### Human: Hi im currently using themq-golang-jms20library for golang to connect to a ibm queue, but im trying to create a consumer with the \"JMSMessageID\" selector but the library is giving me the \"Only selectors on JMSCorrelationID are currently supported\" does anybody knows how else could i consume a specific message using the message Id from the queue ?### Assistant: Thank you for submitting this as agit issue.I've merged a PR to allow get byJMSMessageIDtoday, so if you pull down the latest library frommainyou should be all set!\n"}
+{"text": "### Human: I am using the low level direct IBM MQ library to push messages on the queue and retrieve them. I was trying to setup the application such that messages can come in, say by pulling data of a database and then pushing records onto the queue and actually same code may read messages. I was mostly wanted to setup a thread that would pull messages once they come up.This code runs, the first PUT works but the second one does not work and hangs. Am I not understanding the flow hereAlso, if I take the code from the second below around the \"GET\", could I write a thread that calls that routine every 500 milliseconds, waiting for new messages to come in.final int putOptions = MQC.MQPMO_NO_SYNCPOINT\n | MQC.MQPMO_SYNC_RESPONSE;\n this.mqPMO = new MQPutMessageOptions();\n this.mqPMO.options = putOptions;\n // This code hangs !!!! (error here)\n mqueue.put(msg, this.mqPMO);...public void bootstap() {\n MQEnvironment.hostname = \"localhost\";\n MQEnvironment.port = 1414;\n MQEnvironment.channel = \"DEV.ADMIN.SVRCONN\";\n MQEnvironment.properties.put(MQConstants.APPNAME_PROPERTY, \"my_application_name\");\n MQEnvironment.enableTracing(5);\n\n MQQueueManager mqManager = null;\n MQQueue mqueue = null;\n try {\n // MQCNO_CLIENT_BINDING is not available for Java or .NET as they have their own mechanisms for choosing the bind type.\n final String qmName = \"QM1\";\n final String userId = \"admin\";\n final String Password = \"passw0rd\";\n final Hashtable h = new Hashtable();\n\n h.put(MQConstants.USER_ID_PROPERTY, userId);\n h.put(MQConstants.PASSWORD_PROPERTY, Password);\n h.put(MQConstants.USE_MQCSP_AUTHENTICATION_PROPERTY, true);\n mqManager = new MQQueueManager(qmName, h);\n //mqManager = new MQQueueManager(qmName, WMQConstants.WMQ_CM_BINDINGS);\n \n this.mqGMO = new MQGetMessageOptions();\n this.mqGMO.options = MQC.MQGMO_NO_SYNCPOINT |\n MQC.MQGMO_WAIT |\n MQC.MQGMO_CONVERT |\n MQC.MQGMO_FAIL_IF_QUIESCING;\n this.mqGMO.matchOptions = MQC.MQMO_MATCH_CORREL_ID;\n this.mqGMO.waitInterval = MQC.MQWI_UNLIMITED;\n\n int openOptions = MQC.MQOO_INPUT_SHARED |\n MQC.MQOO_OUTPUT;\n mqueue = mqManager.accessQueue(\"DEV.QUEUE.1\", openOptions);\n logger.info(\">> Find connection handle queue manager - \" + mqueue);\n\n {\n final MQMessage msg = new MQMessage();\n final String correlId = \"0002\";\n final String byteArry = this.hexStringToByteArray(correlId);\n\n logger.info(\">>> correlId: \" + correlId);\n logger.info(\">>> byteArry: \" + byteArry);\n\n msg.correlationId = byteArry.getBytes();\n msg.format = MQConstants.MQFMT_STRING;\n // ... and write some text in UTF8 format\n msg.writeUTF(\"{{ Hello, World }}}\");\n\n // Use the default put message options...\n // Or: pmo.options = MQConstants.MQPMO_ASYNC_RESPONSE\n final int putOptions = MQC.MQPMO_NO_SYNCPOINT\n | MQC.MQPMO_SYNC_RESPONSE;\n this.mqPMO = new MQPutMessageOptions();\n this.mqPMO.options = putOptions;\n\n // put the message //\n mqueue.put(msg, this.mqPMO);\n logger.info(\" >>> Continue to get routine\");\n }\n\n {\n // This code works !!! get the message\n MQMessage retrievedMessage = new MQMessage();\n retrievedMessage.correlationId = this.hexStringToByteArray(\"0001\").getBytes();\n mqueue.get(retrievedMessage, this.mqGMO);\n\n // And prove we have the message by displaying the UTF message text\n String msgText = retrievedMessage.readUTF();\n logger.info(\"~~~~ The message is: \" + msgText);\n }\n\n {\n final MQMessage msg = new MQMessage();\n final String correlId = \"0001\";\n final String byteArry = this.hexStringToByteArray(correlId);\n\n logger.info(\">>> correlId: \" + correlId);\n logger.info(\">>> byteArry: \" + byteArry);\n\n msg.correlationId = byteArry.getBytes();\n msg.format = MQConstants.MQFMT_STRING;\n // ... and write some text in UTF8 format\n msg.writeUTF(\"{{ Hello, World }}}\");\n\n // Use the default put message options...\n // Or: pmo.options = MQConstants.MQPMO_ASYNC_RESPONSE\n final int putOptions = MQC.MQPMO_NO_SYNCPOINT\n | MQC.MQPMO_SYNC_RESPONSE;\n this.mqPMO = new MQPutMessageOptions();\n this.mqPMO.options = putOptions;\n // This code hangs !!!! (error here)\n mqueue.put(msg, this.mqPMO);\n }\n\n\n mqueue.close();\n mqManager.disconnect();\n } catch(final Exception e) {\n logger.error(\"Error at MQ manager\", e);\n }\n }### Assistant: First off, do NOT use MQEnvironment class as it is not thread safe. You should be using a Hashtable for MQ connection information.Secondly, what is with all of the final declarations? Very odd.Your code doesn't make any sense. Here is what I see your code doing:Set MQ connection information uses the MQEnvironment classSet UserId and Password in a HashtableConnect to the queue managerOpen the queueSet 'correlId' to \"0002\"final String byteArry = this.hexStringToByteArray(correlId);This line of code does not make any sense. The method name doesn't match your code. A Hex string should be in the format of \"30303032\" for \"0002\" and return a byte array i.e. byte[] but it is returning a String. So, I have no idea what the hexStringToByteArray method is doing.Also, the MsgId, CorrelId and GroupId fields of the MQMD structure are 24 bytes in length.Write the message data in a UTF format. Why? Does the receiving application require UTF format?Put the message on the queue.Set the CorrelId for the receive message to \"0001\" but converted to a strange representation by hexStringToByteArray method.Get a message from the queue with a wait interval of unlimited. Since there is no message on the queue that will match that CorrelId then MQ client library will wait forever!!!!!Create another MQMessage and set the CorrelId to \"0001\" but converted to a strange representation by hexStringToByteArray method.Write the message data in a UTF format. Why? Does the receiving application require UTF format?Put the message on the queue.Close the queueDisconnect from the queue managerHere is a fully functioning Java/MQ program that will put 2 messages on a queue with unique CorrelIds (i.e. \"0001\" & \"0002\") and then retrieve the message with a CorrelId of \"0002\".import java.io.IOException;\nimport java.text.DecimalFormat;\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\nimport java.util.Hashtable;\n\nimport com.ibm.mq.MQException;\nimport com.ibm.mq.MQGetMessageOptions;\nimport com.ibm.mq.MQMessage;\nimport com.ibm.mq.MQPutMessageOptions;\nimport com.ibm.mq.MQQueue;\nimport com.ibm.mq.MQQueueManager;\nimport com.ibm.mq.constants.CMQC;\n\n/**\n * Program Name\n * MQTest11B\n *\n * Description\n * This java class will connect to a remote queue manager with the\n * MQ setting stored in a HashTable, put 2 message on a queue with unique CorrelIds\n * and then retrieve the message with a CorrelId of \"0002\".\n *\n * Sample Command Line Parameters\n * -m MQA1 -h 127.0.0.1 -p 1414 -c TEST.CHL -q TEST.Q1 -u UserID -x Password\n *\n * @author Roger Lacroix\n */\npublic class MQTest11B\n{\n private static final SimpleDateFormat LOGGER_TIMESTAMP = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss.SSS\");\n\n private Hashtable params;\n private Hashtable mqht;\n private String qMgrName;\n private String outputQName;\n\n /**\n * The constructor\n */\n public MQTest11B()\n {\n super();\n params = new Hashtable();\n mqht = new Hashtable();\n }\n\n /**\n * Make sure the required parameters are present.\n * @return true/false\n */\n private boolean allParamsPresent()\n {\n boolean b = params.containsKey(\"-h\") && params.containsKey(\"-p\") &&\n params.containsKey(\"-c\") && params.containsKey(\"-m\") &&\n params.containsKey(\"-q\") &&\n params.containsKey(\"-u\") && params.containsKey(\"-x\");\n if (b)\n {\n try\n {\n Integer.parseInt((String) params.get(\"-p\"));\n }\n catch (NumberFormatException e)\n {\n b = false;\n }\n }\n\n return b;\n }\n\n /**\n * Extract the command-line parameters and initialize the MQ HashTable.\n * @param args\n * @throws IllegalArgumentException\n */\n private void init(String[] args) throws IllegalArgumentException\n {\n int port = 1414;\n if (args.length > 0 && (args.length % 2) == 0)\n {\n for (int i = 0; i < args.length; i += 2)\n {\n params.put(args[i], args[i + 1]);\n }\n }\n else\n {\n throw new IllegalArgumentException();\n }\n\n if (allParamsPresent())\n {\n qMgrName = (String) params.get(\"-m\");\n outputQName = (String) params.get(\"-q\");\n\n try\n {\n port = Integer.parseInt((String) params.get(\"-p\"));\n }\n catch (NumberFormatException e)\n {\n port = 1414;\n }\n \n mqht.put(CMQC.CHANNEL_PROPERTY, params.get(\"-c\"));\n mqht.put(CMQC.HOST_NAME_PROPERTY, params.get(\"-h\"));\n mqht.put(CMQC.PORT_PROPERTY, new Integer(port));\n mqht.put(CMQC.USER_ID_PROPERTY, params.get(\"-u\"));\n mqht.put(CMQC.PASSWORD_PROPERTY, params.get(\"-x\"));\n\n // I don't want to see MQ exceptions at the console.\n MQException.log = null;\n }\n else\n {\n throw new IllegalArgumentException();\n }\n }\n\n /**\n * Connect, open queue, write a message, close queue and disconnect.\n *\n */\n private void testSendAndReceive()\n {\n MQQueueManager qMgr = null;\n MQQueue queue = null;\n int openOptions = CMQC.MQOO_INPUT_SHARED | CMQC.MQOO_OUTPUT | CMQC.MQOO_FAIL_IF_QUIESCING;\n MQPutMessageOptions pmo = new MQPutMessageOptions();\n pmo.options = CMQC.MQPMO_NO_SYNCPOINT | CMQC.MQPMO_FAIL_IF_QUIESCING;\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n gmo.options = CMQC.MQGMO_NO_SYNCPOINT | CMQC.MQGMO_WAIT | CMQC.MQGMO_CONVERT | CMQC.MQGMO_FAIL_IF_QUIESCING;\n gmo.matchOptions = CMQC.MQMO_MATCH_CORREL_ID;\n gmo.waitInterval = CMQC.MQWI_UNLIMITED;\n MQMessage sendmsg;\n String msgData;\n DecimalFormat df = new DecimalFormat(\"0000\");\n\n try\n {\n qMgr = new MQQueueManager(qMgrName, mqht);\n logger(\"successfully connected to \"+ qMgrName);\n\n queue = qMgr.accessQueue(outputQName, openOptions);\n logger(\"successfully opened \"+ outputQName);\n \n /*\n * Code to send 2 messages with a specific CorrelId. i.e. 0001 and 0002\n */\n for (int i=0; i < 2; i++)\n {\n // Define a simple MQ message, and write some text\n sendmsg = new MQMessage();\n sendmsg.format = CMQC.MQFMT_STRING;\n sendmsg.messageId = CMQC.MQMI_NONE;\n sendmsg.correlationId = df.format(i+1).getBytes();\n\n // Write message data\n msgData = \"This is a test message from MQTest11B. CorrelID is \"+new String(sendmsg.correlationId);\n sendmsg.writeString(msgData);\n\n // put the message on the queue\n queue.put(sendmsg, pmo);\n logger(\"Sent: Message Data>>>\" + msgData);\n }\n \n /*\n * Code to receive a message with a specific CorrelId. i.e. 0002\n */\n \n // Define a simple MQ message, and write some text\n MQMessage receiveMsg = new MQMessage();\n receiveMsg.messageId = CMQC.MQMI_NONE;\n receiveMsg.correlationId = \"0002\".getBytes();\n\n // get the message on the queue\n queue.get(receiveMsg, gmo);\n\n if (CMQC.MQFMT_STRING.equals(receiveMsg.format))\n {\n String msgStr = receiveMsg.readStringOfByteLength(receiveMsg.getMessageLength());\n logger(\"Received: Message Data>>>\" + msgStr);\n }\n else\n {\n byte[] b = new byte[receiveMsg.getMessageLength()];\n receiveMsg.readFully(b);\n logger(\"Received: Message Data>>>\" + new String(b));\n }\n }\n catch (MQException e)\n {\n logger(\"CC=\" +e.completionCode + \" : RC=\" + e.reasonCode);\n }\n catch (IOException e)\n {\n logger(\"IOException:\" +e.getLocalizedMessage());\n }\n finally\n {\n try\n {\n if (queue != null)\n {\n queue.close();\n logger(\"closed: \"+ outputQName);\n }\n }\n catch (MQException e)\n {\n logger(\"CC=\" +e.completionCode + \" : RC=\" + e.reasonCode);\n }\n try\n {\n if (qMgr != null)\n {\n qMgr.disconnect();\n logger(\"disconnected from \"+ qMgrName);\n }\n }\n catch (MQException e)\n {\n logger(\"CC=\" +e.completionCode + \" : RC=\" + e.reasonCode);\n }\n }\n }\n\n /**\n * A simple logger method\n * @param data\n */\n public static void logger(String data)\n {\n String className = Thread.currentThread().getStackTrace()[2].getClassName();\n\n // Remove the package info.\n if ( (className != null) && (className.lastIndexOf('.') != -1) )\n className = className.substring(className.lastIndexOf('.')+1);\n\n System.out.println(LOGGER_TIMESTAMP.format(new Date())+\" \"+className+\": \"+Thread.currentThread().getStackTrace()[2].getMethodName()+\": \"+data);\n }\n\n /**\n * main line\n * @param args\n */\n public static void main(String[] args)\n {\n MQTest11B write = new MQTest11B();\n\n try\n {\n write.init(args);\n write.testSendAndReceive();\n }\n catch (IllegalArgumentException e)\n {\n logger(\"Usage: java MQTest11B -m QueueManagerName -h host -p port -c channel -q QueueName -u UserID -x Password\");\n System.exit(1);\n }\n\n System.exit(0);\n }\n}And the output should look like this:2021/07/02 14:01:59.316 MQTest11B: testSendAndReceive: successfully connected to MQA1\n2021/07/02 14:01:59.332 MQTest11B: testSendAndReceive: successfully opened TEST.Q1\n2021/07/02 14:01:59.332 MQTest11B: testSendAndReceive: Sent: Message Data>>>This is a test message from MQTest11B. CorrelID is 0001\n2021/07/02 14:01:59.347 MQTest11B: testSendAndReceive: Sent: Message Data>>>This is a test message from MQTest11B. CorrelID is 0002\n2021/07/02 14:01:59.347 MQTest11B: testSendAndReceive: Received: Message Data>>>This is a test message from MQTest11B. CorrelID is 0002\n2021/07/02 14:01:59.347 MQTest11B: testSendAndReceive: closed: TEST.Q1\n2021/07/02 14:01:59.347 MQTest11B: testSendAndReceive: disconnected from MQA1\n"}
+{"text": "### Human: I am trying to connect to a remote MQ on the company I work, using the following command, which comes after installing the MQ Client (IBM MQ version 9.04.0) on my machine,Input:P:\\>amqssslc -s TLS_RSA_WITH_AES_256CBC_SHA256 -k \"t:\\Desktop\\certificates\\key\" -x \"server.com(1414)\" -c \"0000%XXXX%QMGR\" -m QMGROutput:Sample AMQSSSLC start Connecting to queue manager\nUsing the server connection channel 0000%XXXX%QMGR\non connection name server.com(1414).\nUsing SSL CipherSpec TLS_RSA_WITH_AES_256CBC_SHA256\nUsing SSL key repository stem t:\\Desktop\\certificates\\key\nNo OCSP configuration specified\nMQCONNX ended ith reason code 2393Where the-kindicates the key.* path, which is a group of files (kdb, rdb, sht). These files were created usingIKeyMan - IBM Key Managerfrom acer.jksfile that current developers use to connect on a web app.The error log file shows the following error:06/11/202020 19:29:45 - Process(25780.1) User(username) Program(amqssslc.exe)\n Host(myhost) Installation(Installation1)\n VRMF(9.1.3.0)\n Time(2020-06-11T09:24:53.270Z)\n RemoteHost(xx.xx.xxx.56)\n CommenInsert1(0000%XXXX%QMGR)\n CommenInsert2(server.com(1414))\n\nAMQ9642: No SSL or TLS certificate for channel '0000%XXXX%QMGR'.\n\nEXPLANATION:\nThe channel '0000%XXXX%QMGR' did not supply a certificate to use during SSL\nor TLS handshaking, but a certificate is required by the remote queue manager. \n\nThe remote host is 'server.com(1414)'. \n\nThe channel did not start.\nACTION:\nEnsure that the key repository of the local queue manager or MQ client contains\na certificate which is associated with the queue manager or client.\nAlternatively, if appropriate, change the remote channel definition so that its\nSSLCAUTH attribute is set to OPTIONAL and it has no SSLPEER value set.Where it leads me to believe that the error is related to the handshake on the channel side.Jks certificate works for the other developers who make the connection to the queue on the server.My mqclient.ini file has the following added configuration:TCP:\n KeepAlive = Yes\n\nCLientExithPath: \n ExitsDefaultPath=C:\\ProgramData\\IBM\\MQ\\exits\n ExitsDefaultPath64=C:\\ProgramData\\IBM\\MQ\\exits64\n\nSSL: \n OCSPAuthentication=NO\n OCSPCheckExtension=NO\n CDPCheckExtension=NOWhat could be the issue? I have also tried changing thelabel of my certificateto indicate a personal certificate there is on the key.kdb file, however, it drops a different error, what I was told from the IT guys at the company I work, is that this certificate label is not needed.### Assistant: In the end the OP (@EdgarHernandez) noticed the error was a typo in the CipherSpec,TLS_RSA_WITH_AES_256CBC_SHA256instead of the correct nameTLS_RSA_WITH_AES_256_CBC_SHA256was causing/contributing to the 2393Putting my troubleshooting notes from the comments in this answer for so they are searchable for future SO users looking at similar errors.There is a difference in how Java/JMS selects a cert to send to the queue manager and how a client using the C libraries selects the cert to send to the queue manager.Java/JMS:Java does not use cert label, it provides a cert that it thinks is a match to present to the queue manager based on what issuers that queue manager trusts, so it is good enough to have the a personal cert that is issued by a CA that the queue manager trusts.C library client:C library clients (whichamqssslcis) bases cert selection this on the cert label. By default it will look for a labelibmwebspheremq, so if you run as a useredgarthe cert the MQ client will look for isibmwebspheremqedgarIn MQ v8.0 and later you can specify a alternate label than the default value.amqssslcdoes this with the-llabel option. So if your cert was labeled justedgar, you should be able to add-l edgarto pick up the cert.Use the following command to check that you have a personal cert listed, it should be prefixed with a-in the first column, if it is only prefixed with a!then it is only the public portion of the key, not the private.runmqakm -cert -list -db t:\\Desktop\\certificates\\key.kdb -stashed\n"}
+{"text": "### Human: I am wring custom java code to read messages from Websphere MQ (version 8) and read all the headers from the MQ message.When I use the MQHeaderList to parse all the headers the list size is 0:MQMessage message = new MQMessage();\nqueue.get(message, getOptions);\nDataInput in = new DataInputStream (new ByteArrayInputStream (b));\nMQHeaderList headersfoundlist = null;\nheadersfoundlist = new MQHeaderList (in);\nSystem.out.println(\"headersfoundlist size: \" + headersfoundlist.size());However, I read only a specific MQRFH2 it worksMQMessage message = new MQMessage();\nqueue.get(message, getOptions);\nDataInput in = new DataInputStream (new ByteArrayInputStream (b));\nMQRFH2 rfh2 = new MQRFH2(in);\nElement usrfolder = rfh2.getFolder(\"usr\", false);\nSystem.out.println(\"usr folder\" + usrfolder);How can I parse all the headers of the MQ Message?### Assistant: DataInput in = new DataInputStream (new ByteArrayInputStream (b));What's that about? Not sure why you want to do that.It should just be:MQMessage message = new MQMessage();\nqueue.get(message, getOptions);\nMQHeaderList headersfoundlist = new MQHeaderList(message);\nSystem.out.println(\"headersfoundlist size: \" + headersfoundlist.size());Read morehere.Update:@anshu's comment about it not working, well, I've always found MQHeaderList class to be very buggy. Hence, that is why I don't use it.Also, 99.99% messages in MQ will only ever have 1 embedded MQ header (i.e. MQRFH2). Note: A JMS message == MQRFH2 message. The only case where you will find 2 embedded MQ headers are for messages on the Dead Letter Queue.i.e.{MQDLH}{MQRFH2}{message payload}Is there a real need for your application to process multiple embedded MQ headers? Is your application putting/getting JMS messages (aka MQRFH2 messages)?If so then you should do something like the following:queue.get(receiveMsg, gmo);\n\nif (CMQC.MQFMT_RF_HEADER_2.equals(receiveMsg.format))\n{\n receiveMsg.seek(0);\n MQRFH2 rfh2 = new MQRFH2(receiveMsg);\n\n int strucLen = rfh2.getStrucLength();\n int encoding = rfh2.getEncoding();\n int CCSID = rfh2.getCodedCharSetId();\n String format= rfh2.getFormat();\n int flags = rfh2.getFlags();\n int nameValueCCSID = rfh2.getNameValueCCSID();\n\n String[] folderStrings = rfh2.getFolderStrings();\n for (String folder : folderStrings)\n System.out.println.logger(\"Folder: \"+folder);\n\n if (CMQC.MQFMT_STRING.equals(format))\n {\n String msgStr = receiveMsg.readStringOfByteLength(receiveMsg.getDataLength());\n System.out.println.logger(\"Data: \"+msgStr);\n }\n else if (CMQC.MQFMT_NONE.equals(format))\n {\n byte[] b = new byte[receiveMsg.getDataLength()];\n receiveMsg.readFully(b);\n System.out.println.logger(\"Data: \"+new String(b));\n }\n}\nelse if ( (CMQC.MQFMT_STRING.equals(receiveMsg.format)) ||\n (CMQC.MQFMT_NONE.equals(receiveMsg.format)) )\n{\n Enumeration props = receiveMsg.getPropertyNames(\"%\");\n if (props != null)\n {\n System.out.println.logger(\"Named Properties:\");\n while (props.hasMoreElements())\n {\n String propName = props.nextElement();\n Object o = receiveMsg.getObjectProperty(propName);\n System.out.println.logger(\" Name=\"+propName+\" : Value=\"+o);\n }\n }\n\n if (CMQC.MQFMT_STRING.equals(receiveMsg.format))\n {\n String msgStr = receiveMsg.readStringOfByteLength(receiveMsg.getMessageLength());\n System.out.println.logger(\"Data: \"+msgStr);\n }\n else\n {\n byte[] b = new byte[receiveMsg.getMessageLength()];\n receiveMsg.readFully(b);\n System.out.println.logger(\"Data: \"+new String(b));\n }\n}\nelse\n{\n byte[] b = new byte[receiveMsg.getMessageLength()];\n receiveMsg.readFully(b);\n System.out.println.logger(\"Data: \"+new String(b));\n}\n"}
+{"text": "### Human: We are trying to make our project which currently runs on WebSphere also work on Liberty.In trying to get an MDB to work I get the following error: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2085' ('MQRC_UNKNOWN_OBJECT_NAME')The relevant portion of the server.xml:\n \n\n\n\n \nThe values in the Liberty configuration were taken from WebSphere.My question is if the reason for this error can only be that the queue name is incorrect, or if something could be missing from the configuration.Update:the solution turned out to be to change destinationRef to destination and add useJNDI=\"true\"### Assistant: If you look at the logs on MQ and it appears to be trying to open an MQ object calledjms/incomingRequestQueue, try replacingdestinationRefwithdestinationLookup. Some methods of specifying the destination for an activation spec just pass the value straight to MQ instead of doing a lookup in the JNDI context for an admin object and fetching the right property.See the notes inthis tableabout the relationship between destination and destinationLookup. DestinationRef is a property that Liberty adds and I'm not sure how it all relates to the properties the resource adapter actually exposes but may be making this switch unnecessary. It all depends on what string you're trying to look up as a queue on the queue manager.Additionally, for those who might have this issue and are using thedestinationproperty (likely in conjuntion with JMS 1.1/Java EE 6), wheredestinationLookupdoesn't exist, you can specifyuseJNDI=\"true\"as a property on the activation spec to resolve this, see the table linked above.\n"}
+{"text": "### Human: I have a XMS MQ Client app that is pulling off messages from a series of MQ endpoints. There are certain reason codes for which the process can continue, and for some that it should abort. For example aMQRC_Q_MGR_NOT_AVAILABLE2059 for one endpoint shouldn't abort the whole process. Consequently I would like to check for this reason code.cf = factoryFactory.CreateConnectionFactory();\nforeach (Endpoint e in env.GetEndpoints())\n{\n Console.WriteLine(\"Consuming messages from endpoint {0}({1})\", e.host, e.port);\n\n // Set the properties\n SetConnectionProperties(cf, e);\n\n try\n {\n ReceiveMessagesFromEndpoint(cf);\n }\n catch (XMSException ex)\n {\n Console.WriteLine(\"XMSException caught: {0}\", ex);\n Console.WriteLine(\"Error Code: {0}\", ex.ErrorCode);\n Console.WriteLine(\"Error Message: {0}\", ex.Message);\n }\n}Problem is that the only attributes available on the XMSException to examine areex.ErrorCodeandex.Message, which are respectively:Error Code: CWSMQ0006andError Message: CWSMQ0006E: An exception was received during the call to the method ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2059.I can see the Reason in the Message, but can't find a method or attribute to retrieve it.### Assistant: There are probably 2 ways to do it1) You can use the LinkedExceptionSomething like the followingtry\n {\n }\n catch (XMSException e)\n {\n if(e.LinkedException!=null)\n Console.WriteLine(e.LinkedException.Message);\n else\n Console.WriteLine(e);\n }2) Reference amqmdnet.dll as well to the project and use MQException.Something liketry\n {\n }\n catch (XMSException e)\n {\n if(e.LinkedException!=null)\n {\n IBM.WMQ.MQException inner = (IBM.WMQ.MQException)e.LinkedException;\n Console.WriteLine(\"Reason:\"+ inner.ReasonCode);\n }\n else\n Console.WriteLine(e);\n }\n"}
+{"text": "### Human: I've got a Spring Integration flow which uses an inbound gateway to get messages from an IBM MQ queue:However I'm not capable of assigning security settings. In particular, I need an username, password and userAuthenticationMQCSP = false (for reasons beyond the scope of this post, I won't get into details but my broker will throw a MQRC = 2009 otherwise).I've followed theIBM guide to connect with jmsTemplateand works just fine. This uses the officialSpring boot starter from IBM MQwhich will kindly create a connection factory and will autoconfigure it with some defaults from application.properties:ibm.mq.queueManager=myQMName\nibm.mq.channel=myChannel\nibm.mq.connName=myhostname(myPort)\nibm.mq.user=username\nibm.mq.password=*******\nibm.mq.userAuthenticationMQCSP=falseNow, back to the Spring Integration case. According to theint-jms:inbound-gateway spec, a connectionFactory will be injected to the gateway, by name (attribute: connection-factory) which is set up to be \"jmsConnectionFactory\" by defaultBy default, all of the JMS adapters that require a reference to the\n ConnectionFactory automatically look for a bean named\n jmsConnectionFactory. That is why you do not see a connection-factory\n attribute in many of the examples. However, if your JMS\n ConnectionFactory has a different bean name, you need to provide that\n attribute.I don't see any way to set up a predictable name for the connection factory that I can plug into the int-jms:inbound-gateway.Now, taking a different approach, as perthis exampleI've created my connectionFactory with an adecuate name:\n \n \n \n \n \nBut now I need somewhere to put the credentials and the security parameters. Looking at the example above, it looks like I need to plug something like:\n \n \n \nHowever it is unclear to me how to implement this SecureJMSConnectionAdapter.Additionally, if I set up my own connection factory, I will lose all of MQ boot starter automagic thanks to this annotation on theMQAutoConfiguration class:@ConditionalOnMissingBean(value=javax.jms.ConnectionFactory.class)Any ideas on how to put these pieces together?EDIT: Just to avoid any possible red herrings to anyone, the MQRC2009 was irrelevant to ibm.mq.userAuthenticationMQCSP=false.### Assistant: Some of my old projects I used a bean like this:\n \n \n \nShould work well as a wrapper for yourcom.ibm.mq.jms.MQQueueConnectionFactory, but you have to use thisjmsQueueConnectionFactoryin the target components.Although it looks like the mentionedIBM MQ JMS Springdoesn't that for us properly exposing ajmsConnectionFactorybean. You can rely on the default from Spring Integration in this case or use thatjmsConnectionFactoryexplicitly for theconnection-factory.Also with Spring Boot you should consider to go away from XML configuration and give a chance for Spring Integration Java DSL:https://docs.spring.io/spring-integration/docs/5.1.7.RELEASE/reference/html/#java-dsl\n"}
+{"text": "### Human: I'm having a hard time trying to connect to my institution's MQ v9.I was provided connectivity info by the MQ team:-String hostName = '...'\nint port = ...\nString queueManager = '...'\nString channel = '...'\nString userId = 'ABC123'\nString password = '...'Given the following code...JmsConnectionFactory cf = JmsFactoryFactory.\n getInstance(WMQConstants.WMQ_PROVIDER).\n createConnectionFactory()\n\ncf.setStringProperty(WMQConstants.WMQ_HOST_NAME, hostName)\ncf.setIntProperty(WMQConstants.WMQ_PORT, port)\ncf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel)\ncf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT)\ncf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, queueManager)\ncf.setStringProperty(WMQConstants.USERID, userId)\ncf.setStringProperty(WMQConstants.PASSWORD, password)\n// tried with both `true` and `false`... same error\ncf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true)\n\nConnection connection = cf.createConnection()\nconnection.start()\nconnection.close()... I'm getting this error:-Exception in thread \"main\" com.ibm.msg.client.jms.DetailedJMSSecurityException: \nJMSWMQ2013: The security authentication was not valid \nthat was supplied for queue manager '...' with connection \nmode 'Client' and host name '...'.\nPlease check if the supplied username and password \nare correct on the queue manager to which you are \nconnecting. \nCaused by: com.ibm.mq.MQException: JMSCMQ0001: IBM \nMQ call failed with compcode '2' ('MQCC_FAILED') reason \n'2035' ('MQRC_NOT_AUTHORIZED').I was told by the MQ team that the log has something like this:------ amqzfuca.c : 4527 -------------------------------------------------------\n04/17/2019 10:32:20 AM - Process(10468.40757) User(...) Program(...)\n Host(...) Installation(Installation1)\n VRMF(9.1.0.1) QMgr(...)\n Time(2019-04-17T15:32:20.542Z)\n RemoteHost(...)\n CommentInsert1(...)\n CommentInsert2(...)\n CommentInsert3(CLNTUSER(XYZ) ADDRESS(...))\n\nAMQ9777E: Channel was blocked\n\nEXPLANATION:\nThe inbound channel '...' was blocked from address '...' \nbecause the active values of the channel matched a record\nconfigured with USERSRC(NOACCESS). The active values of the channel were\n'CLNTUSER(XYZ) ADDRESS(...)'.... and it fails because it's using the wrong credential to connect.While I passed in a different credential (user ID: ABC123), the MQ log sees the user ID I used to log into my machine (user ID: XYZ).Why does the credential I explicitly passed in get omitted? How do I fix this?I'm using this dependency:\n com.ibm.mq\n com.ibm.mq.allclient\n 9.1.2.0\nI'm not using IBM JRE... more precisely, I'm using Oracle JDK 1.8 on my Mac, if that helps.Thank you.UPDATE 2019-04-22I was able to get more accurate logs from MQ team now since I'm trying too many things at the same time.If I setUSER_AUTHENTICATION_MQCSPtotrue, then my machine's user ID (XYZ) is passed in.If I setUSER_AUTHENTICATION_MQCSPtofalse, then I'm getting different error message now:-04/22/2019 01:19:49 PM - Process(1147099.9759) User(...) Program(...)\n Host(rofesb911a) Installation(Installation1)\n VRMF(9.1.0.1) QMgr(...)\n Time(2019-04-22T18:19:49.323Z)\n RemoteHost(...)\n CommentInsert1(wa03598)\n CommentInsert2(REQUIRED)\n CommentInsert3(MCAUSER(ABC123) CLNTUSER(ABC123) ADDRESS(...))\n\nAMQ9790I: The failed authentication check was caused by a CHLAUTH record with\nCHCKCLNT(REQUIRED).\n\nEXPLANATION:\nThe user ID 'ABC123' and its password were checked because the inbound\nconnection matched a channel authentication record with CHCKCLNT(REQUIRED).\n\nThe active values of the channel were 'MCAUSER(ABC123) CLNTUSER(ABC123)\nADDRESS(...)'. The MATCH(RUNCHECK) mode of the DISPLAY CHLAUTH\nMQSC command can be used to identify the relevant CHLAUTH record.The good news is it's seeing the correct user ID (ABC123), but I was told the password is invalid. I don't believe it was a password problem because I was able to use that same credential to access other protected web services.### Assistant: Your MQ team have given you the credentials to use (i.e. user id and password) so I would assume that they have turned on user id and password checking on the queue manager.Queue Manager is not using ADOPTCTX(YES)ADOPTCTX(YES) is a setting on the queue manager that indicates that once user id and password have been verified as being correct, the user id (in your case \"ABC123\") should then be used for all further security checks (e.g. am I allowed to use this queue). If this setting is NO, then after the password validation is complete, it will actually use the client machine logged on user id which is also sent up to the queue manager (in your case \"XYZ\"). It seems likely that this is the case on your queue manager.USER_AUTHENTICATION_MQCSP modeThere are actually two ways that a user id and password can be sent from a Java client application to the queue manager.The first (decades old) was in use prior to IBM MQ V8, and used a restricted length flow (12 chars max each field) that was originally there for DOS SNA clients to send the two fields to the QMgr. This flow across the network was also the way the client logged on user id got sent to the queue manager, and so only one could be sent.The newer one, added in MQ V6, and made more useful with password checking natively in the queue manager in MQ V8, was the MQCSP structure, which allowed for variable length user id and password fields. This was a different network flow from the one that sends the client logged on user id, and so both are sent to the queue manager.When you setUSER_AUTHENTICATION_MQCSPto true, you were telling the Java client to use the second mode. This gives the opportunity to be tripped up by the ADOPTCTX(NO) setting. If you set it to false, the only user id that makes it to the queue manager is ABC123 (in your example) and will likely give you a different, perhaps successful result.Try your application withUSER_AUTHENTICATION_MQCSPset to false, and when it works, advise your MQ team that they should use ADOPTCTX(YES) which is also now the default value, then you can switch back toUSER_AUTHENTICATION_MQCSPset to true.\n"}
+{"text": "### Human: I am trying to connect to MQ using XMS .Net. The MQ is currently setup on the server and using IBM.WMQ I am able to connect to it. Now I want to explore the IBM XMS as it supports API so in future we can try connecting to MQ from .net full-framework or .net core clients.Spent 2 days over the web but not able to find a full sample where this is implemented. I also don't want to install the MQ client on my local machine. Is there a way to do this? Are there any good articles available for the same?### Assistant: Following link provides an overview of XMS.NEThttp://www-01.ibm.com/support/docview.wss?uid=swg27024064IBM MQ Redistributable package can be used to develop MQ .NET applications without installing the Client.You will have to use MQ v9.0.5 or above to use XMS.NET client.You can download the latest redistributable package from the following link9.1.0 IBM MQ C and .NET redistributable client for Windows x64If you have MQ client install then there are samples located at \"MQ_INSTALL_PATH\\Tools\\dotnet\\samples\\cs\\xms\\simple\\wmq\" and following link provides a brief description about the sampleshttps://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.xms.doc/xms_csamp.htmlFollowing is the code sample to get a message asynchronously using Message listeners./// \n /// Setup connection to MQ queue manager using XMS .NET\n /// \n private void ibmmqSetupConnection()\n {\n XMSFactoryFactory factoryFactory;\n IConnectionFactory cf;\n IDestination destination;\n IMessageConsumer consumerAsync;\n MessageListener messageListener;\n // Get an instance of factory.\n factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);\n\n // Create WMQ Connection Factory.\n cf = factoryFactory.CreateConnectionFactory();\n\n // Set the properties\n cf.SetStringProperty(XMSC.WMQ_HOST_NAME, \"host.ibm.com\");\n cf.SetIntProperty(XMSC.WMQ_PORT, 1414);\n cf.SetStringProperty(XMSC.WMQ_CHANNEL, \"QM.SVRCONN\");\n cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\n cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, \"QM1\");\n cf.SetStringProperty(XMSC.USERID, \"myuserid\");\n cf.SetStringProperty(XMSC.PASSWORD, \"passw0rd\");\n\n // Create connection.\n connectionWMQ = cf.CreateConnection();\n // Create session with client acknowledge so that we can acknowledge \n // only if message is sent to Azure Service Bus queue\n sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.ClientAcknowledge);\n // Create destination\n destination = sessionWMQ.CreateQueue(\"INPUTQ\");\n // Create consumer\n consumerAsync = sessionWMQ.CreateConsumer(destination);\n\n // Setup a message listener and assign it to consumer\n messageListener = new MessageListener(OnMessageCallback);\n consumerAsync.MessageListener = messageListener;\n\n // Start the connection to receive messages.\n connectionWMQ.Start();\n\n // Wait for messages till a key is pressed by user\n Console.ReadKey();\n\n // Cleanup\n consumerAsync.Close();\n destination.Dispose();\n sessionWMQ.Dispose();\n connectionWMQ.Close();\n }\n"}
+{"text": "### Human: I have two applications SystemA and SystemB communicating via request and response messages and using correlation IDs.I would like to be able to test SystemA in isolation without having to rely on the availability of our IBM MQ broker and SystemB. Ideally I would like to do it in our continuous integration environment (Jenkins). I am looking for common approaches to this problem, before I code a solution myself in-house.How can I create a mockup of the IBM MQ broker and SystemB for the purpose of testing SystemA in isolation?### Assistant: Why mock the queue? Have you considered mocking the consumer from the queue instead? This would be simpler and would leave the queues in place for when the full featured service became available.\n"}
+{"text": "### Human: I'm trying to connect to WebSphere MQ. But when I try to connect to the logs, I see the message:AMQ5540: The WebSphere MQ Client for Java application did not specify the user\nID and password\n\nExplanation:\n\nThe queue administrator is configured to request a user ID and password,\nbut these data not specified.\n\nLaw:\n\nMake sure that the application contains the correct user ID and password,\nor change the queue manager configuration to OPTIONAL to allow\nConnect to applications that do not specify a user ID and password.How can I configure the queue manager configuration for OPTIONAL?### Assistant: IBM MQ Technote \"AMQ5540, AMQ5541 and AMQ5542, application did not supply a user ID and password, 2035 MQRC_NOT_AUTHORIZED\" describes how resolve this issue.I would suggest you look at how to provide a valid username and password instead of disabling this check by setting it toOPTIONAL, but the above Technote shows both how to send the password from various types of applications and how to set it toOPTIONAL.\n"}
+{"text": "### Human: Is arefresh security type(ssl)command needed or not after we deploy renewed certs into keystore. I usually execute this command after certs renewal, but I saw cases where this command is not executed and still the channels picked up the new certs. Are the certs which are put into the keystore are coming into effect immediately or we need to perform ssl refresh.### Assistant: To ensure that all connections in or out of the queue manager are using current information in the key store you should always run theREFRESH SECURITY TYPE(SSL)after any updates are made (for example to the private key or even adding new trusted CA certs).The first time any MQ process needs to access the key store, the process will read the key store and cache it in memory. In a default configuration the connections into the queue manager are handled by processes that keep running so they would hold onto that key store cache after the first inbound connection to the queue manager which requires the key store. In a default configuration outbound channel connections use separate runmqchl processes that start when the channel is started so they always read the current key store each time.This means that in some cases things may work without aREFRESH SECURITY TYPE(SSL)for example:If a SDR channel withMCATYPE(PROCESS)starts, a new runmqchl process is started and will read the key store fresh and pick up any changes.If no inbound TLS connection has been received since the last time the queue manager was started then even if you make changes to the key store they will be picked up the first time an inbound TLS connection is received.Morag Hughson gave a presentation at Capitalware's MQ Technical Conference v2.0.1.4 titled \"MQ SSL/TLS Channels Including V8 changes\". The notes portion of page 10 of the PDF have a good summary of whatREFRESH SECURITY TYPE(SSL)does.Refreshing SSL on WebSphere MQ - NotesThis feature was introduced in WebSphere MQ V6.The SSL environment set up to run SSL channels in a channel process has a cached view of the key repository made at initialization time.\n If you make changes to your key repository, i.e. add, remove or update\n certificates, for example, because your are replacing a certificate\n that is about to expire, this cached view needs to be refreshed in\n order for the SSL channels to start using the new certificates.In order to refresh this cached view of the SSL environment, without disrupting any non-SSL channels, use the REFRESH SECURITY TYPE(SSL)\n command. This will stop all the SSL channels on the queue manager, new\n cached view(s) of the key repository will be made and all the sending\n type channels will be started again. Receiving type channels will get\n restarted as the partner end retries the connection.Non-SSL channels will be unaffected by this command and will continue to run.Also use this command to pick up other changes, such as a new Key Repository locations, or new LDAP CRL/ARL locations.IBM documents this in the IBM MQ Knowledge Center, below are two pages with information on the topic:IBM MQ v7.5 KC page \"Refreshing SSL or TLS security\"About this taskWhen a channel is secured using Secure Sockets Layer (SSL) or TLS, the\n digital certificates and their associated private keys are stored in\n the key repository. A copy of the key repository is held in memory\n while a channel is running. If you make a change to the key\n repository, you can refresh the copy of the key repository that is\n held in memory without restarting the channel.When you refresh the cached copy of the key repository, all SSL or TLS\n channels that are currently running are updated:Sender, server, and cluster-sender channels that use SSL or TLS are allowed to complete the current batch of messages. The channels then\n run the SSL handshake again with the refreshed view of the key\n repository.All other channel types that use SSL or TLS are stopped. If the partner end of the stopped channel has retry values defined, the\n channel retries and runs the SSL handshake again. The new SSL\n handshake uses the refreshed view of the contents of the key\n repository, the location of the LDAP server to be used for the\n Certificate Revocation Lists, and the location of the key repository.\n In the case of server-connection channel, the client application loses\n its connection to the queue manager and has to reconnect to continue.MQ v7.5 KC page \"REFRESH SECURITY\" states:Usage notes for REFRESH SECURITYWhen you issue the REFRESH SECURITY TYPE(SSL) MQSC command, all\n running SSL channels are stopped and restarted. Sometimes SSL channels\n can take a long time to shut down and this means that the refresh\n operation takes some time to complete. There is a time limit of 10\n minutes for an SSL refresh to complete (or 1 minute on z/OS), so it\n can potentially take 10 minutes for the command to finish. This can\n give the appearance that the refresh operation has \"frozen\". The\n refresh operation will fail with an MQSC error message of AMQ9710 or\n PCF error MQRCCF_COMMAND_FAILED if the timeout is exceeded before all\n channels have stopped. This is likely to happen if the following\n conditions are true:The queue manager has many SSL channels running simultaneously when the refresh command is invokedThe channels are handling large numbers of messagesIf a refresh fails under these conditions, retry the command later\n when the queue manager is less busy. In the case where many channels\n are running, you can choose to stop some of the channels manually\n before invoking the REFRESH command....When using TYPE(SSL):On platforms other than z/OS, the command updates all SSL channels regardless of whether a security refresh is needed.If a refresh is to be performed, the command updates all SSL channels currently running, as follows:Sender, server and cluster-sender channels using SSL are allowed to complete the current batch. In general they then run the SSL handshake\n again with the refreshed view of the SSL key repository. However, you\n must manually restart a requester-server channel on which the server\n definition has no CONNAME parameter.All other channel types using SSL are stopped with a STOP CHANNEL MODE(FORCE) STATUS(INACTIVE) command. If the partner end of the\n stopped message channel has retry values defined, the channel retries\n and the new SSL handshake uses the refreshed view of the contents of\n the SSL key repository, the location of the LDAP server to be used for\n Certification Revocation Lists, and the location of the key\n repository. In the case of a server-connection channel, the client\n application loses its connection to the queue manager and has to\n reconnect in order to continue.\n"}
+{"text": "### Human: I wrote a client to read segmented message sent via MQ but getting error message. Below code work perfectly fine but it read single message at time, Application has to concatenate the segmented message which is not what I wantedpublic void getMessage(){\n\n try {\n\n MQEnvironment.hostname = \"\"; \n MQEnvironment.channel = \"\"; \n MQEnvironment.port = ;\n\n MQQueueManager QMgr = new MQQueueManager(\"MQManager\");\n\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n\n gmo.options = MQConstants.MQOO_INPUT_AS_Q_DEF|\n MQConstants.MQGMO_WAIT|\n MQConstants.MQGMO_ALL_SEGMENTS_AVAILABLE|\n MQConstants.MQGMO_LOGICAL_ORDER;\n\n gmo.matchOptions = MQConstants.MQMO_NONE;\n gmo.waitInterval = MQConstants.MQWI_UNLIMITED;\n\n MQMessage message = new MQMessage();\n MQQueue queue = QMgr.accessQueue(\"QName\",\n gmo.options);\n\n while(true){\n\n queue.get(message, gmo);\n int dataLength = message.getDataLength(); \n System.out.println(message.readStringOfCharLength(dataLength));\n message.clearMessage();\n }\n } catch (Exception e) {\n\n e.printStackTrace();\n }\n }When I added MQGMO_SYNCPOINT to options, it fails with com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2046'.Not sure why this fails, if I can atleast get this to work, I will be able to commit after safely processing all segmented message in the application.public void getMessage(){\n\n try {\n\n MQEnvironment.hostname = \"\"; \n MQEnvironment.channel = \"\"; \n MQEnvironment.port = ;\n\n MQQueueManager QMgr = new MQQueueManager(\"MQManager\");\n\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n\n gmo.options = MQConstants.MQOO_INPUT_AS_Q_DEF|\n MQConstants.MQGMO_WAIT|\n MQConstants.MQGMO_ALL_SEGMENTS_AVAILABLE|\n MQConstants.MQGMO_LOGICAL_ORDER|\n MQConstants.MQGMO_SYNCPOINT;\n\n gmo.matchOptions = MQConstants.MQMO_NONE;\n gmo.waitInterval = MQConstants.MQWI_UNLIMITED;\n\n MQMessage message = new MQMessage();\n MQQueue queue = QMgr.accessQueue(\"QName\",\n gmo.options);\n\n while(true){\n\n queue.get(message, gmo);\n int dataLength = message.getDataLength(); \n System.out.println(message.readStringOfCharLength(dataLength));\n QMgr.commit();\n message.clearMessage();\n }\n } catch (Exception e) {\n\n e.printStackTrace();\n }\n }When I try to read segmented message as a single message; it fails with \ncom.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2046'.I would appreciate if some could help solve this issue; I am not really sure what is wrong with the below code. This is my preferred way to read the segmented message.public void getMessage(){\n\n\n try {\n\n MQEnvironment.hostname = \"\"; \n MQEnvironment.channel = \"\"; \n MQEnvironment.port = ;\n\n MQQueueManager QMgr = new MQQueueManager(\"MQManager\");\n\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n\n gmo.options = MQConstants.MQOO_INPUT_AS_Q_DEF|\n MQConstants.MQGMO_WAIT|\n MQConstants.MQGMO_COMPLETE_MSG;\n\n gmo.matchOptions = MQConstants.MQMO_NONE;\n gmo.waitInterval = MQConstants.MQWI_UNLIMITED;\n\n MQMessage message = new MQMessage();\n MQQueue queue = QMgr.accessQueue(\"QName\",\n gmo.options);\n\n while(true){\n\n queue.get(message, gmo);\n int dataLength = message.getDataLength(); \n System.out.println(message.readStringOfCharLength(dataLength));\n message.clearMessage();\n }\n } catch (Exception e) {\n\n e.printStackTrace();\n }\n }### Assistant: The issue is that you are usinggmo.optionsas the open options for theaccessQueuemethod and the get message options for theget. You are mixing both open options and get message options into this field.Each option is represented by a bit in the options field. When you use that field as the open options the bits are being interpreted by MQ as open options even if you specify get message options, conversely when you use the field as the get message options they are being interpreted by MQ as get message options.Lets look at the values of each option you are specifying in the your samples represented as hex along with the equivalent open or get option based on the value:MQOO_INPUT_AS_Q_DEF 0x00000001\nMQGMO_WAIT 0x00000001\n\nMQOO_INPUT_SHARED 0x00000002\nMQGMO_SYNCPOINT 0x00000002\n\nMQOO_RESOLVE_NAMES 0x00010000\nMQGMO_COMPLETE_MSG 0x00010000\n\nMQOO_BIND_NOT_FIXED 0x00008000\nMQGMO_LOGICAL_ORDER 0x00008000\n\nMQOO_RESOLVE_LOCAL_Q 0x00040000\nMQOO_RESOLVE_LOCAL_TOPIC 0x00040000\nMQGMO_ALL_SEGMENTS_AVAILABLE 0x00040000Because you are incorrectly using this as open options withQMgr.accessQueue(\"QName\",gmo.options);MQ is interpreting this in unexpected ways.For your first \"working\" example, the open options would be interpreted as specified below, these specific open options together would not cause any problems for local queues, this is why it is \"working\" even though it is not correct:MQOO_INPUT_AS_Q_DEF 0x00000001\nMQOO_INPUT_AS_Q_DEF 0x00000001 //MQGMO_WAIT\nMQOO_RESOLVE_LOCAL_Q 0x00040000 //MQGMO_ALL_SEGMENTS_AVAILABLE\nMQOO_RESOLVE_LOCAL_TOPIC 0x00040000 //MQGMO_ALL_SEGMENTS_AVAILABLE\nMQOO_BIND_NOT_FIXED 0x00008000 //MQGMO_LOGICAL_ORDERIn your second example that fails with2046 (MQRC_OPTIONS_ERROR)it is because the options are being interpreted as specified below. You cannot haveMQOO_INPUT_AS_Q_DEFandMQOO_INPUT_SHAREDtogether in the open options, this causes the2046:MQOO_INPUT_AS_Q_DEF 0x00000001\nMQOO_INPUT_AS_Q_DEF 0x00000001 //MQGMO_WAIT\nMQOO_RESOLVE_LOCAL_Q 0x00040000 //MQGMO_ALL_SEGMENTS_AVAILABLE\nMQOO_RESOLVE_LOCAL_TOPIC 0x00040000 //MQGMO_ALL_SEGMENTS_AVAILABLE\nMQOO_BIND_NOT_FIXED 0x00008000 //MQGMO_LOGICAL_ORDER\nMQOO_INPUT_SHARED 0x00000002 //MQGMO_SYNCPOINTIn your third example that fails with2046 (MQRC_OPTIONS_ERROR)it is because the options are being interpreted as specified below.MQOO_RESOLVE_NAMESis documented as valid only in the MQ C++ APIs, this causes the2046:MQOO_INPUT_AS_Q_DEF 0x00000001\nMQOO_INPUT_AS_Q_DEF 0x00000001 //MQGMO_WAIT\nMQOO_RESOLVE_NAMES 0x00010000 //MQGMO_COMPLETE_MSGUsing theMQOO_INPUT_AS_Q_DEFas a get message option is not causing any issues because it has the same value asMQGMO_WAITwhich you already have in each of your examples, having this is not changing the behavior of the get message options.MQGMO_WAIT 0x00000001 //MQOO_INPUT_AS_Q_DEF\nMQGMO_WAIT 0x00000001The following based on your second and third examples should work:public void getMessage(){\n\n\n try {\n\n MQEnvironment.hostname = \"\"; \n MQEnvironment.channel = \"\"; \n MQEnvironment.port = ;\n\n MQQueueManager QMgr = new MQQueueManager(\"MQManager\");\n\n // Set up the options on the queue we wish to open\n int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF;\n\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n\n gmo.options = MQConstants.MQGMO_WAIT|\n MQConstants.MQGMO_ALL_SEGMENTS_AVAILABLE|\n MQConstants.MQGMO_LOGICAL_ORDER|\n MQConstants.MQGMO_SYNCPOINT|\n MQConstants.MQGMO_COMPLETE_MSG;\n\n gmo.matchOptions = MQConstants.MQMO_NONE;\n gmo.waitInterval = MQConstants.MQWI_UNLIMITED;\n\n MQMessage message = new MQMessage();\n MQQueue queue = QMgr.accessQueue(\"QName\", openOptions);\n\n while(true){\n\n queue.get(message, gmo);\n int dataLength = message.getDataLength(); \n System.out.println(message.readStringOfCharLength(dataLength));\n QMgr.commit();\n message.clearMessage();\n }\n } catch (Exception e) {\n\n e.printStackTrace();\n }\n }If you run themqrcutility that comes with full MQ client installs you can find out what the error code translates to:$mqrc 2046\n\n 2046 0x000007fe MQRC_OPTIONS_ERROR\n"}
+{"text": "### Human: If a Solaris based MQ Manager is sending messages to an intermediate Windows MQ Manager that then sends on messages to a Linux MQ manager, does the CCSID need to be changed on them all to be the same? I don't think so but I am being pushed to do so...I have an issue where a client is sending messages from an application on Solaris via an intermediate MQ Manager on Windows but the Linux MQ Manager final destination based application receives the message with CR/LF line ending characters it can't deal with. Should the receiver end group write a conversion exit program? Or an MCA?### Assistant: IBM MQ does not deal with line feeds. It is not like transferring a file with ftp and using ascii mode where ftp will convert from Unix LF end of line to Window CR and LF end of line. For MQ it is just another character in the character set to translate. If the sending app is sending data that includes CR/LF characters, MQ will treat them as any other character in the data. If the receiving application expecting a file with end of lines to be sent as a MQ message it would be required to deal with the end of lines.MQ Classes for Java applications running on a Solaris server default to CCSID 819, and a IBM MQ queue manager running on Solaris also will default to CCSID 819.CCSID 819is described asISO 8859-1 ASCII.I created a file called test.txt containing the single word \"test\" and ran unix2dos against the file.The output below shows the ASCII characters as HEX values:$cat test.txt | hexdump -C\n00000000 74 65 73 74 0d 0a |test..|\n00000006Note that in the above output the ASCII hex values0dis theCRand0ais theLF, these are the common Windows end of line.If we assume that the default CCSID 819 is used for both the Solaris MQ Classes for Java application and the Solaris queue manager, then we can start out with the assumption that the above two hex values represent CR/LF at the end of each line.You stated that your Windows queue manager has CCSID 437 which is typical for a US based Windows server.CCSID 437is described asUSA PC-DATAand is also ASCII.Linux queue managers typically default to CCSID 1208.CCSID 1208is described asUTF-8 with IBM PUAand is a Variable Byte character set it can have from 1 to four bytes per character. This can represent over a million characters including all ASCII characters. All 127 ASCII characters are represented in UTF-8 as the same single byte HEX values as in ASCII.Going from ASCII to UTF-8 is loss less, going from UTF-8 to ASCII can have loss if non-ASCII characters are used since there is not a equivalent character in ASCII and MQ converts it to the default substitution character with HEX value1A. I have seen this for example with a Euro symbol. Most if not all of the first 255 characters of UTF-8 are the same as CCSID 819.Given the above CCSID assumptions the conversion would look like this:Original IBM MQ Classes for Java app running on Solaris sending data with CR/LF end of line characters:$cat test.txt | hexdump -C\n00000000 74 65 73 74 0d 0a |test..|\n00000006Solaris Queue Manager Sender channel with CONVERT(YES) sending to Windows Queue Manager with CCSID 437:cat test.txt | iconv -f IBM819 -t IBM437 | hexdump -C\n00000000 74 65 73 74 0d 0a |test..|\n00000006As expected the output is the same since both 819 and 437 are ASCII character sets and the data was not representing any thing above the first 127 ASCII characters.Solaris Queue Manager Sender channel with CONVERT(YES) sending to Windows Queue Manager with CCSID 437 Sender channel with CONVERT(YES) sending to Linux Queue Manager with CCSID 1208:cat test.txt | iconv -f IBM819 -t IBM437 | iconv -f IBM437 -t UTF-8 | hexdump -C\n00000000 74 65 73 74 0d 0a |test..|\n00000006As expected the output is the same since both 819 and 437 are ASCII character sets and the first 127 characters of UTF-8 (1208) are normal ASCII characters.Summary: If the sending application is sending CR/LF in the data, MQ message conversion will not change this and if the CCSIDs in use are the above listed CCSIDs it does not even change the actual HEX character value. The sending application would need to change what they are sending or the receiving application would need to accommodate these characters.A good reference on ASCII, UNICODE, UTF-8 and more can be found in the article \"Unicode, UTF8 & Character Sets: The Ultimate Guide\".\n"}
+{"text": "### Human: Problem: MQ7 has a hard limit of a maximum 100MB jms message. For large payloads ( xml ) that are close that, can this be compressed on the queue to shorten the data length?I tried compressing a 7MB jms string message using the MQ ZLIB compression on the svr.def.conn channel and it didn't make any difference to the data length of the jms message. I only set the one channel and expected the channel that is used would compress the data going into the queue.MQ Server: 7.5\nClient: JAVA\nMessage Type: String### Assistant: Channel level compression is used to compress the data in transit between the two ends of the channel, in your case between the JMS client and the MQ SVRCONN channel. The messages themselves will be compressed while going over the network but not while sitting on the queue.\n"}
+{"text": "### Human: JMS app requires seven parameters to make successful SSL connection with MQ series given here,https://github.com/ibm-messaging/mq-tls-ssl-wizard/blob/master/com.ibm.mq.ssl-wizard/src/tlswizard/samples/SSLSampleJMS.javaI am trying to interpret these parameters,Conname- the connection name of the server queue manager in the same format as the CONNAME parameter on the MQSC DEFINE CHANNEL command, but without the port specified.I guess this is host namePort - the connection port of the server queue manager.This is port numberSvrconnChannelName - the name of the server connection channel on the server queue manager with which the sample program will try to connect.QMgrName - the name of the server queue manager.SSLCiph - the SSL CipherSpec.I am using SSL_RSA_WITH_AES_256_CBC_SHA.SSLKeyr - the name of a single store, which is both the keystore and truststore.I generated myjksfile.jks using mycertfile.cert using mypassword with below command and provided path of this file in program as \"C:\\Users\\abc\\myjksfile.jks\",keytool -import -trustcacerts -keystore myjksfile.jks -storepass changeit -noprompt -alias ibmWebSphereMQUTQX -file C:\\mqlib\\mycertfile.certSSLKeyrPassword - the SSL key repository password\nthe password which I used to generate myjksfile.jks fileRunning above program with these seven parameters results this exception,com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to \nqueue manager 'XXXX' with connection mode 'Client' and host name \n'xxxx.yyyyyy.com(XXXXX)'.Check the queue manager is started and if running in\nclient mode, check there is a listener running. Please see the linked \nexception for more information. at \ncom.ibm.msg.client.wmq.common.internal.Reason.reasonToException\n(Reason.java:580) at \ncom.ibm.msg.client.wmq.common.internal.Reason.createException\n(Reason.java:216) at com.ibm.msg.client.wmq.internal.WMQConnection. \n(WMQConnection.java:431) at \ncom.ibm.msg.client.wmq.factories.WMQConnectionFactory.\ncreateV7ProviderConnection(WMQConnectionFactory.java:6789) at \ncom.ibm.msg.client.wmq.factories.WMQConnectionFactory.\ncreateProviderConnection(WMQConnectionFactory.java:6157)\nat com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.\ncreateConnection(JmsConnectionFactoryImpl.java:285)\nat com.ibm.mq.jms.MQConnectionFactory.createCommonConnection\n(MQConnectionFactory.java:6126) at \ncom.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection \n(MQQueueConnectionFactory.java:115) at \nSSLSampleJMS.runSample(SSLSampleJMS.java:176)\nat SSLSampleJMS.main(SSLSampleJMS.java:135)\nCaused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with\ncompcode '2' ('MQCC_FAILED') reason '2393' ('MQRC_SSL_INITIALIZATION_ERROR').\nat com.ibm.msg.client.wmq.common.internal.Reason.createException\n(Reason.java:204)... 8 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2393;AMQ9204: Connection to\nhost 'xxxx.yyyyyy.com(XXXXX)' rejected.\n[1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2393;AMQ9771: SSL handshake failed.\n[1=java.lang.IllegalArgumentException[Cannot support\nSSL_RSA_WITH_AES_256_CBC_SHA with currently installed \nproviders],3=xxxx.yyyyyy.com/XX.XXX.XXX.XXX:XXXXX (xxxx.yyyyyy.com),4=SSLSocket.createSocket,5=default]],3=xxxx.yyyyyy.com(XXXXX),5=RemoteTCPConnection.makeSocketSecure]\nat com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2098)\nat com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1347)\nat com.ibm.msg.client.wmq.internal.WMQConnection.(WMQConnection.java:350)\n... 7 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2393;AMQ9771: SSL handshake\nfailed. [1=java.lang.IllegalArgumentException[Cannot support\nSSL_RSA_WITH_AES_256_CBC_SHA with currently installed \nproviders],3=xxxx.yyyyyy.com/XX.XXX.XXX.XXX:XXXXX\n(xxxx.yyyyyy.com),4=SSLSocket.createSocket,5=default]\nat com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.makeSocketSecure\n(RemoteTCPConnection.java:2001) at com.ibm.mq.jmqi.remote.impl.\nRemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:855)\nat com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect\n(RemoteTCPConnection.java:1262) at \ncom.ibm.mq.jmqi.remote.impl.RemoteConnection.connect\n(RemoteConnection.java:714) at \ncom.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.\ngetSessionFromNewConnection(RemoteConnectionSpecification.java:356)\nat com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.\ngetSession(RemoteConnectionSpecification.java:265)\nat com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.\ngetSession(RemoteConnectionPool.java:144)\nat com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1709)\n... 9 more\nCaused by: java.lang.IllegalArgumentException: Cannot support\nSSL_RSA_WITH_AES_256_CBC_SHA with currently installed providers\nat com.ibm.jsse2.o.(o.java:29)\nat com.ibm.jsse2.as.setEnabledCipherSuites(as.java:5)\nat com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.makeSocketSecure\n(RemoteTCPConnection.java:1994)\n... 16 more\nProcess finished with exit code 0### Assistant: Above exception was cause of using wrong cipher suite on JMS clint side. I was using SSL_RSA_WITH_AES_256_CBC_SHA cipher suite on client side and was getting \"java.lang.IllegalArgumentException[Cannot support\nSSL_RSA_WITH_AES_256_CBC_SHA with currently installedproviders.\" Using correct cipher suite (TLS_RSA_WITH_AES_256_CBC_SHA) at JMS client side made handshake successful between JMS client and MQ series.\nRef:http://www-01.ibm.com/support/docview.wss?uid=swg1IV66840\n"}
+{"text": "### Human: I am trying to connect to a remote IBM MQ server (v.8.0) and am receiving the error below. I'm using .Net 4.5.2 on Windows 10.\nI have modified the SimplePut.exe program that ships with the client install. I think I may be missing something to do with the client certificate I was issued and have installed following their instructions. Possibly the CertificateLabel setting? I am very new to IBM MQ so any help is much appreciated.-h -p 1434 -s TLS_RSA_WITH_AES_256_CBC_SHA256 -q INS -l connection -k *SYSTEMThe error shown at the queue manager when I run the program is as follows:Cause . . . . . :\nThere is a mismatch between the CipherSpecs on the local and remote ends of\nchannel ''. The channel will not run until this mismatch is resolved.\nThe local CipherSpec is 'TLS_RSA_WITH_AES_256_CBC_SHA256' and the remote\nCipherSpec is 'TLS_RSA_WITH_AES_128_CBC_SHA256'.\nRecovery . . . :\nChange the channel definition for '' so that both ends have matching\nCipherSpecs and restart the channel.### Assistant: MQ v8.0 Knowledge Center page \"Configuring SSL for managed IBM MQ .NET\" states the following:c. If needed, edit the Windows Group Policy to set the CipherSpec, then, for the Windows Group Policy updates to take effect, restart the computer.anda. Set the MQEnvironment or the SSLCipherSpec value to denote the connection as a secured connection. The value that you specify is used to identify the SSL protocol being used (SSL or TLS) andmust match with any preference that you have specified in the Windows Group Policy.MQ v8.0 Knowledge Center page \"CipherSpec support for the managed .NET client\" goes into some more detail:For the IBM MQ.NET managed client, the SSL settings are for the Microsoft.NET SSLStream class. For SSLStream, a CipherSpec, or a preference list of CipherSpecs,can be set only in the Windows group policy, which is a computer-wide setting. SSLStream then uses the specified CipherSpec or preference list during the handshake with the server. In case of other IBM MQ clients, the CipherSpec property can be set in the application on the IBM MQ channel definition and the same setting is used for SSL negotiation.As a result of this restriction, the SSL/TLS handshake might negotiate any supported CipherSpec regardless of what is specified in the IBM MQ channel configuration.Therefore, it is likely that this will result in errorAMQ9631on the queue manager. To avoid this error,set the same CipherSpec as the one that you have set in the application as the SSL configuration in the Windows group policy.Windows group policyWhen a CipherSpec is set on the Windows group policy, the same CipherSpec must be set for the SSLCipherSpec property value on the SVRCONN channel and in the application.If the Windows group policy is set to the default, that is the group policy is not enabled/edited for CipherSpec setting, applications must set the same default value of the CipherSpec from the Windows group policy SSL configurationin the MQEnvironment class or in the MQQueueManager constructor hashtable properties.UPDATE on specifying cert label with Managed .NETMQ v8.0 Knowledge Center page \"Using certificates for the managed .NET client\" goes into detail of the two options to allow MQ to find the cert:Matching certificates by certificate labelIf you set the certificate label, the IBM MQ managed .NET client searches the Windows certificate store with the given label name to identify the client certificate. It loads all matching certificates and uses the first certificate on the list. There are two options for setting the certificate label:The certificate label can set on the MQEnvironment class accessing MQEnvironment.CertificateLabel.The certificate label can also be set in a hash table properties, supplied as input parameter with MQQueueManager constructor as shown in the following example.Hashtable properties = new Hashtable();properties.Add(\"CertificateLabel\", \"mycert\");The name(\"CertificateLabel\") and the value are case sensitive.Matching certificates by stringIf certificate label is not set, then the certificate that matches the string \"ibmwebspheremq\" and the current logged on user (in lower case) is searched for and used.UPDATE with additional helpful blog post@renz found the IBM developerWorks MQdev Blog posted by Sudhanshu Pant \"MQ v8: SSL connection in Managed MQ .NET\" which also has good information with screen shots.\n"}
+{"text": "### Human: I am new to IBM Websphere MQI am trying add messages to a Remote websphere MQ queue manager. I am getting following error while trying to connect to it.Also, I have tried many possible solutions provided in forums like changing .net framework to 3.5 also I am getting good ping while I ping the remote machine but I am unable to connect to it using C# code. The queue manager listener is up and running, but this is the error I am getting2538 - MQRC_HOST_NOT_AVAILABLEwhile trying to do this.queueManager = new MQQueueManager();I am using .net framework 4.5. Any help would be appreciated.### Assistant: MQRC_HOST_NOT_AVAILABLEcould mean that your client is unable to find the Queue Manager you have told it to look for. Given that you have said your code isqueueManager = new MQQueueManager();I suspect you haven't told your .NET some key bits of information it needs to know to be able to find the Queue Manager. In order to connect a MQ Client to a Queue Manager, it needs to know thechannel to connect intoHostname of the machine running the Queue ManagerPort that the Queue manager is running onFor .NET these can be supplied in different ways which are detailed in theknowledge center doc on the MQQueueManager class.From that page the example code to connect to a Queue Manager says:MQEnvironment.hostname = \"fred.mq.com\"; // host to connect toMQEnvironment.port = -1; // port to connect to. If not set, this defaults to 1414 for WebSphereMQ Client connections.MQEnvironment.channel = \"channel.name\"; // the CASE-SENSITIVE name of the SVRCONN channel on the queue managerMQQueueManager qMgr = new MQQueueManager(\"MYQM\");Also note that the call to create a MQQueueManager also takes a parameter which is the name of the Queue Manager connecting to.Check that you are providing all of the necessary information that a client needs to connect including the name of the Queue Manager. If it is still failing then the check the Queue Manager's logs for any error messages (if there are none the Client really isn't getting to the Queue Manager otherwise the error message will say why the Queue Manager isn't responding)\n"}
+{"text": "### Human: I have this test code that listens for messages forever. If it gets one it prints it out. What I want to do is avoid having to construct a MQMessage object prior to each get(). How do i reuse a MQMessage for multiple calls to get()?using System;\nusing IBM.WMQ;\n\nnamespace WMQ {\n class Program {\n static void Main(string[] args) {\n string QueueManagerName = \"A1PATA00\";\n string channelName = \"ECACHE\";\n string connectionName = \"A1PATA00.WORLDSPAN.COM(1414)\";\n var queueManager = new MQQueueManager(QueueManagerName, channelName, connectionName);\n MQQueue get = queueManager.AccessQueue(\"SPLASH.ECAC.2\", MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQGMO_FAIL_IF_QUIESCING);\n var gmo = new MQGetMessageOptions();\n gmo.Options = MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_WAIT;\n gmo.WaitInterval = 10000000;// wait time\n // var queueMessage = new MQMessage(); <--- i want to do this new once!\n while (true) {\n var queueMessage = new MQMessage(); // <-- only works if I do this every time i do a get\n get.Get(queueMessage, gmo);\n var strReturn = queueMessage.ReadString(queueMessage.MessageLength);\n Console.WriteLine(strReturn);\n }\n }\n }\n}### Assistant: When I see questions like this, I shake my head. You do not\nunderstand object oriented concepts in the .NET VM (framework) and\ngarbage collection.Also, why don't you write pure C# code?Finally, in a world where security is very important, your code does\nnot support either SSL/TLS and/or UserID & Password authentication.(1) Please notice where I am defining the MQMessage object (very important).There is basically no difference in memory usage or speed between the following 2 code snippets:(A)MQMessage msg = null;\nwhile (true)\n{\n msg = new MQMessage();\n get.Get(msg, gmo);\n Console.WriteLine(msg.ReadString(msg.MessageLength));\n}(B)MQMessage msg = new MQMessage();\nwhile (true)\n{\n get.Get(msg, gmo);\n Console.WriteLine(msg.ReadString(msg.MessageLength));\n msg.ClearMessage();\n msg.MessageId = MQC.MQMI_NONE;\n msg.CorrelationId = MQC.MQCI_NONE;\n}I prefer (A) because it is cleaner and easier to read.(2) When you use 'var', you are forcing the .NET framework to guess at what you are doing. Do pure object oriented programming.\ni.e.MQMessage msg = new MQMessage();(3) Explicitly setting the channel name and connection name in the MQQueueManager does not allow setting of MQ security information. Also, do NOT use the MQEnvironment class as it is NOT thread safe. It is far better to put all the information in a Hashtable and pass the Hashtable to the MQQueueManager class. Here is a MQ .NET managed-mode example using a Hashtable for MQ connection information:using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing IBM.WMQ;\n\nnamespace MQTest02\n{\n class MQTest02\n {\n private Hashtable inParms = null;\n private Hashtable qMgrProp = null;\n private System.String qManager;\n private System.String outputQName;\n\n /*\n * The constructor\n */\n public MQTest02()\n : base()\n {\n }\n\n /// Make sure the required parameters are present.\n /// true/false\n /// \n private bool allParamsPresent()\n {\n bool b = inParms.ContainsKey(\"-h\") && inParms.ContainsKey(\"-p\") &&\n inParms.ContainsKey(\"-c\") && inParms.ContainsKey(\"-m\") &&\n inParms.ContainsKey(\"-q\");\n if (b)\n {\n try\n {\n System.Int32.Parse((System.String)inParms[\"-p\"]);\n }\n catch (System.FormatException e)\n {\n b = false;\n }\n }\n\n return b;\n }\n\n /// Extract the command-line parameters and initialize the MQ variables.\n /// \n /// \n /// IllegalArgumentException \n private void init(System.String[] args)\n {\n inParms = Hashtable.Synchronized(new Hashtable());\n if (args.Length > 0 && (args.Length % 2) == 0)\n {\n for (int i = 0; i < args.Length; i += 2)\n {\n inParms[args[i]] = args[i + 1];\n }\n }\n else\n {\n throw new System.ArgumentException();\n }\n\n if (allParamsPresent())\n {\n qManager = ((System.String)inParms[\"-m\"]);\n outputQName = ((System.String)inParms[\"-q\"]);\n\n qMgrProp = new Hashtable();\n qMgrProp.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\n\n qMgrProp.Add(MQC.HOST_NAME_PROPERTY, ((System.String)inParms[\"-h\"]));\n qMgrProp.Add(MQC.CHANNEL_PROPERTY, ((System.String)inParms[\"-c\"]));\n\n try\n {\n qMgrProp.Add(MQC.PORT_PROPERTY, System.Int32.Parse((System.String)inParms[\"-p\"]));\n }\n catch (System.FormatException e)\n {\n qMgrProp.Add(MQC.PORT_PROPERTY, 1414);\n }\n\n if (inParms.ContainsKey(\"-u\"))\n qMgrProp.Add(MQC.USER_ID_PROPERTY, ((System.String)inParms[\"-u\"]));\n\n if (inParms.ContainsKey(\"-x\"))\n qMgrProp.Add(MQC.PASSWORD_PROPERTY, ((System.String)inParms[\"-x\"]));\n\n if (inParms.ContainsKey(\"-s\"))\n qMgrProp.Add(MQC.SECURITY_EXIT_PROPERTY, ((System.String)inParms[\"-s\"]));\n\n System.Console.Out.WriteLine(\"MQTest02:\");\n Console.WriteLine(\" QMgrName ='{0}'\", qManager);\n Console.WriteLine(\" Output QName ='{0}'\", outputQName);\n\n System.Console.Out.WriteLine(\"QMgr Property values:\");\n foreach (DictionaryEntry de in qMgrProp)\n {\n Console.WriteLine(\" {0} = '{1}'\", de.Key, de.Value);\n }\n }\n else\n {\n throw new System.ArgumentException();\n }\n }\n\n /// Connect, open queue, read a message, close queue and disconnect.\n ///\n /// \n /// MQException \n private void testReceive()\n {\n MQQueueManager qMgr = null;\n MQQueue queue = null;\n int openOptions = MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING;\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n MQMessage receiveMsg = null;\n\n try\n {\n qMgr = new MQQueueManager(qManager, qMgrProp);\n System.Console.Out.WriteLine(\"MQTest02 successfully connected to \" + qManager);\n\n queue = qMgr.AccessQueue(outputQName, openOptions, null, null, null); // no alternate user id\n System.Console.Out.WriteLine(\"MQTest02 successfully opened \" + outputQName);\n\n receiveMsg = new MQMessage();\n\n queue.Get(receiveMsg, gmo);\n System.Console.Out.WriteLine(\"Message Data>>>\" + receiveMsg.ReadString(receiveMsg.MessageLength));\n }\n catch (MQException mqex)\n {\n System.Console.Out.WriteLine(\"MQTest02 cc=\" + mqex.CompletionCode + \" : rc=\" + mqex.ReasonCode);\n }\n catch (System.IO.IOException ioex)\n {\n System.Console.Out.WriteLine(\"MQTest02 ioex=\" + ioex);\n }\n finally\n {\n try\n {\n queue.Close();\n System.Console.Out.WriteLine(\"MQTest02 closed: \" + outputQName);\n }\n catch (MQException mqex)\n {\n System.Console.Out.WriteLine(\"MQTest02 cc=\" + mqex.CompletionCode + \" : rc=\" + mqex.ReasonCode);\n }\n try\n {\n qMgr.Disconnect();\n System.Console.Out.WriteLine(\"MQTest02 disconnected from \" + qManager);\n }\n catch (MQException mqex)\n {\n System.Console.Out.WriteLine(\"MQTest02 cc=\" + mqex.CompletionCode + \" : rc=\" + mqex.ReasonCode);\n }\n }\n }\n\n /// main line\n /// \n /// \n // [STAThread]\n public static void Main(System.String[] args)\n {\n MQTest02 mqt = new MQTest02();\n\n try\n {\n mqt.init(args);\n mqt.testReceive();\n }\n catch (System.ArgumentException e)\n {\n System.Console.Out.WriteLine(\"Usage: MQTest02 -h host -p port -c channel -m QueueManagerName -q QueueName [-u userID] [-x passwd] [-s securityExit]\");\n System.Environment.Exit(1);\n }\n catch (MQException e)\n {\n System.Console.Out.WriteLine(e);\n System.Environment.Exit(1);\n }\n\n System.Environment.Exit(0);\n }\n }\n}To run MQTest02 using your information, it would be:MQTest02.exe -h A1PATA00.WORLDSPAN.COM -p 1414 -m A1PATA00 -c ECACHE -q SPLASH.ECAC.2\n"}
+{"text": "### Human: I have used the below command to remove all queues in cluster in the queue managerecho \"ALTER QLOCAL(*) CLUSTER('') CLUSNL('')\" | runmqsc ${qmgr}.I have got the error as1 : ALTER QLOCAL(*) CLUSTER('') CLUSNL('')\nAMQ8147: WebSphere MQ object * not found.\nOne MQSC command read.\nNo commands have a syntax error.\nOne valid MQSC command could not be processed.My need is to remove all queues which are in cluster in the queue manager. Thanks in advance### Assistant: You can't use the wildcard character (*) when altering MQ Objects. Instead you have to specify the exact object you want to alter and that object has to exist. This is the reason your command fails (as it is looking for an object called*which does not exist.If you want to change multiple objects you have to either use a third party tool which supports this or you have to do it programmatically. If you opt to do it programmatically your program has to do the followingQuery your Queue Manager for the objects you want to alter. This could be done usingecho \"DISPLAY QLOCAL(*) CLUSTER()\" | runmqsc -e The above command should only display Queues in the specified cluster and the -e option will mean you won't see1 : DISPLAY QLOCAL(*) CLUSTER()in the output. However, if the command returns any objects you will get output similar to and you will get a return code of 0:5724-H72 (C) Copyright IBM Corp. 1994, 2016.\nStarting MQSC for queue manager ROB.\n\n\nAMQ8409: Display Queue details.\n QUEUE(LOCAL) TYPE(QLOCAL)\n CLUSTER()\nAMQ8409: Display Queue details.\n QUEUE(QL) TYPE(QLOCAL)\n CLUSTER()If the command fails to find any Queues however you will see the following error and you will get a return code of 0:5724-H72 (C) Copyright IBM Corp. 1994, 2015.\nStarting MQSC for queue manager QMROB.\n\n\nAMQ8147: WebSphere MQ object * not found.\nOne MQSC command read.\nNo commands have a syntax error.\nOne valid MQSC command could not be processed.So before you can pipe the Queue names back intorunmqscyou have to get the raw Queue namesTrim the output to remove everything except for the Q name. This can be done in a number of ways but i would personally use grep and sed . First we only want the lines that haveQUEUEon them so we use grep to remove everything except for the round brackets (and it's contents) after QUEUE. Then we use sed to remove the round brackets. You end up with something like this:grep -o -P \"(?<=QUEUE)(.+?)\" | sed -e 's/[(|)]//gIf we add that onto our previous command we get:echo \"DISPLAY QLOCAL(*) CLUSTER()\" | runmqsc -e | grep -o -P \"(?<=QUEUE)\\(.+?\\)\" | sed -e 's/[(|)]//gwhich gives us the output:LOCAL\nQLFinally we want to push this back intorunmqscto alter all of the Queues as needed, we can do this using xargs. We want to push it through xargs twice as the first one will make sure each Queue name goes through as an individual command which is executed by the second one:xargs -n 1 | xargs -I {} echo \"ALTER QUEUE({}) CLUSTER('') CLUSNL('')\" | runmqsc Putting the whole thing together should get you something like:echo \"DISPLAY QLOCAL(*) CLUSTER()\" | runmqsc -e | grep -o -P \"(?<=QUEUE)\\(.+?\\)\" | sed -e 's/[(|)]//g | xargs -n 1 | xargs -I {} echo \"ALTER QUEUE({}) CLUSTER('') CLUSNL('')\" | runmqsc Of course the above is just an example of how you could do it in one line, however it would be much better to do it via a shell script where you can add checks in between each step to make sure you're not about to do something to your Queues you don't want to.While testing as well you could use the-vflag onrunmqscas this will verify the commands without performing the actions - So you can see the output and runmqsc will tell you if there are any problems, without doing it immediately.\n"}
+{"text": "### Human: I have been trying to read and write messages to MQ from UFT. I am using the dotnet factory instance. i have reached till a point where i am able to connect to MQ while i am facing a problem in accessing the queue and read and write messages.The code is as follows.strQMgrName = \"queue manager name\"\nstrMQMDllPath = \"C:\\\\Program Files (x86)\\\\IBM\\WebSphere MQ\\\\bin\\\\amqmdnet.dll\"\nSet oMqEnvironment = DotNetFactory.CreateInstance(\"IBM.WMQ.MQEnvironment\",strMQMDllPath)\noMqEnvironment.Hostname = \"host name\"\noMqEnvironment.Port = \"port number\"\noMqEnvironment.Channel = \"channel name\"\n\n\nSet oMQC = DotNetFactory.CreateInstance(\"IBM.WMQ.MQC\",strMQMDllPath)\n' qmanager name,channel name, connection name\nSet oMqQMgr = DotNetFactory.CreateInstance(\"IBM.WMQ.MQQueueManager\",strMQMDllPath,strQMgrName)oMqQMgr.isConnected ' gives trueNow i wan to use the methodpublic MQQueue AccessQueue(string queueName, int openOptions)of the instance IBM.WMQ.MQQueueManager. can someone guide me in doing the same and let me know how i can push messages and read messages from the mentioned queueThank you### Assistant: After a lot of googling and reading IBM documentation , i was able to put and get messages in MQ from UFT. .. Below in the code snippet that worked for me .. Hope this helps some one .. I was working on PUT and GET separately, hence there might be some repetition in the code.Prerequisite for this.. You have to download MQ Client from IBM site and install it on PC where UFT is installed.. IBM MQ client is a freewareDim oMQEnvironment\n Dim oMQM\n Dim oMQC\n Dim oMQMessage\n Dim oMQQueue\n Dim intOpenOptions\n\n\n strMQMDLLPath = \"C:\\\\Program Files (x86)\\\\IBM\\WebSphere MQ\\\\bin\\\\amqmdnet.dll\"\n strHostName= \"Host Name\"\n intPort = \"Port Number\"\n strChannel =\"Channel Name\"\n strMessage =\"UFT Test Message\"\n strMQManager = \"Quemanager Name\"\n strMessageQueue = \"Queue Name\"' This part of the code is blatantly copied from one of the posts online. Will post the link once i find it again'for application(UFT) to connect to a queue manager in client modeSet oMQEnvironment = DotNetFactory.CreateInstance(\"IBM.WMQ.MQEnvironment\",strMQMDLLPath)\n\n 'Initize the Environment\n With oMQEnvironment\n .HostName = strHostName \n .Port = intPort\n .Channel = strChannel \n End with\n\n On Error Resume Next\n 'Create MQ Instatnces\n Set oMQM = DotnetFactory.CreateInstance(\"IBM.WMQ.MQQueueManager\",strMQMDLLPath)\n\n 'Check if MQM Connected\n If Err.Number <> 0 Then\n Reporter.ReportEvent micFail , \"Step: Creating MQM Object\" , \"Unable to Connect to MQ Manager at\" & strHostName\n 'Exit Test\n End If\n\n Set oMQC = DotnetFactory.CreateInstance(\"IBM.WMQ.MQC\",strMQMDLLPath)\n Set oMQMessage = DotnetFactory.CreateInstance(\"IBM.WMQ.MQMessage\",strMQMDLLPath)\n\n 'Declare Q open options\n intOpenOptions = oMQC.MQOO_OUTPUT or oMQC.MQOO_FAIL_IF_QUIESCING ' 16 + 8192\n\n 'Open the Q to post the messages\n If strRemoteMQManager = \"\" Then\n Set oMQQueue = oMQM.AccessQueue(strMessageQueue , intOpenOptions)\n Else \n Set oMQQueue = oMQM.AccessQueue(strMessageQueue , intOpenOptions ,strRemoteMQManager, \"\",\"\" )\n End If\n\n 'Format Message\n With oMQMessage\n .CharacterSet = 819\n .WriteString(strMessage)\n End with\n\n 'Post Message\n With oMQQueue\n .Put(oMQMessage)\n .Close()\n End WithNow for getting the message from MQDim oMQEnvironment\nDim oMQM\nDim oMQC\nDim oMQMessage\nDim oMQQueue\n\nstrMQMDLLPath = \"C:\\\\Program Files (x86)\\\\IBM\\WebSphere MQ\\\\bin\\\\amqmdnet.dll\"\nstrHostName= \"host name\"\nintPort = \"port number\"\nstrChannel =\"channel name\"\nstrMessage =\"UFT Test Message\"\nstrMessageQueue = \"message queue intended to access\"\nstrMQManager = \"mq manager name\"\nstrRemoteMQManager=\"\"\n\n'Create MQ Instances\nSet oMQC = DotnetFactory.CreateInstance(\"IBM.WMQ.MQC\",strMQMDLLPath)\n\n'set the properties of the Queue manager\nSet properties = DotNetFactory.CreateInstance(\"System.Collections.Hashtable\")\n properties.Add oMQC.HOST_NAME_PROPERTY, strHostName\n properties.Add oMQC.PORT_PROPERTY, intPort\n properties.Add oMQC.CHANNEL_PROPERTY, strChannel\n\n'access the queue manager \nSet oMQM = DotnetFactory.CreateInstance(\"IBM.WMQ.MQQueueManager\",strMQMDLLPath,strMQManager,properties)\n\n'here We are trying to browse the message one by one and keep the messages on the queue.\n\n'Declare Q open options\nSet oMQQueue = oMQM.AccessQueue(strMessageQueue,oMQC.MQOO_BROWSE)\nSet oMQGetMessageOptions = DotNetFactory.CreateInstance(\"IBM.WMQ.MQGetMessageOptions\",strMQMDLLPath) \noMQGetMessageOptions.Options = oMQC.MQGMO_BROWSE_FIRST\n\nSet oMQMessage = DotnetFactory.CreateInstance(\"IBM.WMQ.MQMessage\",strMQMDLLPath)\n\n oMQQueue.Get oMQMessage,oMQGetMessageOptions\n\nSet mqGetNextMsgOpts = DotNetFactory.CreateInstance(\"IBM.WMQ.MQGetMessageOptions\",strMQMDLLPath) \nmqGetNextMsgOpts.Options = oMQC.MQGMO_BROWSE_NEXT\n\nbrowseMessages = true\n\nDo while browseMessages\n on error resume next\n messageText = oMQMessage.ReadString(oMQMessage.MessageLength)\n 'Print messageText\n Set oMQMessage = DotnetFactory.CreateInstance(\"IBM.WMQ.MQMessage\",strMQMDLLPath)\n oMQQueue.Get oMQMessage,mqGetNextMsgOpts\n if Err.Number <> 0 then browseMessages =false \n 'Clear both MsgID and CorrelID for next use.\n oMQMessage.MessageId = oMQC.MQMI_NONE\n oMQMessage.CorrelationId = oMQC.MQCI_NONE \nLoop \n\n'Cleanup\nSet oMQQueue = Nothing \nSet oMQMessage= Nothing \nSet oMQOpenOptions= Nothing \nSet oMQM= Nothing \nSet oMQEnvironment = Nothing\n"}
+{"text": "### Human: I am using Websphere mq v 7.5. When I try to send message to Queue, I get following error :JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED')\n Provided Username and password are wrong.I don't have any credentials to provide as it doesn't ask at time of installation. My camel-context configuration is given below:\n \n \n\n \n \n \n \n \n \n ### Assistant: The 2035 error you received will have more information to explain it in the queue manager error log. The fact that the JMS error message mentions a user ID and password is misleading, it could be one of a number of security failures, not necessarily that one, I suspect you are being caught by a default security rule (CHLAUTH rule) that bans the use of SYSTEM channels.Look in your queue managerAMQERR01.LOGand then read the following post for more help on how to deal with a failure caused by a CHLAUTH rule.I'm being blocked by CHLAUTH - how can I work out why?\n"}
+{"text": "### Human: I am working on below configuration for messaging using Spring and Webphere MQ.I have a requirement of implementing retrying logic for a scenario, where I receive a message from the queue and put the message data on to a Elastic search server (search server is non transactional), if the search server is down I have to rollback the message on to the queue again and process the message after some interval of time(for example: 30 seconds) . this retry has to be done for 5 times. after 5 times the message has to be put on a Dead letter queue .we are using Tomcat as the server.we are using spring integration jms:message-driven-channel-adapter for message receivingHow can I implement this behavior with spring and Websphere MQ?I have crawled across many sites, and I could find support for Active MQ but not for IBM MQ.\n \n ${queue_hostname}\n \n \n ${queue_port}\n \n \n ${queue_manager}\n \n \n 1\n \n \n\n \n \n \n \n \n \n false\n \n \n\n \n \n \n\n \n \n \n \n \n \n \n \n \n false\n \n \n 20000\n \n ### Assistant: There is nothing in the JMS spec about delayed redeliveries. Some brokers have a custom mechanism/policy to implement it; you'll have to look at the broker documentation.As has been said before, you can use the delivery count header to give up after some number of retries.EDITIn response to your comment below...Only if you are using a version of MQ that supports JMS 2.0 - it looks like you are using a very old version requiringJmsTemplate102. 1.0.2 is ancient; 1.1 has been out for years; Spring has supported JMS 2.0 for a nearly 3 years. If you have a JMS 2.0 broker (and client library), set thedeliveryDelay on a JmsTemplate bean. Then, configure the outbound channel adapter to use that template via thejms-templateproperty.In order to get visibility to the redelivery count, either pass the whole message into your service or, with a POJO method, configure it to get that header...public MyReply process(@Payload MyObject foo,\n @Header(\"JMSXRedeliveryCount\") int redeliveryCOunt) {\n ...\n}Again, this is a JMS 2.0 feature (the header) although some brokers provide it in 1.1.\n"}
+{"text": "### Human: We have a scenario where we want a node.js app to consume messages from a backend system that currently puts messages to an Websphere MQ queue (through SAP PI).In MQ 8.0.0.3, there is a beta of AMQP support.https://www.ibm.com/developerworks/community/blogs/messaging/entry/mq_support_for_mq_light_beta_now_available?lang=enHowever, I can't find a conclusive answer to how I get assured delivery. The perfect solution would be for the node.js app to register its subscription as durable, but how do I do that? We'll change the queue that SAP PI uses to an alias queue pointing to a topic. Using the mqlight client in node.js, version 1.0### Assistant: You can achieve assured delivery between MQ applications and Node.js applications using the MQ Light library. MQ Light supports at-least-once messaging (not exactly-once) so you will have to bear this in mind when you design your solution. It will have to handle receiving duplicate messages.It sounds like you might have read thearticle on how to bridge MQ to MQ Lightwhich explains some of the MQ queue-to-topic options.In order to cope with the Node.js application being offline when messages are put by the SAP application, you can create a durable destination when you issue the MQ Light subscribe call. For example:// Destination and its messages expire 24 hours after Node.js client disconnects\nvar options = { qos: mqlight.QOS_AT_LEAST_ONCE, autoConfirm: false, ttl: (60 * 60 * 24 * 1000)};\n\nclient.subscribe(pattern, share, options, function(err, pattern) {\n if (err) {\n console.error('Problem with subscribe request: %s', err.message);\n process.exit(1);\n }\n\n if (pattern) {\n if (share) {\n console.log('Subscribed to share: %s, pattern: %s', share, pattern);\n } else {\n console.log('Subscribed to pattern: %s', pattern);\n }\n }\n});You'll need to make sure that the messages your SAP application puts do not have an expiry time (i.e. they setMQEI_UNLIMITED). Otherwise they could expire from the destination before the Node.js app has had a chance to consume it.Secondly note how I've usedautoConfirm: falsein the above example. That means that if the Node.js application gets a message from its destination, the message will not be deleted from the destination until you explicitly callmessage.confirmDelivery()in your MQ Light app. That allows you to make sure the message has been processed completely in the Node.js app (you've written it to a file, or to a database, or done whatever you need to do with it) before removing it from MQ.As you say, the MQ Light feature in MQ is still in beta and is not currently supported by IBM. However there is a statement of direction to say that it will be a supported feature in the future.\n"}
+{"text": "### Human: MQ FTE docs thatAn example use of this exit point is to perform some completion tasks,\n such as sending an e-mail or a WebSphere MQ message to flag that the\n transfer has completed.However how this message sending can be done? My understanding is that FTE will simpy put my exit jar into their classpath and then just call appropriate method when transfer finished.How can I aquire connection to the QM then? Do I need to do some magic, and on first call create connection to the MQ?We have very simple use case. We want FTE to put notification message into queue when transfer finished. We are initiating transfer by putting XML command queue, so we can usereplyqueue element. However doc states that it uses dynamic temporary queue, but it is not what we need. So we need this exit logic then...Or maybe do you have other idea how to achieve mentioned use case?Many thanksPawel### Assistant: How can I acquire connection to the QM then?TheMQCONNXcall tends to work best if using the Java API. AConnectionFactoryif using JMS classes.Do I need to do some magic...Although the MQ functionality appears to be magic, it is actually just highly advanced technology....and on first call create connection to the MQ?Define \"first.\" First call from FTE? No. The exit loses the connection context between calls. First call to MQ from within the exit? Sure.When the exit receives control from FTE, just connect to MQ, open the desired queue, andPUTthe notification message. The exit has access to the FTE job fields, including the name/value pairs from the job definition. You will need to pass it the destination queue name in the job definition if that value is variable from call to call.\n"}
+{"text": "### Human: I am trying to put a message into Websphere MQ queue from an Orchestration which is deployed on Cast Iron Live. I have used secure connector since the orchestation is deployed on Cast Iron. When I am trying to execute the flow, it fails and the message is not placed in MQ queue. The below are the errors:Error while trying to call remote operation execute on Secure Connector for activity\ncom.approuter.module.mq.activity.MqPut and Secure Connector LocalSecureConnector, \nerror is Unable to put message on queue null. MQ returned error code 2538.\n\nUnable to put message on queue null. MQ returned error code 2538.\nFault Name : Mq.Put.OperationActivityId : 163\nMessage: Unable to put message on queue null. MQ returned error code 2538.\nActivity Name:Put MessageFault Time: 2015-07-15T05:40:29.711ZCan someone please help me resolve this. Please let me know if any further details are required.Here are the details:Cast Iron flow is deployed on Cast Iron Cloud i.e Cast Iron LiveMQ is running on-premiseThe port I am trying to connect is 1414.Have a secure connector running on the machine where MQ is installed.MQ version is 8.In Cast Iron flow, I am using an MQ connector, by giving the hostname where MQ is running, port: 1414, Channel Name : SYSTEM.DEF.SVRCONN and username as mqm. Tired using my log on username, by adding it to mqm group. But this also dosent seem to work.### Assistant: The return code is instructive:2538 0x000009ea MQRC_HOST_NOT_AVAILABLEThis indicates that Cast Iron is attempting to contact MQ using a client connection and not finding a listener at the host/port that it is using.There are a couple of possibilities here but not enough info to say which it might be. I'll explain and provide some diagnostics you can try.The 2538 indicates an attempt to contact the QMgr has failed. This might be that, for example, the QMgr isn't listening on the configured port (1414) or that the MQ listener is not running.The error code says the queue name is \"null\". The question doesn't specify which queue name the connector is configured with but presumably it's been configured withsomequeue name. This error code suggests the Secure Connector on the MQ server side doesn't have its configuration installed.The Cast Iron docs advise connecting with an ID in themqmgroup but do not mention that on any MQ version 7.1 or higher this is guaranteed to fail unless special provisions are made to allow the admin connection. It may be that it's actually failing for an authorization error and the connector not reporting the correct error.If it is as simple as the listener not running, that's easy enough to fix. Just start it and make sure it's on 1414 as expected.Next, ensure that the Secure Connector has the configuration that was created using the Cast Iron admin panel. You need to understand why the error code says the queue name is null.Now enable Authorization Events and Channel Events in the QMgr and try to connect again. The connector on the MQ server should connect when started and if successful you can see this by looking at the MQ channel status. However, if unsuccessful, you can tell by looking at the event messages or the MQ error logs. Both of these will show authorization failures and connection attempts, if the connection has made it that far.The reason I'm expecting 2035 Authorization Error failures is that any QMgr from v7.1 and up will by default allow an administrative connection on any channel. This is configured in the default set ofCHLAUTHrules. The intent is that the MQ admin would have to explicitly provision admin access by adding one or more newCHLAUTHrules.For reasons of securitySYSTEM.DEF.*andSYSTEM.AUTO.*channels shouldneverbe used for legitimate connections. The Best Practice is to define a newSVRCONN, for example one namedCAST.IRON.SVRCONNand then define a CHLAUTH rule to allow the administrative connection.For example:DEFINE CHL(CAST.IRON.SVRCONN) CHLTYPE(SVRCONN) TRPTYPE(TCP) REPLACE\nSET CHLAUTH('CAST.IRON.SVRCONN') TYPE(ADDRESSMAP) +\n ADDRESS('127.0.0.1') +\n USERSRC(MAP) MCAUSER('mqm') +\n ACTION(REPLACE) \nSET CHLAUTH('CAST.IRON.SVRCONN') TYPE(BLOCKUSER) +\n USERLIST('*NOBODY') +\n WARN(NO) ACTION(REPLACE)The first statement defines the new channel.The next one allows the connections from127.0.0.1which is where the Secure Connector lives.(Presumably you installed the internal Secure Connection on the same server as MQ, yes?)Ideally the connector would use TLS on the channel and instead of IP filtering theCHLAUTHrule would filter based on the certificate Distinguished Name. This rule is not nearly so slective and allows anyone on the local host to be an MQ administrator by using this channel.The last statement overrides the defaultCHLAUTHrule which blocks*MQADMINwith a new rule that blocks*NOBODYbut just for that channel.\n"}
+{"text": "### Human: I'm trying to figure out under what conditions I would want to implement a remote queue versus a local one for 2 endpoint applications.Consider this scenario: AppAon ServerAneeds to send messages to AppBon ServerBvia MQServer1.It seems like the simplest configuration would be to create a single local queue on MQServer1 and configure AppA to put messages to the local queue while configuring AppB to get messages from the same local queue. Both AppA and AppB would connect to the same Queue Manager but execute different commands.What sort of circumstances would require the need to install another MQ server (e.g. MQServer2) and configure a remote queue on MQServer1 which instead sends the messages from AppA over a channel to a local queue on MQServer2 to be consumed by AppB?I believe I understand the benefit of remote queuing but I'm not sure when it's best used over a more simpler design.### Assistant: Here are some problems with what you call the simpler design that you don't have with remote queuing:-Time Independance- Server1 has to be available all the time, whereas with a remote queue, once the messages have been moved to Server B, Server A and Server 1 don't need to be online when App B wants to get its messages.Network Efficiency- with two client applications putting or getting from a central queue, you have two inefficient network hops, instead of one efficient channel batched network connection from Server A to Server B (no need for Server 1 in the middle)Network Problems- No network, no messages. Whereas when they are stored locally, any that have already arrived can be processed even while the network is down. Likewise, the application putting messages is also not held up by a network problem, the messages sit on the transmit queue easy to be moved, and the application can get on with the next thing.Of course your applications should be written so that they aren't even aware of the difference, and it's just configuration changes that switch you from one design to the other.\n"}
+{"text": "### Human: I've created a Queue manager calledQM_MQ_TESTcrtmqm QM_MQ_TEST\nstrmqm QM_MQ_TEST\nrunmqsc QM_MQ_TEST\n\nDEFINE CHANNEL(QM_MQ_TEST) CHLTYPE(SVRCONN)\n\ndefine listener(TCP.LISTENER) trptype(tcp) control(qmgr) port(1414)\n\nALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) CHCKCLNT(NONE)\n\nSET CHLAUTH(QM_MQ_TEST_SVRCONN) TYPE(ADDRESSMAP) ADDRESS(*) USERSRC(CHANNEL)\nSET CHLAUTH(QM_MQ_TEST_SVRCONN) TYPE(BLOCKUSER) USERLIST('nobody')Still I could see below error in QM logs.06/11/2015 12:19:26 PM - Process(10886.618) User(mqm) Program(amqzlaa0)\n Host(abcd.com) Installation(Installation1)\n VRMF(8.0.0.2) QMgr(QM_MQ_TEST)\n\nAMQ8077: Entity 'oracle' has insufficient authority to access object\n'QM_MQ_TEST'.\n\nEXPLANATION:\nThe specified entity is not authorized to access the required object. The\nfollowing requested permissions are unauthorized: connect\nACTION:\nEnsure that the correct level of authority has been set for this entity against\nthe required object, or ensure that the entity is a member of a privileged\ngroup.\n----- amqzfubx.c : 670 --------------------------------------------------------\n06/11/2015 12:19:26 PM - Process(11046.643) User(mqm) Program(amqrmppa)\n Host(abcd.com) Installation(Installation1)\n VRMF(8.0.0.2) QMgr(QM_MQ_TEST)\n\nAMQ9557: Queue Manager User ID initialization failed for 'oracle'.\n\nEXPLANATION:\nThe call to initialize the User ID 'oracle' failed with CompCode 2 and Reason\n2035.\nACTION:\nCorrect the error and try again.### Assistant: There are two problems evident.DEFINE CHANNEL(QM_MQ_TEST) CHLTYPE(SVRCONN)\nSET CHLAUTH(QM_MQ_TEST_SVRCONN) TYPE(ADDRESSMAP) ADDRESS(*) USERSRC(CHANNEL)\nSET CHLAUTH(QM_MQ_TEST_SVRCONN) TYPE(BLOCKUSER) USERLIST('nobody')\n ^^^^^^^^Notice how the name of the defined channel doesn't match the profile names in the CHLAUTH rules? These rules cannot possibly apply to the channel that was defined.The second problem is that the user IDoraclehas no authority to connect to the QMgr. Generally you want to grant+connect +inqon the QMgr itself, then grant+put +get +browse +inqon the queues. If you want to be more precise, grant+put +inqon one queue and+get +browse +inqon the other.Note that you always have to grant+inqfor Java or JMS applications because IBM's classes make inquiries on the objects to which they connect or open. For example, on connecting to MQ they inquire as to the version and if a DLQ is specified. On connecting to a queue they look for things likeMAXMSGLandBOQNAME.So you may or may not need+inqdepending on what the application is written in and how it is coded. You may also need other permissions such as+passid. The best way to work through the required permissions is to installSupportPac MS0Pinto MQ Explorer, then enable Authorization Events. If another authorization error occurs, the event message will tell you the object against which the call failed, the ID requesting access, the API call being made at the time, and the exact options specified for the call. All of this will be in human-readable language and accessible through MQ Explorer so you don't have to go hunt down error log entries each time.Finally, since IBM's docs and much of the casual advice you get on the Internet gets it wrong, make sure you understand what happens when you authorize a Principal versus a Group.On all versions of MQ prior to v8.0, and by default in v8.0, when you run asetmqautorSET AUTHRECagainst a principal, MQ goes out and looks up the primary group for that ID and substitutes that in the permission grant. When the ID's primary group is not what was expected, this can lead to unexpected authorization of large populations of accounts. As a rule, grant authorizations on groups instead of principals.There are two narrow exceptions to this. The first is that in MQ v8.0 it is possible to configure MQ to authorize directly against principals. The problem with this is that a script full of authorization grants on principals will succeed without warnings regardless of whether that configuration setting has been made. The only way to know it worked is to dump the resulting authorization records and reconcile against the original script. If you are not prepared to do this, avoid granting auths by principal on non-Windows platforms.Windows has always been an exception because MQ records the authorization grant against a Windows Security ID or \"SID\" and the SID for an account is functionally equivalent to one for a group. The problem comes in if the ID used in the authorization grant is unqualified.For example, on a Windows QMgr if I were to execute this command...SET AUTHREC OBJTYPE(QMGR) PRINCIPAL('oracle') AUTHADD(CONNECT)...then Windows would attempt to resolve the accountoraclefirst against the local SAM database, then against the domain controllers it knows about in whatever search order they happen to be in at the moment.So assume the ID is defined on the last of 5 domain controllers that Windows searches and that someone creates a new account calledoracleon one of the DCs earlier in the search chain. TheMCAUSER(oracle)in the channel will resolve to a different account with a different SID. The connection will fail with an error thatEntity 'oracle' has insufficient authority to access object 'QM_MQ_TEST'despite your being able to display auiths records in which \"oracle\" is clearly granted access.So if you ever do decide to grant access on the Principal instead of the Group, make sure that the v8.0 QMgr is set to honor that, or on Windows that you specifyoracle@[host name here]for a local account ororacle@[domain name here]for a domain account both in the authorization command and in theMCAUSER.\n"}
+{"text": "### Human: I'm new in IBM MQ. Using the following code I can easily put a message in a queue and get that message.public void QueuePut()\n{\n queue = queueManager.AccessQueue(\"Q1\", MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);\n MQMessage message = new MQMessage();\n message.WriteString(\"stackoverflow\");\n\n MQPutMessageOptions putMessageOptions = new MQPutMessageOptions(); \n putMessageOptions.Options += MQC.MQPMO_ASYNC_RESPONSE;\n\n queue.Put(message, putMessageOptions);\n}\n\n\npublic void QueueGet()\n{\n\n queue = queueManager.AccessQueue(\"Q2\", MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);\n MQMessage gotMessage = new MQMessage();\n\n queue.Get(gotMessage);\n\n string str = message.ReadString(gotMessage.MessageLength);\n}You can easily see I'm writing a message to 'Q1' and reading it from 'Q2' since Q1 isalias queueNow, the thing I want is to get information about the message that I got in the QueueGet function. What I want to know is that gotMessage comes from 'Q1' even If I'm reading it in 'Q2'.### Assistant: TheBaseQueueNamewill point to the real queue an alias queue refers to. In this case the queue being opened to get queues is the real queue itself. HenceBaseQueueNamewill not point to anything.It's not right to useMQC.MQCA_BASE_Q_NAMEwhile opening a queue as it's not a queue open option. All queue open options begin withMQOO_.You can use PCF classes to query an alias queue and find it's base queue name. But at the moment I am unaware if there is a way to find the alias(es) of a base queue.Edit:Alias queueis not really a queue like theLocal queue. As the name suggests, it's another name for a local queue. It will not hold any messages. When an application opens an Alias queue, the queue manager resolves it to actual queue.Aliasing helps1) To hide queue/topic it is pointing to. This way applications are unaffected by any change to queue/topic.2) Provide different level of authority to applications. One application can put but not get while another application can get but not put to the same queue.\n"}
+{"text": "### Human: I have a JMSReceiver class which is listening on a MQ Queue. This class implements the MessageListener interface. I wish to implement the logic to retry a message for specified number of times by getting the message to rollback. To do so I have to catch the business exception and wrap it in a RuntimeException so that message gets rolled back to the MQ and gets replayed. i wish to implement this in better way.Current Implementationclass JMSReceiver implements MessageListener{\npublic void onMessage(Message msg){\n logger.info(\"**********Message received in consumer\");\n try {\n //Do some business which throws a business exception\n } catch (Exception e) {\n try {\n logger.info(\"####Redelivery count\"+msg.getIntProperty(\"JMSXDeliveryCount\"));\n if(msg.getIntProperty(\"JMSXDeliveryCount\")<10){\n logger.info(\"####MQ ISSUE: Redelivery attempted for message. Redelivery attempt: \"+msg.getIntProperty(\"JMSXDeliveryCount\"));\n throw new RuntimeException(\"Redelivery Attempted\"+e.getMessage()); \n }else{\n logger.info(\"####MQ ISSUE: Redelivery attempts exhausted for message\");\n }\n } catch (JMSException e1) { \n e1.printStackTrace();\n logger.info(\"####MQ ISSUE: Exception occured while getting JMSXDeliveryCount\");\n }\n }\n }ExpectedThe above implementation works. It rollsback the message to MQ and the redelivery count increases. I even tried doing session.rollback() but when I do that the redelivery count does not increase and I can replay the message. Please advise a better way to implement this ?### Assistant: You can create JMS session with CLIENT_ACKNOWLEDGE as message acknowledge mode. And then in the onMessage() method, do not call msg.Acknowledge(). Not calling msg.Acknowledge() will ensure the same is delivered again.session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);Note that calling Acknowledge() on one message will acknowledge all messages received since the last time the method was called.UpdateSession creationconnection = cf.createConnection(\"user\",\"password\");\n System.out.println(\"Connection created.\");\n session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);\n System.out.println(\"Session created.\");OnMessage() method - Message is being acknowledged on 6th attempt.consumer.setMessageListener(new MessageListener() {\n public void onMessage(Message msg) {\n try {\n // Display the message that just arrived\n System.out.println(msg);\n\n if(msg.getIntProperty(\"JMSXDeliveryCount\") > 5){\n msg.acknowledge();\n }\n } // end try\n catch (Exception e) {\n System.out.println(\"Exception caught in onMessage():\\n\" + e);\n }\n return;\n } // end onMessage()\n }); // end setMessageListener\n"}
+{"text": "### Human: I have followed all the steps very closely to create key store, client certificate, servercertificate using with the help of below videos :**\"Configuring WMQ Explorer for TLS (Part1, Part2, Part3, Part4) as below\".**\nPart 1: WMQ Explorer TLS 1 of 4: Create the QMgr's KDB and certificate**\nPart 2: WMQ Explorer TLS 2 of 4: Create the user's JKS and certificate\nPart 3: WMQ Explorer TLS 3 of 4: Configure WMQ Explorer preferences\nPart 4: WMQ Explorer TLS 4 of 4: ConnectingNow, I am trying to connect from IBM Websphere MQ Client (V7.5.0.3) to the IBM WebSphere MQServer (V7.5.0.2)server queue manager using SSL.From the IBM WebSphere MQ Explorer (Client Side) : \n\na) Provided the Queue Manager Name : jmsdemo\nb) Selected the radio-button \"Connect directly\"\nc) Hostname or IP Address : Server IP\nd) Port number : Server Port of the Queue Manager that i am trying to connect.\ne) Server-connection channel : Server Connection Channel \n (This server connection channel has below parameters\n MCA --> MUSR_MQADMIN\n SSL --> SSL Cipher Spec : \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\n SSL Authentication : Required\n\nf) After finishing all the steps, when i press the \"Finish\" Button. I am getting the below \nerrors.\n\nPlease let me know if i missing/doing something wrong in-order to connect to SSL?References :a) Below error in the UI (IBM WebSphere MQ Explorer client side) :Queue manager jmsdemo is not available for client connection due to an SSL configuration error.(AMQ4199) Queue manager jmsdemo is not available for client connection due to an SSLconfiguration error. (AMQ4199) Severity: 30 (Severe Error)\n Explanation: The user is trying to connect to a remote queue manager using a secure connection.\n Response: Check the SSL configuration of the target queue manager and the local SSL trust store.b) Below error information is extracted \"AMQERR01\" error file (from Server Side)https://docs.google.com/document/d/19b-N4qc0zXw4HiwZv5pmmeixqeClDDHgWpylalkHhqY/edit#Thanks \nJK### Assistant: This errorAMQ9660: SSL key repository: password stash file absent or unusableis likely to be caused by corrupt stash file. A stash file contains the password for the key repository. I suggest you try the following steps:1) Go to folder where the queue manager's key repository (the .kdb file) is located.2) Locate the stash (.sth) file of the key repository and delete it.3) Then open the .kdb file in \"IBM Key Management Tool\" with the current password.4) Once kdb file is opened, click on \"Key Database File -> Stash Password\" menu. This will create the stash file again.5) (May be required): Then do aREFRESH SECURITY TYPE(SSL)for the queue manager inrunmqsc.Then attempt to connect.\n"}
+{"text": "### Human: I am trying to connect to a MQ server queue via a .NET client. I need to use the certificate for secured communication. Here is the code that I have:MQEnvironment.SSLKeyRepository = \"*SYSTEM\";\nMQEnvironment.ConnectionName = connectionName;\nMQEnvironment.Channel = channelName;\nMQEnvironment.properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);\nMQEnvironment.SSLCipherSpec = \"TLS_RSA_WITH_AES_256_CBC_SHA\"; \n\nqueueManager = new MQQueueManager(queueManagerName, channelName, connectionName);\n\nqueue = queueManager.AccessQueue(SendQueueName,MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);\nqueueMessage = new MQMessage();\nqueueMessage.WriteString(message);\nqueueMessage.Format = MQC.MQFMT_STRING;\nqueue.Put(queueMessage, new MQPutMessageOptions());Every time I try to put the message on the queue, I get this error messageReason Code: 2059\nMQexp.Message: MQRC_Q_MGR_NOT_AVAILABLEI have checked my variables for the queue manager name, queue name etc and they are correct. \nI was also able to connect to a different queue without SSL, I believe that my code is not furnishing enough information to establish a successful connection.Any help on this would be appreciated.Thanks,\nKunal### Assistant: I had the same problem and error message. After enabling tracing I was able to isolate the problem. \nI always wondered, how the client is selecting the correct client certificate from the store. The trace output revealed following:000001B2 15:53:46.828145 20776.10 Created an instance of SSLStreams\n000001B3 15:53:46.828145 20776.10 Setting current certificate store as 'Computer'\n000001B4 15:53:46.828145 20776.10 Created store object to access certificates\n000001B5 15:53:46.834145 20776.10 Opened store\n000001B6 15:53:46.834145 20776.10 Accessing certificate - ibmwebspheremqmyusername\n000001B7 15:53:46.835145 20776.10 TLS12 supported - True\n000001B8 15:53:46.837145 20776.10 Setting SslProtol as Tls\n000001B9 15:53:46.837145 20776.10 Starting SSL AuthenticationIn my case, I had to set thefriendly name of the client certificateto ibmwebspheremqmyusername(replace \"myusername\" with your userid) and set the label in the code aswell:properties.Add(MQC.MQCA_CERT_LABEL, \"ibmwebspheremqmyusername\");To enable tracing, add following to your app.config/web.config where the path points to a location that contains a file namedmqtrace.config:\n \nSample content of mqtrace.config (specified directories must exist in advance):\n\n 2\n C:\\MQTRACEPATH\n C:\\MQERRORLOGPATH\nHere are some links for more detail:Tracing:https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q123550_.htmWhy label:http://www-01.ibm.com/support/docview.wss?uid=swg21245474\n"}
+{"text": "### Human: We need to issue some MQ commands from a MB flow.\nThe way to go is to send a PCF command, but I dont know how to create it.\nAny pointers ?\nSebastian.### Assistant: To issue commands to an MQ Queue Manager via PCF messages you can look at the examples in /opt/mqm/samp/pcf/samples on *nix or where ever you have installed MQ. (On Windows try \"C:\\Program Files (x86)\\IBM\\WebSphere MQ\\tools\\pcf\\samples\").To issue the commands 'from' broker you can use a Java compute node and use methods in the supplied Java package com.ibm.mq, for example sending a query to find out what queues are defined on a queue manager:import com.ibm.mq.headers.pcf.PCFMessageAgent;\nimport com.ibm.mq.headers.pcf.PCFMessage;\nimport com.ibm.mq.constants.MQConstants;\n\ntry\n{\n // local queue manager\n String queueManager = \"QMGR_broker\"; // local queue manager name \n PCFMessageAgent agent = new PCFMessageAgent(queueManager);\n\n // remote queue manager\n String host = \"localhost\"; // host name of the queue manager machine\n int port = 1414; // default queue manager tcp listener port\n String channel = \"SYSTEM.DEF.SVRCONN\";//Default channel\n PCFMessageAgent agent = new PCFMessageAgent(host, port, channel);\n\n // Create the PCF message type for the inquire.\n PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_Q_NAMES);\n // Queue name = wildcard.\n pcfCmd.addParameter(MQConstants.MQCA_Q_NAME, \"*\");\n // Queue type = ALL.\n pcfCmd.addParameter(MQConstants.MQIA_Q_TYPE, MQConstants.MQQT_ALL);\n\n // Execute the command. The returned object is an array of PCF messages.\n PCFMessage[] pcfResponse = pcfCM.agent.send(pcfCmd);\n\n // e.g. extract the queue names from the response object\n String[] names = (String[])pcfResponse[0].getParameterValue(MQConstants.MQCACF_Q_NAMES);\n}Alternatively you can put the PCF messages on the MQ queue (SYSTEM.ADMIN.COMMAND.QUEUE if you're on anything but z/OS) that the queue manager is listening for events on. You will then also need to define a 'reply to' queue in your message. You can do this from broker with an MQOutput node.However that means you need to know theexact format of the PCF messagethat you want to send and what it's reply will look like, I think it is much easier to use the provided Java examples to do the message processing and formatting for you.\n"}
+{"text": "### Human: I have installed a trial version of MQ and now im trying to create a queue manager.\nRunning the command crtmqm givescrtmqm -q QManager\nbash: crtmqm: command not found### Assistant: It's most likely the case that your path isn't set up correctly.Find out where thecrtmqmis located (such as withfind / -name crtmqm) and add that directory to your path (in your favorite startup file, like.profileor.bash_profile).Youmayalso then need to open up a new session (or even log in again), depending on which startup file was changed.\n"}
+{"text": "### Human: How would I set up MQ so that every message received is immediately written to file system? \nI have the \"redbooks\", but at least need someone at least point me to a chapter or heading in the book to figure it out.We are a .NET shop. I have written C# via API to read the queue, and we currently use BizTalk MQ adapter. Our ultimate goal is to write same message to multiple directories in file system to \"clone\" the feed for our various test environments (DEV, STAGE, TRAINING, etc..). The problem with BizTalk is that when we consume the message, we map it at the same time to a new message, so the message is already changed, and we want the original raw message to be cloned, not the morphed one. Our vendors don't offer multiple copies of the feed, for example, they offer DEV and PROD, but we have 4 systems internally.I suppose I could do a C# Windows Service to do it, but I would rather use built-in features of MQ if possible.### Assistant: There is no configuration required. If the message is persistent, WMQ writes it to disk. However, I don't think that's going to help you because they are not written as discrete messages. There's no disk file to copy and replication only works if the replicated QMgr is identical to the primary and is offline during the replication.There are a number of solutions to this problem but as of WMQ V7, the easiest one is to use the built-in Pub/Sub functionality. This assumes that the messages are arriving over a QMgr-to-QMgr channel and landing on a queue where you then consume them.In that case, it is possible to delete the queue and create an alias of the same name over a topic. You then create a new queue and define an administrative subscription that delivers messages on the topic into the new queue. Your app consumes from the new queue.When you need to send a feed to another QMgr or application, define a new subscription and point it at the new destination queue. Since this is Pub/Sub, MQ will replicate the original message as many times as there are subscriptions and the first application and its messages are not affected. If the destination you need to send to isn't accessible over MQ channels (perhaps DEV and QA are not connected, for example), you can deliver the messages to the new queue, use QLoad fromSupportPac MO03to write them to a file and then use another instance of QLoad to load them onto a different QMgr. If you wanted to move them in real time, you could set up the Q program fromSupportPac MA01to move them direct from the new subscription queue on QMgr1 to the destination queue on QMgr2. And you can replicate across as many systems as you need.The SupportPacs main page ishere.If all you are using is the Redbooks, you might want to have a look at the Infocenters. Be sure to use the Infocenter matching the version of WMQ you are using.WMQ V7.0 InfocenterWMQ V7.1 InfocenterWMQ V7.5 Infocenter\n"}
+{"text": "### Human: I see the following error message in AMQERR01.LOG on the mq server printed repeatedlyAMQ9209: Connection to host 'client-host (...)' for channel\n'TEST_CHANNEL' closed.\n\nEXPLANATION:\nAn error occurred receiving data from 'client-host (...)' over\nTCP/IP. The connection to the remote host has unexpectedly terminated.\n\nThe channel name is 'TEST_CHANNEL'; in some cases it cannot be determined and\nso is shown as '????'.followed by:AMQ9999: Channel 'TEST_CHANNEL' to host 'client-host (...)' ended\nabnormally.\n\nEXPLANATION:\nThe channel program running under process ID 5022 for channel 'TEST_CHANNEL'\nended abnormally. The host name is 'client-host (...)'; in some\ncases the host name cannot be determined and so is shown as '????'.In the Action of the second message it says \"Note that this message can be excluded\ncompletely or suppressed by tuning the \"ExcludeMessage\" or \"SuppressMessage\"\"Why does this occur? Is this normal to have these errors and can these be suppressed as suggested?### Assistant: The message usually indicates that an application has terminated without first closing the channel. Occasionally it indicates that a firewall or other stateful network inspection has terminated the socket after a period of inactivity.The correct answer in the first case is to change the applications to properly manage connections. In the second case, upgrading to the latest client and server and using the new client channel tuning can prevent network timeouts on idle channels.The ability to suppress specific error messages is for those who are unable to address the root causes of these problems. As long as you aren't losing MQ messages, suppressing these errors increases the signal-to-noise ratio in the error logs. However, this is only considered a temporary measure and if you need to debug something you may need to re-enable the suppressed errors.\n"}
+{"text": "### Human: I am trying to recevie logically grouped messages from an remote MQ using .Net client using native api [amqmdnet - WebSphere MQ Classes for .NET], which was put by java client using native api.While we are getting the logically grouped messages we are seeing some header information in all the messages in that group which will be showing differently in each editors, [notepad++, editplus etc.]The below specified header information's is appended in every logical message in that group something like \"MDE \"We are using thegetmessageoptions,openoptionsas below,mintMQQueueOpenOptions = IBM.WMQ.MQC.MQOO_INPUT_SHARED + IBM.WMQ.MQC.MQOO_FAIL_IF_QUIESCING\nmobjMQGetMessageOptions = New MQGetMessageOptions\nmobjMQGetMessageOptions.Options = IBM.WMQ.MQC.MQGMO_NO_SYNCPOINT + IBM.WMQ.MQC.MQGMO_FAIL_IF_QUIESCING\n'mobjMQGetMessageOptions.Options = mobjMQGetMessageOptions.Options + MQC.MQGMO_LOGICAL_ORDER 'Or MQC.MQGMO_ALL_MSGS_AVAILABLECode snippet to read the all the logical message in that group,'=================================\n ' INTANTIATE THE MQ MESSAGE OBJECT\n objMQMessage = New MQMessage\n objMQMessage.Format = MQC.MQFMT_STRING\n '=================================\n ' CLEAR THE MESSAGE VARIABLE\n strMQMessage = \"\"\n\n Do\n '============================\n ' GET THE MESSAGE FROM THE MQ\n mobjMQQueue.Get(objMQMessage, mobjMQGetMessageOptions)\n\n '============================\n ' READ THROUGH THE MESSAGE\n strMQMessage += objMQMessage.ReadString(objMQMessage.MessageLength)\n\n '============================\n ' SET GMO.MATCHOPTIONS TO GROUP ID, INITIALLY IT WAS SET TO \"MQC.MQMO_NONE\" \n mobjMQGetMessageOptions.MatchOptions = MQC.MQMO_MATCH_GROUP_ID\n\n '============================\n ' DO UNTIL - MESSAGE IS THE LAST IN THE GROUP OR THE GROUP CONSISTS OF ONLY ONE MESSAGE.\n Loop While (mobjMQGetMessageOptions.GroupStatus <> MQC.MQGS_LAST_MSG_IN_GROUP)\n\n '====================================\n ' COLLECT THE MESSAGE IN AN ARRAYLIST\n If Not String.IsNullOrEmpty(strMQMessage) Then objMQMessageList.Add(strMQMessage)\n\n '============================\n ' COMMIT THE FETCH OPERATION\n mobjMQQueueManager.Commit()How we can remove this header information from each message?### Assistant: TheMQMDEcontains MQMD fields that exist in the version-2 MQMD, but not in the version-1 MQMD. The Infocenter topicOverview for MQMDdescribes how theMQMDversion affects behavior of the GET call:On the MQGET call, if the application provides a version-1 MQMD, the\n queue manager prefixes the message returned with an MQMDE, but only if\n one or more of the fields in the MQMDE has a non-default value. The\n Format field in MQMD will have the value MQFMT_MD_EXTENSION to\n indicate that an MQMDE is present.Based on this, I would suggest providing a Version 2MQMD. Perhaps this will solve the problem:'=================================\n ' INTANTIATE THE MQ MESSAGE OBJECT\n objMQMessage = New MQMessage\n objMQMessage.Version = 2\n objMQMessage.Format = MQC.MQFMT_STRING\n '=================================Since theobjMQMessageis reused for successive calls, you may need to set the version before each GET.The IBM MQ Knowledge Center page \"MQMDE - Message descriptor extension > Overview for MQMDE\" also has some useful information on the topic:Usage:Applications that use a version-2 MQMD will not encounter an MQMDE structure. However, specialized applications, and\n applications that continue to use a version-1 MQMD, might encounter an\n MQMDE in some situations. The MQMDE structure can occur in the\n following circumstances:Specified on the MQPUT and MQPUT1 callsReturned by the MQGET callIn messages on transmission queues\n"}
+{"text": "### Human: I am trying to receive the message from the queue using ANSI-C and MQGET function. The problem is that I always get error 2010 (MQRC_DATA_LENGTH_ERROR).I found out that this error concerns parameter 7 of the MQGET call (DataLength). The message on my queue has 7157460 bytes. The channel I am using for MQGET has the \"Maximum message length\" set to 104857600 (as well as the queue holding the message).I am even using the MQGET from this example:http://www.capitalware.biz/dl/code/c/msg2file.zipAnd I still end up with error 2010. What am I doing wrong? Should I somehow increase the maximum size of the message in MQSERVER environment variable?MQGET call:/* ... */\nMQLONG messlen; /* message length received */\n\nMQGET(Hcon, /* connection handle */\n Hobj, /* object handle */\n &md, /* message descriptor */\n &gmo, /* get message options */\n buflen, /* pBuffer length */\n pBuffer, /* pointer to message buffer */\n &messlen, /* message length */\n &CompCode, /* completion code */\n &Reason); /* reason code */### Assistant: I've got it! The answer is to use MQCONNX call to connect to queue manager.Example:#include \n/* ... */\nMQCNO mqcno = {MQCNO_DEFAULT} ; /* Connection options */\nMQCD mqcd = {MQCD_CLIENT_CONN_DEFAULT}; /* Channel Defs */\n\n/* ... */\nmqcd.MaxMsgLength = 104857600L; /* 100 MB */\n\nMQCONNX(mQueueManager.Name,\n &mqcno,\n &mQueueManager.ConnectionHandle,\n &mQueueManager.CompletionCode,\n &mQueueManager.ReasonCode);It worked like a charm!But please remember - if you find yourself needing to increase the maximum message size - think twice. There is probably something wrong with the design. In another words - MQ should not be used for transferring big messages. MQ File Transfer Edition is one of the solutions then.\n"}
+{"text": "### Human: We know that MQ server could be configured such that new receiver will not be able to connect to MQ server if there is already receiver connecting to the same MQ queue. Error will look like below:Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2042' ('MQRC_OBJECT_IN_USE')But is there any way to configure server or client to allow new receiver to connect to MQ server and disconnect any existing receiver connection?Below is currently how my receiver connects to server. I wonder if something could be done to setIntProperty.cf = new MQQueueConnectionFactory();\ncf.setHostName(mqHost);\ncf.setPort(mqPort);\ncf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\ncf.setQueueManager(mqQueueManager);\ncf.setChannel(mqChannel);\n\nconn = (MQQueueConnection) cf.createQueueConnection();\nsession = (MQQueueSession) conn.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);\nqueue = (MQQueue) session.createQueue(mqQueue);\nreceiver = (MQQueueReceiver) session.createReceiver(queue);Thanks!Gerry### Assistant: OK, you are mixing different concepts here. Your application is using a CLNTCONN channel to connect to the QMgr's SVRCONN channel. Yopu can have as many connections on a SVRCONN channel as memory and system resources allow. The connection is not the problem.The '2042' ('MQRC_OBJECT_IN_USE') indicates that the program is gaining exclusive access to the queue. There are two fixes for this:Don't use exclusive access to the queue. Check theDEFSOPTvalue of the queue to see if it is set toEXCLorSHARED. If you need it to be sharable, make sure the queue setting reflects that.If you need the queue to remain exclusive (for example because messages are sequence dependent), stop the previous connection before attempting a new connection. When a program does not close a connection gracefully, an orphaned channel agent holds the connection's queues open. Eventually the agent times out and any exclusive input queues become available again. If programs are leaving orphaned channels, fix the programs. As a short-term measure, you can manually stop orphaned channels to release the lock on the input queue.\n"}
+{"text": "### Human: I've got a clustered partner in WMQ on distributed platforms (HP-UX). They and the qmgr they are putting messages to are both members of \"my\" cluster, but have never utilized the cluster relationship to communicate amonst themselves. They have a remote queue def, transmit queue (named as the queue manager), unique point to point sender/receiver channel pair, etc., but he claims that a TRACE ROUTE from one to the other is magically utilizing the SYSTEM.CLUSTER.TRANSMIT.QUEUE and the cluster channel (presumably), even though the remote queue, of course, has configured no such thing.Is there any strange anomalie of MQ that would cause a standard REMOTE queue to choose to use the cluster path without expecting it to?The queues on either side are NOT shared in the cluster of course.### Assistant: I think we've answered our own question. Can't imagine how I managed to follow the rules all along, and never elicit this behavior. If the supposed transmit queue specified in the remote queue definition does not have USAGE(XMITQ) specified, but rather, (NORMAL), and the transmit queue specified in the RQ is indeed the name of the known queue manager in the cluster, then voila, we have the cluster being used regardless of the definition explicitly configured in the remote queue definition itself. What a handy way to migrate from remote queue / unclustered definitions, to clustered ones.\n"}
+{"text": "### Human: I use the following to write queue contents to a file:q -xb -ITESTQ -mTEST > messages.outI had 3 binary messages in the queue that got written to the file successfully. Now I have a need to load the same file back to the queue (same queue at a later time). When I do:q -xb -oTESTQ -mTEST < messages.outIt puts 9 messages instead of 3. I am guess the formatting is misread while the file is loaded. I've noticed there is -X option in the q program. What is the usage of it? What other options I have?### Assistant: Youreallyneed to look at the QLoad program (SupportPac MO03) for this. Same author as the Q program and every bit as good a tool. Also free. As the author explains in the manual:Ever since I released my MA01 (Q Utility) SupportPac I have had\n periodic requests to explain how it can be used to unload, and\n subsequently reload, messages from a queue. The answer has always been\n that this is not what MA01 is for and that surely there must be a\n utility available. Well, after sufficient numbers of these requests I\n looked for a utility myself and didn\u2019t really find anything which\n fitted the bill. What was needed was a very simple, some would say\n unsophisticated, program which unloaded a queue into a text file. The\n notion of a text file was important because a number of users wanted\n the ability to change the file once it had been created. I also find\n that text based files are more portable and so this seemed useful if\n we want to unload a queue, say on Windows, and then load the messages\n again on a Solaris machine. The disadvantage of this approach is that\n the file is larger than it would be in binary mode. Storing data using\n the hex representation of the character rather than the character\n itself essentially uses twice as much space. However, in general I do\n not envisage people using this program to unload vast amounts of\n message data but a few test messages or a few rogue messages on the\n dead letter queue which are then changed and reloaded elsewhere.\n"}
+{"text": "### Human: Why doesn't the following create the LOCAL quue definition? I see a remote queue definition with the name REMOTE_QUEUE? Do I need to create another DEFINE QLOCAL for LOCAL_QUEUE?DEFINE QREMOTE (LOCAL_QUEUE) RNAME (REMOTE_QUEUE)\n RQMNAME(REMOTE_QUEUE_MANAGER) XMITQ(REMOTE_QUEUE_MANAGER) REPLACE### Assistant: When you issueDEFINE QREMOTE(LOCAL_QUEUE)you are making a routing entry that tells WMQ \"any time someone onthisQMgr opens a queue namedLOCAL_QUEUEthen instead, usethesevalues for the queue name, the QMgr name and, if specified, resolve to this XMitQ\". This entry shows up when you list all the defined queues but it isn't a queue that can hold messages. The only way to create a queue that can hold messages isDEFINE QLOCAL.The next step is to define the actual target queue where messages can land. Defining the QRemote on the local QMgr does not also define the QLocal on the target QMgr. To do that, you would need to sign onto the target QMgr with Explorer or connect on the command line usingrunmqscand issue theDEFINE QLOCAL(REMOTE_QUEUE)there.It is a bit unfortunate that your example used names likeREMOTE_QUEUEbecause onREMOTE_QUEUE_MANAGERit is actually a QLocal.FYI - totally unrelated but you might want to consider using dots as name separators likeREMOTE.QUEUEinstead ofREMOTE_QUEUEsince WMQ recognizes these as node separators and authorization wildcards respect them.\n"}
+{"text": "### Human: I have traditional (com.ibm.mq.jar) MQ application in Java for testing purpose. Now I need to use that application to send some messages to JMS. When I try to set any JMS property on MQ message, for example:message.setStringProperty(\"JMSDestination\", \"queue:///\" + queueName);I always get error: 2471 -MQRC_PROPERTY_NOT_AVAILABLE. It works if I just removeJMSfrom the property name.Is it possible to set JMS properties directly onMQMessage? What is a correct way to do that on MQ level?Btw. I have the same application in .NET where setting JMS properties this way is possible so I'm only trying to use the same code in Java.### Assistant: It is not allowed to do this manually. Please use the JMS API to set JMS properties.Restrictions to MQ properties are explainedhere.One thing is interessting in that document page though,The names of properties specified directly as MQRFH2 elements are not guaranteed to be validated by the MQPUT call.You could perhaps work around this, on a short term basis. There seems to be no guarantee that setting the MQRFH2 elements directly will not be validated, though.\n"}
+{"text": "### Human: If i create an environment variable will it exist in all flows within the execution group? I need to have a value which has to be shared between two flows in the same execution group.### Assistant: Nope. The environment variable has its scope set for a particular flow. If you want to share a value between two flows, either you will have to pass it on as a message or use User defined properties (UDP) to set it to all flows in the execution group.\n"}
+{"text": "### Human: What are the cases a queue manager can loose its connectivy to repository in cluster encironment?\nI have an environment where a queue manager is losing its connectivity to repository often and i need to refresh the cluster to fix this and to re-establish communication with other queue manager in the cluster.Our cluster has 100 queue managers and we have 2 repositories in it.### Assistant: There are a few different issues that can cause this. One is if there are explicitly definedCLUSSDRchannels pointing to a non-repository QMgr. This causes repository messages to arrive at the non-repos QMgr which can cause itsamqrrmfarepository process to die. Another is that there have been a few APARS (such asthis one) which can lead to that process dieing. The solutions, respectively, are to fix the configuration issues or to apply the latest Fix Pack. Another issue, less commonly seen, is that a message to a new QMgr will error out before the new QMgr can resolve to the local QMgr. In this case, theREFRESHdoesn't actually cause the remote QMgr to resolve, it just provides time for the resolution to complete.Debugging this involves isolating the possible causes. Check thatamqrrmfais running. Check that all non-repository QMgrs have one and ONLY one explicitly defined CLUSSDR channel. Verify that all repositories have one and ONLY one explicitly defined CLUSSDR to each other repository. If overlapping clusters are used make sure to NOT overlap the channels. This means avoiding channel names likeTO.QMGRand prefer names likeCLUSTER.QMGR. Verify this by insuring channels do not use theCLUSNLattribute and use theCLUSTERattribute instead. Finally, reconcile the objects in both repositories and the non-repository by issuingDIS CLUSQMGR(*)andDIS QCLUSTER(*). The repositories should have identical object inventories. If that's wrong then there's the problem. The non-repository should have an entry for every QMgr it has previously talked to.One thing I have seen in the past was that an administrator had scheduled aREFRESH CLUSTER. His thinking was that this was something they needed to do to fix the cluster so why not run it on a regular basis? So he scheduled it to run daily. Then each night it made the QMgr forget about the other QMgrs in the cluster and the first time an app resolved a remote QMgr each day there was a flurry of repository traffic. This caused enough of a delay that there were a few 2087 errors each morning. Not thatyouwould do such a thing. :-)\n"}
+{"text": "### Human: When I set MQMD.Expiry and MQM.Report (= MQRO_EXPIRATION_WITH_FULL_DATA) in Message Broker, where do messages go if they expire?Should I catch them in the MQInput node?If so, how do I differentiate between these and other errors?### Assistant: I found the answer:You have to set the MQMD.ReplyToQ in the message header. That way it will return to that queue once it expire. (Keep in mind a message is only thrown out when an MQGET is performed on that queue(Just moving this from comments in case any misses it.)\n"}
+{"text": "### Human: We are using IBM's WebSphere MQ, and having issues creating administrative subscriptions via scripts. One of the params expects an existing model queue but for some reason it is missing from our environment. Maybe that's an issue altogether but wondering is there a way to bypass the model queue and create a subscription anyways?The link I'm looking at is the Messages & Codes manual section containingAMQ8464. \nPlease scroll down to see AMQ8464. I guess we're missing theInsert_3but hopefully there is a way around not having it. The full text of the error is as follows:If the command entered was Change or Display, the subscription\n specified does not exist. If the command entered was Copy,\n the source subscription does not exist. If the command entered was\n Create, the system default MQ subscription does not exist.Thanks for any ideas.### Assistant: This error can be thrown when attempting to copy or delete a subscription and the expected existing subscription isn't found. Since you are attempting to define a subscription then we can assume that the last case described in the error manual is the one we want -SYSTEM.DEFAULT.SUBdoes not exist. This subscription is defined when the QMgr is created (assuming a v7.0 or greater version of WMQ). There are two ways to get it back.Define the subscription manually. All that is required for this to work is to specify all the fields in the subscription.Use thestrmqm -ccommandas described here. This will redefine any default system objects that have been manually deleted, including the default subscription.The reason that #1 works is that WMQ will use whatever parameters that you provide on yourDEFINEcommand and then any you leave out it looks at theSYSTEM.DEFAULT.SUBobject to determine the system local default value. If you supplyallof the values, then it has no need to look at the default object and just defines whatever you tell it. That means you can define your own subscription or for that matter you can defineSYSTEM.DEFAULT.SUBjust by specifying all the parms. The followingDEFINEstatement recreatesSYSTEM.DEFAULT.SUBwithout having to stop and restart the QMgr using the-coption:DEFINE SUB(SYSTEM.DEFAULT.SUB) + \n TOPICSTR('') +\n TOPICOBJ('') +\n DEST('') +\n DESTQMGR('') +\n PUBAPPID('') +\n SELECTOR('') +\n USERDATA('') +\n PUBACCT(0000000000000000000000000000000000000000000000000000000000000000) + \n DESTCORL(000000000000000000000000000000000000000000000000) +\n DESTCLAS(PROVIDED) +\n EXPIRY(UNLIMITED) + \n PSPROP(MSGPROP) + \n PUBPRTY(ASPUB) +\n REQONLY(NO) + \n SUBSCOPE(ALL) + \n SUBLEVEL(1) + \n VARUSER(ANY) +\n WSCHEMA(TOPIC) +\n SUBUSER('')\n"}
+{"text": "### Human: I am novice in IBM WebSphere MQ and I would like to ask you about the best approach to solve the following task.I use WebSphere MQ 7.0 and I have implemented an java app to check MQ queue on incoming messages.Incoming queue opened via the following code:int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE;\nMQQueue incomingQueue = \n qManager.accessQueue(qName, openOptions, null, null, null);Now, the task is to check in real-time mode when new messages appear inincomingQueueand process them.I permanently check queue depth via invocation ofincomingQueue.getCurrentDepth()in while-loop and check if it is bigger than zero then I get new messages.That works, but I believe it is not a good approach.What is the best approach to be notified when a new incoming message appeared in MQ Queue?Thank you.### Assistant: Just call the queue.Get(msg) method. This is a blocking call and will return only when there is a message on a queue.If the above is not suitable as it is a blocking call, you could look at WMQ JMS that provides a message listener. The message listener is used to receive messages on a callback method while the main thread can continue to do other work.There are good samples that comes with MQ. You can find them under (on Windows) \\tools\\jms\\samples and tools\\wmqjava\\samples.\n"}
+{"text": "### Human: MQQueueclass in both .NET and Java API for WebSphere MQ contains three similar methods:PutForwardMessagePutReplyMessagePutReportMessageI understand purpose of the first one because it takes passed message, makes a copy of the message and puts it to the queue but what is a purpose of second and third method?The documentation forPutReplyMessagesays:Put a reply message onto the queue using message as the original messageThe documentation forPutReportMessagesays:Put a report message onto the queue using message as the original messageNothing more. Really great and helpful doc.It looks like all three methods do the same. They take original message passed to the method, makes a copy of the message (including body and properties) and sets some control fields likeMessageIdorCorrelationIdbased on original message and put the newly created message into the queue. The only difference between them is settingMessageTypeand probably some conditions how control headers should be copied. But why and when do I need these methods?I would expect thatPutReplyMessagewill take a new message with reply body and original message with request and configure reply message with necessary fields like message type and correlation Id before putting it to the queue. This version seems pretty use less because I always have to create my own reply message to specify its content and configure everything myself. Once I do that, I can simply use thePutmethod instead ofPutReplyMessage.### Assistant: When a message is forwarded, all of the message header fields remain intact. This includes message type, identity context, etc. The user or app must have +passall authorization and cannot change the header fields but can only pass them.When a reply message is sent, the original message context is used to setsomefields in the message header of the reply but the identity context of the reply message is inherited from the putting application rather than from the original message. The putter can choose to override some of the fields in the reply message header, for example whether to pass theMsgIDas theMsgIDof the reply, put it in theCorrelIDfield or put application-defined values in these fields.A report message is intended to be used to send application-defined report messages such asACKorNACK. These are different from the WMQ-defined COA or COD report messages. By convention, the requester can ask for no message data, partial data or all data but the putting application is free to honor as much or as little of the request as it wants.The WebSphere MQ native formats and message types are defined in theApplication Programming Guideand theApplication Programming Reference. I believe it is probably not appropriate to duplicate this information in each language manual but I've submitted feedback from the Infocenter .Net manual page suggesting that they could at least link to the appropriate section in the related document.\n"}
+{"text": "### Human: I have two very basic questions on WebSphere MQ - given that I had been kind of administrating it for past few months I tend to think that these are silly questionsIs there a way to \"deactivate\" a\nqueue ? (for example through a\nrunmqsc command or through the\nexplorer interface) - I think not. I\nthink what I can do is just delete\nit.What will happen if I create a\nremote queue definition if the real\nremote queue is not in place? Will\nit cause any issues on the queue\nmanager? - I think not. I think all\nI will have are error messages in\nthe logs.Please let me know your thoughts.\nThanks!### Assistant: 1 Is there a way to \"deactivate\" a\n queue?Yes. You can change the queue attributes like so:ALTER Q(QUEUE_NAME) PUT(DISABLED) GET(DISABLED)Any connected applications will receive a return code on the next API call telling them that the queue is no longer available for PUT/GET. If these are well-behaved programs they will then report the error and either end or go into a retry loop.2 What will happen if I create a\n remote queue definition if the real\n remote queue is not in place?The QRemote definition will resolve to a transmit queue. If the message can successfully be placed there your application will receive a return code of zero. (Any unsuccessful PUT will be due to hitting MAXDEPTH or other local problem not connected to the fact that the remote definition does not exist.)The problem will be visible when the channel tries to deliver the message. If the remote QMgr has a Dead Letter Queue, the message will go there. If not, it will be backed out onto the local XMitQ and the channel will stop.\n"}
+{"text": "### Human: Does WebSphere MQ v7 guarantee the recovery of in-flight messages after failover to a standby queue manager?If so, how is this accomplished?\nThanks### Assistant: There are two primary types of standby instances which support this level of recovery. The first is in a traditional hardware cluster such as Power HA, HACMP, Veritas, MSCS and so forth. The other is a Multi-Instance Queue Manager (MIQM). Both of these are capable of running the queue manager on more than one server with data and log files occupying shared disk which is accessible to all instances.In both cases, persistent messages which have been committed prior to the termination of the primary QMgr will be recovered. The secondary QMgr will assume possesion of the data and log files during the failover event. From the perspective of the failover node it is the same as if the QMgr was just starting up after a shutdown or crash, it just hapens to now be running on a different server.The main differences between a hardware cluster versus MIQM is that a hardware cluster fails over the IP address and possibly non-MQ processes as well. The MIQM recovers only the MQ processes and comes up on a different IP address. Applications with V7 clients can be configured with multi-instance connection details to allow for the multiple IP addresses.So for these solutions in which the state of the QMgr and any in-flight messages is stored on shared disk, bringing the QMgr up with the same shared disk but on a different node recovers the state of the QMgr, including any in-flight messages.\n"}
+{"text": "### Human: Hi I am working with MQFTE. I need to know more in detail about how mqfte works and what are the internal process that takes place during a operation.The IBM links about mqfte/red books is good , but it doesn't have in depth contents.Could you please suggest me some links/ebooks to know more about mqfte and mq?.Thanks in Advance......### Assistant: Unfortunately, not too many 3rd party links and the only books I am aware of are the few Redbooks. However, this will be a start:WebSphere MQ FTE Home PageWebSphere MQ FTE InfocenterWebSphere MQ FTE Fix ListIBM Redbook:Getting Started with WebSphere MQ FTEWebSphere training(Including WMQ FTE)WebSphere MQ product pageWebSphere MQ v7 documentationWebSphere MQ v6 documentationWebSphere MQ RequirementsWebSphere MQ Recommended FixesWebSphere MQ SupportPacsWebsphere MQ 6+ Certification Book- Links to resources for self-studydeveloperWorks articleSecuring WebSphere MQ FTEdeveloperWorksMission:Messagingcolumn has in-depth articles on some of the trickier areas of WebSphere MQ family products.T-Rob.nethas a collection of WMQ security info, links, articles and all back-episodes ofThe Deep Queuepodcast.\n"}
+{"text": "### Human: I'm currently developing a small EJB 3 application for WebSphere AS 7 with WebSphere-MQSeries. It's a very simple app that mainly consists of one MDB listening on a queue, convert the incoming messages and write the extracted data into a db. I've finally got up it and running, but I'm a bit confused regarding ActivationConfig annotations in the code, the ibm-ejb-jar-bnd.xml and the activation spec in WAS itself. My main question is, why do I need ALL of them? Why should/could I specify things like the queue name or destinaton type via annotation (@ActivationConfigProperty) when I still need a activation spec in WAS where I also specify the destination e.g. Queue-Name? I addition I also need a binding via an xml file? Is that right? Is it also possible to specify the activationspec-name via annotation and thus get rid of the xml binding file? Can I avoid creating the activation spec in WAS?Hope someone can clarify things, thanks.### Assistant: You cannot avoid the Activation Spec entity because it is responsible to open connection to your JMS provider, query messages according to various options like the message selector filter.According toWebSphere 7 InfoCenterEJB-3 annotations can replace activation specification properties from binding file but the properties required by WebSphere are not standard.So as far as I know, you have to provide:either the binding file, written manually or edited with the deployer tooleither at deployment setting properties in the administrative console or in automated jython/wsadmin scriptBe awarethat the Activation Spec is a runtime component that can be stopped, typically after some rollbacks on messages. In that case, it no longer consumes message and your MDB has nothing to process until you re-activate it from the WebSphere console.\n"}
+{"text": "### Human: With WebSphere MQ, where is a message addressed to a remote queue manager and PUT under syncpoint control stored until MQCMIT is issued?### Assistant: Messages that are addressed to a remote queue manager resolve to a transmit queue. Which transmit queue they resolve to depends on how the message will be sent to the remote QMgr. The message will resolve locally to either a user-defined transmit queue for a SDR or SVR channel, or it will resolve to SYSTEM.CLUSTER.TRANSMIT.QUEUE for a clustered channel.For any message that is put under syncpoint, the message is written to the transaction logs and, if the message is persistent, to the queue file. The queue depth increases to reflect that the message is in the queue but the message is not made available to other programs (such as the channel agent) until the COMMIT occurs.So if your message is going to a clustered queue manager and you PUT under syncpoint, you will see the depth of the cluster transmit queue increase. At that point the message is at least in the transaction log and possibly also written to the queue file. As soon as the message is committed, it becomes available to the channel.\n"}
+{"text": "### Human: I have installed Websphere MQ V7. and created queue manager and channels , but the problem is i cannot create any queues on the explorer and when check in the error log files ,there's no errors thrownHow can i be helped### Assistant: It sounds as though you can see the queues in Explorer but creating a new queue fails. If what you meant was that you are unable to get Explorer to connect at all, then please clarify the question.When you can see queues but can't create them, there's a very good chance that you are getting authorization errors. You can test this theory by enabling authorization events:runmqsc ALTER QMGR AUTHOREV(ENABLED)If this is the problem then you will see event messages being generated in theSYSTEM.ADMIN.QMGR.EVENTqueue.Another way to verify this is to set the MCAUSER of the SVRCONN channel to an administrative value. If you are using Linux, that would be 'mqm' and on Windows it depends on how you installed it but MUSR_MQADMIN usually works.runmqsc ALTER CHL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN) MCAUSER('mqm')If this solves the problem then it was authorization errors. Keep in mind that hard-coding the MCAUSER to an administrative value means that anyone connecting to that channel has administrative rights.If security is important you will want to make sure that any inbound channel with a blank MCAUSER or an administrative account in MCAUSER authenticates connections using SSL or an exit. Channels for low-privileges access must have a low-privileged account in the MCAUSER or else they allow administration. These include channels of type RCVR, RQSTR, CLUSRCVR and SVRCONN, and specifically those namedSYSTEM.DEF*andSYSTEM.AUTO.*as well as any user-defined channels. For much more discussion of WMQ security, please see theWMQ Hardeningpresentation athttps://t-rob.net/links/or post questions here on SO.\n"}
+{"text": "### Human: This is a follow up on the question below, but it deserves another question.Are server-conn and client-conn channels the only channels that could have more than one instances?To my understanding, a receiver (or cluster receiver) channel usually pair up with a single sender (or cluster sender) channel. How can one side being single instance while the other side being multiple instances?Thanks.### Assistant: Consider a CLUSRCVR channel for a minute. You define one of these and then all members of the cluster use the same one to talk to the local QMgr. Similarly, a single SVRCONN channel definition can server connections from many users (think SYSTEM.ADMIN.SVRCONN for instance, with 50 users attached to it.)The same principle works for RCVR or RQSTR channels. For example, suppose that you create a channel on your local QMgr called BRANCH.TO.CENTRAL with the intention that each branch office uses the channel to send daily sales numbers to the home office. Each of the queue managers can have only one instance of a BRANCH.TO.CENTRAL channel defined. The branch queue managers can have only one instance of the channel running but the central office can have many instances of the channel active at the same time. Typically you would not do this and would either use a cluster or named channel pairs, but it does serve to illustrate the case.So the rule of thumb is that inbound channels (SVRCONN, RCVR, RQSTR and CLUSRCVR) can have many running instances using a single channel definition while outbound channels can have only one running instance.Does that help or just muddy things up?\n"}
+{"text": "### Human: We are trying to connect to IBM MQ Server v 9.1.0.x. from RHEL 8.3 using .net core 3.1 and IBMMQDotnetClient 9.2.0.1 standard library from nuget.We are stuck on getting CompCode: 2 Reason: 2059 error.We know what is the reason: during ssl negotiation cipher spec is set to TLS_RSA_WITH_AES_128_CBC_SHA256 but the channel has it set to TLS_RSA_WITH_AES_256_CBC_SHA256.ERR*.TRCCommentInsert2(TLS_RSA_WITH_AES_256_CBC_SHA256)CommentInsert3(TLS_RSA_WITH_AES_128_CBC_SHA256)AMQ9631E: The CipherSpec negotiated during the SSL handshake does not match the\nrequired CipherSpec for channelWe had the same issue on Windows but doingDisable-TlsCipherSuite -Name TLS_RSA_WITH_AES_128_CBC_SHA256has resolved the issue.What we've done already:We are specifying SSL_CIPHER_SPEC_PROPERTY as TLS_RSA_WITH_AES_256_CBC_SHA256.Unfortunately it is ignored, as we are using managed client (MQC.TRANSPORT_MQSERIES_MANAGED) it's the only valid option for managed library. All security calls are transferred to internal security providers (Schanel/SslStreams on Windows and OpenSsl on Linux).We know that we should alter cipher policy on Linux, do you have any idea how to:Disable TLS_RSA_WITH_AES_128_CBC_SHA256 on RHEL?UPDATEDisable-TlsCipherSuite -Name TLS_RSA_WITH_AES_128_CBC_SHA256is a Powershell cmd.UPDATE 1On Linux (RHEL8.3) During handshake my frame looks like:Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c) \n Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030) \n Cipher Suite: TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (0x009f) \n Cipher Suite: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9) \n Cipher Suite: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8) \n Cipher Suite: TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xccaa) \n Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)\n Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)\n Cipher Suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x009e)\n Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (0xc024)\n Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0xc028)\n Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 (0x006b)\n Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (0xc023)\n Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (0xc027)\n Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 (0x0067)\n Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)\n Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)\n Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)\n Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)\n Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)\n Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)\n Cipher Suite: TLS_RSA_WITH_AES_256_GCM_SHA384 (0x009d)\n Cipher Suite: TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)\n **Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA256 (0x003d)**\n **Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256 (0x003c)**\n Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)\n Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)\n Cipher Suite: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0x00ff)UPDATE 2We managed to force cipher used during negotiation and then during MakeSecuredConnection. Unfortunately it's only doable on .NET5.0 and hack in MakeSecureConnection is needed.I tried the same approach using .net core 3.1 but failed probably because of use of AuthenticateAsClientAsync.Here is .NET5.0 IBM MQ Client 9.2.0.1 hackDecompile the code of IBMMQClient (amqmdnetstd.dll)Mark .csproj as .NET5.0net5.0EditMakeSecureConnectionmethod in classMQEncryptedSocketas followsonly .NET5.0if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))\n {\n stream.AuthenticateAsClient(\"*\", x509Certificate2Collection, sslProtocol, sslCertRevocationCheck);\n }\n else\n {\n //stream.AuthenticateAsClient(\"*\", x509Certificate2Collection, sslProtocol, sslCertRevocationCheck);\n var sslClientOptions = new SslClientAuthenticationOptions()\n {\n CertificateRevocationCheckMode = sslCertRevocationCheck ? X509RevocationMode.Offline : X509RevocationMode.NoCheck,\n ClientCertificates = x509Certificate2Collection,\n EnabledSslProtocols = sslProtocol, \n TargetHost = \"*\", \n RemoteCertificateValidationCallback =ClientValidatingServerCertificate,\n LocalCertificateSelectionCallback = FixClientCertificate,\n CipherSuitesPolicy = new CipherSuitesPolicy(new List() { Enum.Parse(cipherSpec) })\n };\n TrText(method, $\"Setting Cipher for AuthenticateAsClient {string.Join(':',sslClientOptions.CipherSuitesPolicy.AllowedCipherSuites)}\");\n stream.AuthenticateAsClient(sslClientOptions);\n }for .net core 3.1 you have to callstream.AuthenticateAsClientAsync(sslClientOptions);Since there is no methodAuthenticateAsClientoverload acceptingSslClientAuthenticationOptionsparameter..net standard 2.0 and 2.1 don't have CipherSuitesPolicy parameter in classSslClientAuthenticationOptionsthat's why I had to move the library from .net standard 2.0 to .net5.0 (with success) and .net core 3.1 without.Do you have any clue how is it possible to make it work on .net core 3.1?### Assistant: I had the same issue when connecting with .NET MQ client to a channel using TLS_RSA_WITH_AES_256_CBC_SHA256 cipher.In the MQ server logs I saw that my client tried to connect withTLS_RSA_WITH_AES_256_GCM_SHA384even if I was setting the cipher spec toTLS_RSA_WITH_AES_256_CBC_SHA256in my code.cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, \u201cTLS_RSA_WITH_AES_256_CBC_SHA256\u201d);To solve it I had to set the system default cipher in the file /etc/ssl/openssl.cnf to AES256-SHA256.[system_default_sect]\n\u2026\nCipherString = AES256-SHA256My application is built on .NET 6.\n"}
+{"text": "### Human: I am trying to configure one @JMSListener which will listen to multiple queue managers in my Springboot application which is listening to IBM MQ. Below are the 2 bean i have created and the requirement is to listen to both queue actively :@Value(\"${ibm.mq.queueManager.A}\")\nString jmsMQConnectionFactoryA;\n\n@Value(\"${ibm.mq.queueManager.B}\")\nString jmsMQConnectionFactoryB;\n\n@Bean\n@Primary\npublic MQQueueConnectionFactory jmsMQConnectionFactoryB() {\n MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n URL url = JMSConfiguration.getURL(this.urlFileLocation);\n try {\n mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n mqQueueConnectionFactory.setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT_Q_MGR);\n mqQueueConnectionFactory.setCCDTURL(url);\n mqQueueConnectionFactory.setQueueManager(jmsMQConnectionFactoryB);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return mqQueueConnectionFactory;\n}\n\n \n\n @Bean\n public MQQueueConnectionFactory jmsMQConnectionFactoryB() {\n MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n URL url = JMSConfiguration.getURL(this.urlFileLocation);\n try {\n mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n mqQueueConnectionFactory.setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT_Q_MGR);\n mqQueueConnectionFactory.setCCDTURL(url);\n mqQueueConnectionFactory.setQueueManager(jmsMQConnectionFactoryA);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return mqQueueConnectionFactory;\n }EDIT 1 :Added 2 containerFactory using above connections and 2 JMSTemplate (as i need to publish message as well) Below is the updated working code@Bean\n JmsListenerContainerFactory> jmsContainerFactoryA() {\n DefaultJmsListenerContainerFactory factory = new \n DefaultJmsListenerContainerFactory();\n factory.setConnectionFactory(jmsMQConnectionFactoryA());\n factory.setRecoveryInterval((long) 60000);\n factory.setSessionAcknowledgeMode(2);\n factory.setSessionTransacted(true);\n // factory.setMaxMessagesPerTask(concurrencyLimit);\n return factory;\n }\n\n@Bean\nJmsListenerContainerFactory> jmsContainerFactoryB() {\n DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();\n factory.setConnectionFactory(jmsMQConnectionFactoryB());\n factory.setRecoveryInterval((long) 60000);\n factory.setSessionAcknowledgeMode(2);\n factory.setSessionTransacted(true);\n // factory.setMaxMessagesPerTask(concurrencyLimit);\n return factory;\n}\n\n@Bean\npublic MQQueue jmsResponseQueue() {\n MQQueue queue = null;\n try {\n queue = new MQQueue(\"QueueOut\");\n queue.setBaseQueueName(wmq_out_base_queue);\n } catch (JMSException e) {\n e.printStackTrace();\n }\n return queue;\n}\n\n@Bean\npublic JmsTemplate jmsTemplateB() {\n JmsTemplate template = new JmsTemplate();\n template.setConnectionFactory(jmsMQConnectionFactoryB());\n template.setDefaultDestination(jmsResponseQueue());\n template.setMessageConverter(oxmMessageConverter());\n return template;\n}\n\n@Bean\npublic JmsTemplate jmsTemplateA() {\n JmsTemplate template = new JmsTemplate();\n template.setConnectionFactory(jmsMQConnectionFactoryA());\n template.setDefaultDestination(jmsResponseQueue());\n template.setMessageConverter(oxmMessageConverter());\n return template;\n}Class2.java@Value(\"${wmq_out_base_queue}\")\n String wmq_out_base_queue;\n\n @Autowired\n JmsTemplate jmsTemplateA;\n \n @Autowired\n JmsTemplate jmsTemplateB;\n\n @JmsListener(containerFactory=\"jmsContainerFactoryA\",destination = \"${wmq_in_base_queue}\")\n public void reciveMessageA(Message message) {\n LOGGER.info(\"Received message is: \" + message); \n this.jmsTemplateA.convertAndSend(wmq_out_base_queue, \"Some Message\");\n }\n \n @JmsListener(containerFactory=\"jmsContainerFactoryB\",destination = \"${wmq_in_base_queue}\")\n public void reciveMessageB(Message message) {\n LOGGER.info(\"Received message is: \" + message); \n this.jmsTemplateA.convertAndSend(wmq_out_base_queue, \"Some Message2\");\n }### Assistant: You need to disable JMS auto configuration and configure 2 connection factories, 2 container factories using those connection factories and 2 JmsTemplates (if you are also publishing).I am trying to configure one @JMSListener which will listen to multiple queue managersIn order to have a@JmsListenerto do this you need to add 2@JmsListenerannotations to the method, with each one having thecontainerFactoryproperty set to the respective container factory.\n"}
+{"text": "### Human: From a Java app I'm trying to browse messages from a mainframe IBM MQ queue (EBCDIC messages). I need to browse messages, not consume them. Here is the code:JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\nJmsConnectionFactory cf = ff.createConnectionFactory();\n\n// Set properties\ncf.setStringProperty(WMQConstants.WMQ_HOST_NAME, host);\ncf.setIntProperty(WMQConstants.WMQ_PORT, port);\ncf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);\ncf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\ncf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, qmgr);\ncf.setIntProperty(WMQConstants.WMQ_RECEIVE_CONVERSION, WMQConstants.WMQ_RECEIVE_CONVERSION_QMGR);\n\nQueueBrowser browser = context.createBrowser(context.createQueue(\"queue:///\" + queueName + \"?targetClient=1\"));\nEnumeration enumeration = browser.getEnumeration();\n\nwhile (enumeration.hasMoreElements()) {\n TextMessage messageInTheQueue = (TextMessage) enumeration.nextElement();\n System.out.println(messageInTheQueue);\n nbRecords++;\n}The result ofSystem.out.println()looks like:JMSMessage class: jms_text\n JMSType: null\n JMSDeliveryMode: 2\n JMSMessageID: ID:c1d4d840d4d8e3c1e2f24040404040405e2432bd21aa1b02\n JMSTimestamp: 1579537307450\n JMSRedelivered: false\n JMSXAppID: \n JMSXDeliveryCount: 1\n JMSXUserID: \n JMS_IBM_Character_Set: IBM037\n JMS_IBM_Encoding: 273\n JMS_IBM_Format: MQSTR \n JMS_IBM_MsgType: 8\n JMS_IBM_PutApplType: 8\n JMS_IBM_PutDate: 20200120\n JMS_IBM_PutTime: 16214745\n\u00cd\u00cd\u00d1\u00c0 ...I would like to convert this EBCDIC message\u00cd\u00cd\u00d1\u00c0 ...to something readable (ASCII).I tried to castenumeration.nextElement()toJMSByteMessagebut get this exception:class com.ibm.msg.client.jms.internal.JmsTextMessageImpl cannot be cast to class com.ibm.jms.JMSBytesMessageHow could I do that?Solution:\nUse theMQ classesfor Java instead of theMQ JMS classesfor Java:byte[] strData = new byte[theMessage.getMessageLength()];\ntheMessage.readFully(strData, 0, theMessage.getMessageLength());Some example here:https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q030840_.htm### Assistant: Regarding the OP's original code, the following documentation states that receive conversion & CCSID are only valid for the MQDestination class:https://www.ibm.com/docs/en/ibm-mq/9.2?topic=reference-properties-mq-classes-jms-objectsTherefore thiscanbe done with the IBM MQ Classes for JMS. You just have to do it in a more round-about fashion.In order to make the QueueBrowser read EBCDIC formatted messages, you need to cast the JMS Queue to MQDestination, then set the receiveConversion & receiveCCSID, then when creating the browser, cast the MQDestination back to regular JMS Queue. Like so:JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\nJmsConnectionFactory cf = ff.createConnectionFactory();\n\n// Set properties\ncf.setStringProperty(WMQConstants.WMQ_HOST_NAME, host);\ncf.setIntProperty(WMQConstants.WMQ_PORT, port);\ncf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);\ncf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\ncf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, qmgr);\n\nJMSContext context = cf.createContext();\nMQDestination targetQueue = (MQDestination) context.createQueue(\"queue:///\" + queueName)\ntargetQueue.setReceiveCCSID(WMQConstants.CCSID_UTF8);\ntargetQueue.setReceiveConversion(WMQConstants.WMQ_RECEIVE_CONVERSION_QMGR);\ntargetQueue.setMessageBodyStyle(WMQConstants.WMQ_MESSAGE_BODY_MQ);\nQueueBrowser browser = context.createBrowser((Queue) targetQueue);\nEnumeration enumeration = browser.getEnumeration();\n\nwhile (enumeration.hasMoreElements()) {\n TextMessage messageInTheQueue = (TextMessage) enumeration.nextElement();\n System.out.println(messageInTheQueue);\n nbRecords++;\n}You also don't need to use the JMS URI properties for setting the target client when doing it this way, as MQDestination has all the necessary getters/setters to modify loads of properties that would otherwise be done with a URI.For more information on MQDestination, consult the following docs:https://www.ibm.com/docs/en/ibm-mq/9.2?topic=jms-mqdestination\n"}
+{"text": "### Human: I need a help for the captioned subject. Request your suggestion here.I am using spring boot framework to get the messages from IBM MQ 8.0.0.9. The attached program meets the basic expectation. However, It always uses the OS credential (in specifically Windows Login credential) to connect to the IBM MQ. But I would like it to use the credential this is given in property file. Even if, I intentionally give wrong credential in the property files, the program happily connects with the IBM MQ (using windows login credential which has access to the IBM MQ as well).Here is the MQ Details - \nMQ Version 8.0.0.9, \nQM Version 8.0.0.9, \nCONNAUTH - Not Set, \nCHLAUTH - Disabled, \nQMGR CONNAUTH - Not Set, \nCHCKCLNT - OPTIONAL, \nAUTHINFO - SYS.DEFAULT.AUTHINFO.IDPWOSCould you suggest what I am doing wrong here in the attach program. I have tried the commented line of code as well.@EnableJms\n@Configuration\n@EnableTransactionManagement\npublic class JmsConfig {\n @Value(\"${ibm.mq.host}\")\n private String host;\n @Value(\"${ibm.mq.port}\")\n private Integer port;\n @Value(\"${ibm.mq.queueManager}\")\n private String queueManager;\n @Value(\"${ibm.mq.channel}\")\n private String channel;\n @Value(\"${ibm.mq.responseQueue}\")\n private String responseQueue;\n @Value(\"${ibm.mq.userName}\")\n private String userName;\n @Value(\"${ibm.mq.password}\")\n private String password;\n @Value(\"${ibm.mq.receiveTimeout}\")\n private long timeout;\n\n @Autowired(required=true)\n @Qualifier(value=\"responseListener\")\n MessageListener responseListener;\n\n @Bean (name=\"queueConnectionFactory\")\n public MQQueueConnectionFactory mqQueueConnectionFactory() {\n MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();\n\n try {\n mqQueueConnectionFactory.setHostName(host);\n mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);\n mqQueueConnectionFactory.setChannel(channel);\n mqQueueConnectionFactory.setPort(port);\n mqQueueConnectionFactory.setQueueManager(queueManager);\n mqQueueConnectionFactory.setCCSID(819);\n /*\n mqQueueConnectionFactory.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true);\n mqQueueConnectionFactory.setStringProperty(WMQConstants.USERID, userName);\n mqQueueConnectionFactory.setStringProperty(WMQConstants.PASSWORD, password);\n mqQueueConnectionFactory.setStringProperty(CMQC.USER_ID_PROPERTY, userName);\n mqQueueConnectionFactory.setStringProperty(CMQC.PASSWORD_PROPERTY, password);\n */\n } catch (JMSException e) {\n log.error(\"Error occured: \" + e);\n }\n\n return mqQueueConnectionFactory;\n }\n\n @Primary\n @Bean (name=\"userCredentialsConnectionFactoryAdapter\")\n @DependsOn(value = { \"queueConnectionFactory\" })\n UserCredentialsConnectionFactoryAdapter getUserCredentialsConnectionFactoryAdapter(\n MQQueueConnectionFactory mqQueueConnectionFactory) {\n UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter = new UserCredentialsConnectionFactoryAdapter();\n userCredentialsConnectionFactoryAdapter.setUsername(userName);\n userCredentialsConnectionFactoryAdapter.setPassword(password);\n userCredentialsConnectionFactoryAdapter.setTargetConnectionFactory(mqQueueConnectionFactory);\n return userCredentialsConnectionFactoryAdapter;\n }\n\n @Bean (name=\"simpleMessageListenerContainer\")\n @DependsOn(value = { \"userCredentialsConnectionFactoryAdapter\" })\n public SimpleMessageListenerContainer queueResponseContainer(ConnectionFactory userCredentialsConnectionFactoryAdapter) {\n SimpleMessageListenerContainer simpleMessageListenerContainer = new SimpleMessageListenerContainer();\n simpleMessageListenerContainer.setConnectionFactory(userCredentialsConnectionFactoryAdapter);\n simpleMessageListenerContainer.setConnectLazily(true);\n simpleMessageListenerContainer.setDestinationName(responseQueue);\n simpleMessageListenerContainer.setMessageListener(responseListener);\n return simpleMessageListenerContainer;\n }\n\n @Bean\n public JmsOperations jmsOperations(ConnectionFactory userCredentialsConnectionFactoryAdapter) {\n JmsTemplate jmsTemplate = new JmsTemplate(userCredentialsConnectionFactoryAdapter);\n jmsTemplate.setReceiveTimeout(timeout);\n return jmsTemplate;\n }\n}\n\n====================\n\n@Component(value=\"responseListener\")\npublic class ResponseListener implements MessageListener {\n\n public void onMessage(Message message) { \n ...\n }\n}\n\n===================\n\n@Component\npublic class ContainerChecker {\n\n @Autowired\n SimpleMessageListenerContainer queueContainer;\n\n @Scheduled(fixedRate = 300000)\n public void reportContainerStatus() throws ServiceException{\n if(!queueContainer.isActive()) {\n ...\n } else {\n ...\n }\n }\n}### Assistant: Based on the updates in your comments:Your application is using the IBM MQ classes for JMS from IBM MQ v8.0.0.9Your application is connecting to a IBM MQ queue manager also running v8.0.0.9.The queue manager has CONNAUTH disabled [QMGR CONNAUTH('')]The queue manager has CHLAUTH disabled [`QMGR CHLAUTH(DISABLED)'].In your configuration you show the following bean:@Bean (name=\"userCredentialsConnectionFactoryAdapter\")\n@DependsOn(value = { \"queueConnectionFactory\" })\nUserCredentialsConnectionFactoryAdapter getUserCredentialsConnectionFactoryAdapter(\n MQQueueConnectionFactory mqQueueConnectionFactory) {\n UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter = new UserCredentialsConnectionFactoryAdapter();\n userCredentialsConnectionFactoryAdapter.setUsername(userName);\n userCredentialsConnectionFactoryAdapter.setPassword(password);\n userCredentialsConnectionFactoryAdapter.setTargetConnectionFactory(mqQueueConnectionFactory);\n return userCredentialsConnectionFactoryAdapter;\n}You also have the following commented out code:/*\n mqQueueConnectionFactory.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true);\n mqQueueConnectionFactory.setStringProperty(WMQConstants.USERID, userName);\n mqQueueConnectionFactory.setStringProperty(WMQConstants.PASSWORD, password);\n mqQueueConnectionFactory.setStringProperty(CMQC.USER_ID_PROPERTY, userName);\n mqQueueConnectionFactory.setStringProperty(CMQC.PASSWORD_PROPERTY, password);\n */With IBM MQ classes for JMS v8.0 and later the default for the settingWMQConstants.USER_AUTHENTICATION_MQCSPisFALSE. This denotes that the client should work in compatibility mode, this means the MQ client works as it did in version 7.5 and lower, MQCSP did not exist in those older versions and the username and password specified were sent in some fields calledRemoteUserIdentifierandRemotePasswordand were limited to 12 characters.With MQ v8 and higher the IBM MQ classes for JMS now support a new way to send the username and password, this is the MQCSP struction. This has some benefits for example it can passwords that are longer than 12 characters. IfWMQConstants.USER_AUTHENTICATION_MQCSPisTRUEthe username and password specified will be sent in the MQCSP structure and theRemoteUserIdentifierthat is used in compatibility mode is instead filled in with the username the process is running under and theRemotePasswordfield is left blank.I can't find anything that leads me to believe that theuserCredentialsConnectionFactoryAdapterbean does anything with theWMQConstants.USER_AUTHENTICATION_MQCSPsetting so this would lead me to believe it should be sending the username and password you specified in the fields calledRemoteUserIdentifierandRemotePassword. If you used the commented out code instead it would send the username and password you specified in the MQCSP and your windows login id that is running the process would be sent in theRemoteUserIdentifierfield.A queue manager at v8 with the configuration you have specified will completely disregard anything in the MQCSP structure and will only look at theRemoteUserIdentifierfield. You also said CHLAUTH is DISABLED, so this means that there are no CHLAUTH rules in place that would restrict or change the username that the client sends. If theSVRCONNchannel has a blank MCAUSER, then the userid sent in theRemoteUserIdentifierfield will be used for queue authorization checks.I suspect that when you noted your \"windows login credential\" coming across to the queue manager it was when you hadWMQConstants.USER_AUTHENTICATION_MQCSPset toTRUE. By setting this toFALSEyou can specify any ID you want to be sent to MQ and because of the configuration of the queue manager it will accept that ID and use it, the password is not verified.Since the password is not checked by MQ it does not matter what value if any you specify for the password, the following would be able to connect sending the specified username.mqQueueConnectionFactory.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, FALSE);\nmqQueueConnectionFactory.setStringProperty(WMQConstants.USERID, userName);Notes about the queue manager setupBecause CONNAUTH is not configured and CHLAUTH is also DISABLED you can connect to the queue manager and specify themqmid (if the queue manager is on Unix) or theMUSR_MQADMINid (if the queue manager is on Windows) and you would have full MQ authority over all queues on the queue manager.The current configuration provides no security to prevent anyone that has access connect over the network to the queue manager's host and port from accessing any resources the queue manager has available, in most cases this could also be leveraged to execute anything you want on the server where the queue manager runs.\n"}
+{"text": "### Human: I want to stream data from IBM MQ. I have tried outthis codeI found on Github.I am able to stream data from the Queue but each time it streams, it takes all the data from it. I just want to take the current data that is pushed into the queue. I looked up on many sites but didn't find the correct solution.In Kafka we had something likeKafkaStreamUtilsfor streaming the near-real-time data. Is there anything similar to that in IBM MQ so that it streams only the latest data?### Assistant: The sample in the link you provided shows that it calls the following method to recieve from the the IBM MQ:CustomMQReciever(String host , int port, String qm, String channel, String qn)If you review CustomMQRecieverhereyou can see that it is only Browsing the messages from the queue. This means the message will still be on the queue and the next time you connect you will receive the same messages:MQQueueBrowser browser = (MQQueueBrowser) qSession.createBrowser(queue);If you wanted to remove the messages from the queue you would need to call a method that does consume them from the queue instead of browsing them from the queue. Below is an example of changes toCustomMQReciever.javathat should accomplish what you want:Under theinitConnection()change the above code to the following to cause it to remove the messages from the queue:MQMessageConsumer consumer = (MQMessageConsumer) qSession.createConsumer(queue);Get rid of:enumeration= browser.getEnumeration();Underreceive()change the following:while (!isStopped() && enumeration.hasMoreElements() )\n {\n\n receivedMessage= (JMSMessage) enumeration.nextElement();\n String userInput = convertStreamToString(receivedMessage);\n //System.out.println(\"Received data :'\" + userInput + \"'\");\n store(userInput);\n }To something like this:while (!isStopped() && (receivedMessage = consumer.receiveNoWait()) != null))\n {\n String userInput = convertStreamToString(receivedMessage);\n //System.out.println(\"Received data :'\" + userInput + \"'\");\n store(userInput);\n }\n"}
+{"text": "### Human: I am a java developer. I have created the Queue connection factories and Queues in WAS 8.0.0.10 in order to connect to IBM MQ. I want to test the timeout scenario, hence, i purposely shut down the IBM MQ. It took about 2-3 minutes to get the expected timeout result. I want to decrease the value of timeout, however, i could not find any configuration in there.May i know is there possible to configure the timeout value? Because i try out almost all the timeout configuration, but none of them helps. Thank you.### Assistant: It depends on which TIMEOUT you are trying to configure.The TCP Connection Timeout for an initial connection can be configured by setting theConnect_Timeoutvalue to the number of seconds you want the connection to wait for an initial TCP connection. This would apply for instance if the server was down, or a network connection to the server was down. If the server was up and reachable over the network and only the MQ listener (or all of MQ) was shutdown then the response from the server to a connection to the MQ listener port would be an immediate \"Connection refused\" and you would never hit the TCP Connection Timeout.You can setConnect_Timeoutin various ways, two of which are:mqclient.ini file (seeLocation of the client configuration file) in the TCP stanza, for example:TCP:\n Connect_Timeout=30Passing a java system property equivalent to the above, for example:-Dcom.ibm.mq.cfg.TCP.Connect_Timeout=30If you are looking for how to set the timeout of a existing connection to MQ there are a few things to note:IBM MQ clients/queue managers by default send heartbeat messages when a channel is idle. TheHBINTof theSVRCONNchannel will define the interval in seconds at which a heart beat message is sent if no other traffic has passed over the channel for JMS MQ clients.Normally the client should always initiate the HB and the queue manager will respond. If the queue manager does not receive a HB request inHBINT+5 seconds it will initiate a HB to the client and expect a response.The timeout is based upon 2*HBINTforHBINT's of less than 60 seconds andHBINT+ 60 forHBINT's of over 60 seconds. The defaultHBINTon aSVRCONNis 300 so the TIMEOUT of a MQ connection to a channel with the defaultHBINTwould be 360 seconds. You mention 2 - 3 minutes I suspect if you timed it on a watch it would be 6 minutes.If you wanted to set the timeout to 30 seconds then you would alter theSVRCONNchannelsHBINTto 15 seconds, for example:ALTER CHL(CHL.NAME) CHLTYPE(SVRCONN) HBINT(15)Note that the value only takes effect the next time you make a client connection to the channel, it would not impact the HBINT of already running channels.Additional note that when connecting to MQ queue managers v6 or older, client HB messages are only sent when the client is in a GET with WAIT operation, not at other times.\n"}
+{"text": "### Human: I'm losing my ever-loving mind over this one.I'm trying to output a list of local queues with their current depth and maximum depth. The following command basically does the job:display qlocal(*) curdepth maxdepthHowever, I'm getting all the SYSTEM.* queues and I don't want them in the list. Theoretically I can use the where( ) filter to do this, but it seems like this most useful function is just not possible because...display qlocal(*) where(???? nl 'SYSTEM*') curdepth maxdepth...what do I put for ???? I've tried all sorts including the seemingly obvious 'queue' but nothing works. Am I stuck with separately processing the output (a chore at the best of times due to its horrid formatting) to rid myself of these?### Assistant: The command below might help. As you can't filter using the queue name in the 'where' parameter, the best solution would be to parse the output. The below command basically formats the mqsc object output to single lines and the egrep removes everything that starts with SYSTEM.echo \"dis ql(*) curdepth maxdepth\" | runmqsc QMNAME | sed 's/^[^ ].*$/%/g' | tr -s \" \" | tr -d \"\\n\" | tr \"%\" \"\\n\" | egrep -v \"^ QUEUE\\(SYSTEM\"\n"}
+{"text": "### Human: I'm building a program which will start listening to an IBM queue. And for this I'm using the IBM.XMS.dll which came with the Websphere MQ Client installation for Windows. I'm asking myself, when I deploy this to acceptance or production, then probably I have to install the Websphere MQ Client also on that machine?And my other question is, do I have to reference the IBM.XMS.dll like this:C:\\Program Files\\IBM\\WebSphere MQ\\bin\\IBM.XMS.dll? I tried with just putting the IBM.XMS.dll in my build folder of my .NET solution but that doesn't work because the dll has dependencies to other dll's.EDITAfter looking at samples, I've seen that the samples written by IBM are referencing the dlls in the GAC. So I did the same.pressCtrl+RTypeC:\\WINDOWS\\assembly\\GAC_MSIL\\IBM.XMSPressEnterFind the IBM.XMS.dll and reference this one in your solution### Assistant: After looking at samples, I've seen that the samples written by IBM are referencing the dlls in the GAC. So I did the same.pressCtrl+RTypeC:\\WINDOWS\\assembly\\GAC_MSIL\\IBM.XMSPressEnterFind the IBM.XMS.dll and reference this one in your solution\n"}
+{"text": "### Human: I've an issue with one of our applications. The application is a self-writen Java application that connects through JMS to more than 50 different message queues and consumes messages from those queues.From a functional perspective the processing of all messages from the different queues works fine. However while testing we found out that the processing of the different messages is far to slow. We are only able to process a few messages per queue per minute.To better understand what is going on I've made with JMC a flightrecording and saw that there is a lot of blocking time for each thread that consumes messages from a message queue:Picture: Blocking JMS threadsBeside this graph I saw also in the flight recording that a lot of time is spent with accesing a specific WeakHashMap to close and get and XAResource.Picture: Lock instancesThe next step what I did was analysing how the JMS bitronix configuration looks like. Here are the relevant parts:On the Tomcat server-level I've got the resource.properties file that is loaded by bitronix:resource.cf1.className=com.ibm.mq.jms.MQXAQueueConnectionFactory\nresource.cf1.uniqueName=jms/cf\nresource.cf1.minPoolSize=1\nresource.cf1.maxPoolSize=60\nresource.cf1.driverProperties.hostName=genadev0059.mycompnany.com\nresource.cf1.driverProperties.port=1515\nresource.cf1.driverProperties.channel=APPL_CHL\nresource.cf1.driverProperties.transportType=1\nresource.cf1.driverProperties.queueManager=DEVInside of Spring application XML I have the following bean definitions to settup the connection:\n\n\n\n \n\nAdditional to this one, I've for each message queue and own class that processes messages from this queue:\n \n \n \n \nI assume that the error is related to the way how the connection is configured. I tried different other approaches, but the result of the blocking threads is always the same.Any inputs or suggestions are highly welcomed.### Assistant: How many \"actual\" connections is there on the queue manager side? You should be using 1 connection per thread. If you share a connection between the threads then that is why you see the blocking.\n"}
+{"text": "### Human: I am trying to implement Customer receiver for WSMQ data source in Spark streaming. I followed the example providedhere.Later I followed example atthis Github repository.I am getting three issues:1: Error (This error comes after the program runs for some time)java.net.ConnectException: Connection refused\n at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)\n at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)\n at org.apache.kafka.common.network.Selector.poll(Selector.java:238)\n at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:192)\n at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:191)\n at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:122)\n at java.lang.Thread.run(Thread.java:745)The program doesn't remove the messages from WSMQ even though I used this code while creating the sessionMQQueueSession qSession = (MQQueueSession) qCon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);I need to implement a reliableReceiverexplained at Custom Receiver Spark API. It says:To implement a reliable receiver, you have to use store(multiple-records) to store data. This flavour of store is a blocking call which returns only after all the given records have been stored inside Spark. If the receiver\u2019s configured storage level uses replication (enabled by default), then this call returns after replication has completed. Thus it ensures that the data is reliably stored, and the receiver can now acknowledge the source appropriately. This ensures that no data is caused when the receiver fails in the middle of replicating data \u2013 the buffered data will not be acknowledged and hence will be later resent by the source.I don't know what to do about store(multiple-records)?I can't figure out why these errors are happening and how I can implement a reliableReceiver.Here is the code:public class JavaConnector extends Receiver {\n\n String host = null;\n int port = -1;\n String qm=null;\n String qn=null;\n String channel=null;\n transient Gson gson=new Gson();\n transient MQQueueConnection qCon= null;\n String topic=null;\n\n Enumeration enumeration =null;\n private static MQQueueReceiver receiver = null;\n\n\n public JavaConnector(String host , int port, String qm, String channel, String qn) {\n super(StorageLevel.MEMORY_ONLY_2());\n this.host = host;\n this.port = port;\n this.qm=qm;\n this.qn=qn;\n this.channel=channel;\n\n\n }\n\n public void onStart() {\n // Start the thread that receives data over a connection\n new Thread() {\n @Override public void run() {\n try {\n initConnection();\n receive();\n }\n catch (JMSException ex)\n {\n ex.printStackTrace();\n }\n catch (Exception ex)\n {\n ex.printStackTrace();\n }\n }\n }.start();\n }\n\n public void onStop() {\n\n // There is nothing much to do as the thread calling receive()\n // is designed to stop by itself isStopped() returns false\n\n }\n\n /** Create a MQ connection and receive data until receiver is stopped */\n private void receive() throws InterruptedException {\n System.out.print(\"Started receiving messages from MQ\");\n\n\n try {\n\n JMSTextMessage receivedMessage= null;\n int cnt =0;\n\n //JMSTextMessage receivedMessage = (JMSTextMessage) receiver.receive(10000);\n\n boolean flag=false;\n while (!isStopped() && enumeration.hasMoreElements()&&cnt<50 )\n {\n\n receivedMessage= (JMSTextMessage) enumeration.nextElement();\n receivedMessage.acknowledge();\n String userInput = receivedMessage.getText();\n\n ArrayList list = new ArrayList();\n list.add(userInput);\n Iterator itr = list.iterator();\n store(itr);\n cnt++;\n\n }\n /*while (!isStopped() && receivedMessage !=null)\n {\n\n // receivedMessage= (JMSTextMessage) enumeration.nextElement();\n String userInput = receivedMessage.getText();\n\n store(userInput);\n receivedMessage.acknowledge();\n\n }*/\n\n // Restart in an attempt to connect again when server is active again\n //restart(\"Trying to connect again\");\n\n stop(\"No More Messages To read !\");\n qCon.close();\n System.out.println(\"Queue Connection is Closed\");\n\n }\n catch(Exception e)\n { Thread.sleep(100);\n System.out.println(\"WRONG\"+e.toString());\n e.printStackTrace();\n restart(\"Trying to connect again\");\n }\n catch(Throwable t) {\n Thread.sleep(100);\n System.out.println(\"WRONG-1\"+t.toString());\n // restart if there is any other error\n restart(\"Error receiving data\", t);\n }\n\n\n\n }\n\n public void initConnection() throws JMSException,InterruptedException {\n try {\n MQQueueConnectionFactory conFactory = new MQQueueConnectionFactory();\n conFactory.setHostName(host);\n conFactory.setPort(port);\n conFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);\n conFactory.setQueueManager(qm);\n conFactory.setChannel(channel);\n conFactory.setMsgBatchSize(100);\n\n\n qCon = (MQQueueConnection) conFactory.createQueueConnection();\n MQQueueSession qSession = (MQQueueSession) qCon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n MQQueue queue = (MQQueue) qSession.createQueue(qn);\n MQQueueBrowser browser = (MQQueueBrowser) qSession.createBrowser(queue);\n qCon.start();\n //receiver = (MQQueueReceiver) qSession.createReceiver(queue);\n enumeration= browser.getEnumeration();\n\n\n } catch (Exception e) {\n Thread.sleep(1000);\n }\n }\n\n @Override\n public StorageLevel storageLevel() {\n return StorageLevel.MEMORY_ONLY_2();\n }### Assistant: Finally I was able to solve this.\nSolution 1: The steaming context tries to write into Kafka, since kafka was down and It was giving me IO error. That was foolish of me. :)Solution 2: I was supposed to use MessageListener, QueueBrowser is used for reading the messages it doesn't consume the message actually.\n"}
+{"text": "### Human: I am using MQ PCF command in Java to create MQ queues and updating their parameters. Following is the code I am using.PCFMessageAgent agent = new PCFMessageAgent(queueManager);\nagent.setCheckResponses(false);\nPCFMessage[] responses;\nPCFMessage request = new PCFMessage(MQConstants.MQCMD_CHANGE_Q);\nresponses = agent.send(request);I am setting the following attributes on the requestMQCA_Q_NAME=TestTQ1\nMQIA_BACKOUT_THRESHOLD=0\nMQIA_MAX_MSG_LENGTH=4194304\nMQIA_MAX_Q_DEPTH=500\nMQIA_Q_TYPE=1and I get the following response\nCompletion Code = 2\nReason Code = 3014Documentation says that this is due toParameter identifier is not valid.\nThe MQCFIN or MQCFIN64 Parameter field value was not valid.The question is how do I know which parameter is incorrect?### Assistant: The first PCFMessage in responses should have one PCFParamter, which should be a MQCFIN, whose type is MQIACF_PARAMETER_ID and whose value will contain the ID of the attribute that the error is on.int errParamId = responses[0].getIntParameterValue(MQC.MQIACF_PARAMETER_ID);\n"}
+{"text": "### Human: Hey so I have a queue of messages which need sequential processing. Now this processing involves calling a Web service (which might be down sometimes) so I have to make the message retrieval transactional. As far as I know, when there's any exception midway, the whole transaction rolls back and the message isn't lost right?But what's also needed is high availability on the message consumer, so I have two instances of the listener listening in on my queue. Now will the transaction ensure that a second message isn't retrieved by the other instance of the listener until the first one is completely done processing the first message? Or will I have to do something more to make sure that no message is sent out of the queue until the one before that is fully done processing.If any additional configuration is needed, would it be in the MQ or on the listener?I'm using websphere mq as the message broker and spring integration for retrieving the messages. Thanks for the help.EDIT:With the token thing the first concern would be high availability on the queue manager itself. The queue which holds this token has to be part of some queue manager. Now if we have a failover, that control queue will no longer be accessible. Which kinda means that that we need another control queue ready in case of a failover.We can't have listeners listening in on that DR control queue during normal operations though. (Let's say we have a mechanism to actually make sure that the \"data\" queue is perfectly replicated). The listener instances should know that a failover has initiated so that it can stop listening to the control queue during normal ops and switch over to the secondary. I can't do this using the listener instance alone. The actual producer which puts messages into the queue will have to notify the listener instances to stop listening to the normal ops control queue and switch over to the secondary. This would be kinda tricky if there's any intermediate connection problem (and the normal ops queue manager isn't really down) but that's too much of a corner case.With high availability of the control queue taken care of, we kinda have the same problem as the non sharable during low load scenarios. Now we have occasional spikes in load but there are slump periods. (During the night and stuff). This token system is not really reactive right? It's more of periodic thing. So let's say we don't get any messages for a few hours. The listeners will still be constantly checking the queue coz the token message keeps triggering one instance after another. Which more or less makes it a poller really. I might as well have multiple listener instances each polling at like different times of the hour right? It's not really event driven per se.Third would really be the question of inserting the token message. During first install or during a failback, we'll have that extra manual step of manually inserting this token (since the token would be lost in failover sometimes) . We can't really make one of the listener instances do it since if a listener instance doesn't find the message it kinda means that some other listener instance has the token. So this logic has to be separate. And if we actually put some meaningful info into this token message, it has to be a utility that has to be triggered rather than an insertion through the UI.I guess the first and third aren't really problems, but just extra overhead which wouldn't be needed if we went for a poller implementation. The second one is what's bothering me most.### Assistant: You need to be passing tokens. Here's how that works:First, create a second queue and place a single message into it. Now start up each program with the following logic.Get the token message off the token queue under syncpoint using an unlimited or long wait interval and theFAIL_IF_QUIESCINGoption.Put the token message back on the token queue in the same UOW.Get the next message off of the application queue under the same UOW.Process the application's message normally.Commit the UOW.You can use as many app instances as you want. You will see one input handle on each of the two queues for each app instance. No app instance will have to handle errors due to exclusive use of a queue.Since there is only one token message and only one app can hold it under syncpoint at a time, only one of the apps can be actively processing an application message. Since theGEToff the app queue is dependent on a successfulGEToff the token queue, all application messages are processed in strict sequence.Note: The app will process the application messages with as many concurrent threads as there are token messages on the token queue. If anyone ever adds another token message to the token queue, strict sequence processing is lost. For this reason read/write access to that queue must NOT be granted to anyone other than the app service account. Also, it is common for that token message to be structured so that the app can recognize it. If a stray unrelated message lands there the app should ignore it and throw a warning.You will see a fairly even distribution of messages between the two apps. If you use more than two apps you might see a wildlyuneven distribution because queue handles are managed in a stack. As an instance commits its UOW the next instance's handle is at the top of the stack so it gets the next message. While it is handling that message the instance that just committed will have it'sGETplaced on top of the stack. If you have 3 or more listening instances chances are only the first two will see any traffic.This assures that messages are processed off the queue one at a time. It doesnotassure that you won't get dupes.If you do everything under syncpoint, no messages will ever be lost. However there's a scenario in which a message is retrieved and processed, then theCOMMITcall fails. In that case the transaction is rolled back and the same message becomes available again. If you are using 1-phase commits and not XA the processing for that message will not be rolled back.The nice thing is that the token message will be under syncpoint too and that fixes the issue in which an orphaned client channel takes a while to release the transaction. A new connection will get messages which are older than the message held under syncpoint by the orphan transaction. Eventually the channel agent times out releasing the message back to the queue but effectively changing its position to bebehindany messages that were processed while it was sequestered.In this scenario the token message is also sequestered so after this type of connection loss message processing temporarily stops and waits for the channel agent to time out. If that were ever to happen, just issue aSTOP CHANNELcommand on the instance with the UOW.Update based on additional question details specific to this answerThe queue which holds this token has to be part of some queue manager.\n Now if we have a failover, that control queue will no longer be\n accessible. Which kinda means that that we need another control queue\n ready in case of a failover.The token queue is as available or as unavailable as the application queue. Only one is needed. If the app requires HA then a Multi-Instance QMgr or a hardware HA cluster should be used. These share disk so the QMgr that comes up in the failover is the same one the app has been connected to, just at a different physical location.If the app needs DR it's possible to replicate the disk under the QMgr's logs and data directories to a DR site. However, nothing should be listening on those instances while processing is going on in the primary data center.The listener instances should know that a failover has initiated so\n that it can stop listening to the control queue during normal ops and\n switch over to the secondary. I can't do this using the listener\n instance alone.Why not? WMQ has had reconnectable clients for a really long time and the multi-instance features in v7.0.1 made reconnecting drop-dead simple. As an admin your job is to make sure that no more than one instance of the app and token (not trigger!) queue are available. During an outage, the client goes into retry without requiring any application code to drive it. It finds whichever of the instances is up and connects.The actual producer which puts messages into the queue will have to\n notify the listener instances to stop listening to the normal ops\n control queue and switch over to the secondary.The question was about serialization with concurrent consumers. This is about a design in which producers and consumers have to rendezvous at a common location. Different problem that happens to overlap this one only in that it is complicated somewhat by serialization. Ask a different question if you need to explore topologies.This token system is not really\n reactive right? It's more of periodic thing. So let's say we don't get\n any messages for a few hours. The listeners will still be constantly\n checking the queue coz the token message keeps triggering one instance\n after another.This does not use triggering. It uses a token (not trigger!) message the way a filesystem or database uses a lock in order to facilitate serialization. Whichever listener gets the token message then does a get with unlimited wait on the application queue. The other listeners have a get with unlimited wait on the token (not trigger!) queue. Basically, they sit around idle until a message arrives. Zero reconnections, zero polls, zero CPU cycles. If you need to know they are alive, let them time out on the application queue once in a while. This rolls back their UOW on the token queue which passes the token to another listener.Third would really be the question of inserting the token message.\n During first install or during a failback, we'll have that extra\n manual step of manually inserting this token (since the token would be\n lost in failover sometimes).Why? Do you experience MQ losing persistent messages under syncpoint often? If so you are doing it wrong. ;-) In a situation with strict serialization requirements there can be only one active instance of a queue. If for some reason there are other instances of the application queue pre-defined other than through disk replication there would be one instance of the token (not trigger!) queue also predefined alongside it and one token (not trigger!) message waiting in each queue. Surely nobody would do such a thing in the face of strict message order requirements, but if they did those queues would surely be get-disabled while not in use.We can't really make one of the listener\n instances do it since if a listener instance doesn't find the message\n it kinda means that some other listener instance has the token.Correct. The listenerscouldcheck queue depth, transactions, input handles, etc, but it is generally wise to avoid mixing application logic with control logic.So\n this logic has to be separate. And if we actually put some meaningful\n info into this token message, it has to be a utility that has to be\n triggered rather than an insertion through the UI.Why? Your coders handle structured data in app messages, right? If this is perceived to be significantly more difficult, someone's doing it wrong. ;-) Write an instance of a formatted token (not trigger!) message to a queue, then offload that to a file. When you need to reinitialize the queue, use Q or QLoad to first clear the queue, then load the file into it.Thatutility would be the one to open the queue for exclusive use, check for depth, check for handles, etc. prior to performing its magic. When I do this for consulting clients I typically define a service that initializes the queue on MQ startupandalso provide a feature in the application GUI for the operations and support staff. So long as the app managing the token (not trigger) queue gets it for exclusive access during these operations it really doesn't matter how it's done or by how many instances of the control app.As a rule I also use the structure in the message to send commands to the listeners. There's the real token message, and then there's messages that command the app instances to do things. For example, it's really nice to have a non-transactional \"ping\" capability. I if I drop more ping messages on the token (not trigger!) queue in a single UOW than I have app instances listening, I am guaranteed to contact all of them. In this way I can detect zombies. Depending on how much instrumentation is required the listeners can react to the ping by providing a status (uptime, messages processed, etc.) in the log, to the console, to an event queue, etc.I guess the first and third aren't really problems, but just extra\n overhead which wouldn't be needed if we went for a poller\n implementation.That's good because this is all pretty standard stuff. The problem lies mainly with the requirements for serialization conflicting with those for HA/DR. What you are looking for is global transactional atomicity to implement a single logical queue across multiple physical locations. IBM MQ has never attempted to provide that, although the WAS Messaging Engine has. The closest MQ comes is to use two MQ appliances with memory-to-memory replication of message and transaction data but that is good to only a few miles before light-speed latency begins to significantly impact throughput. It doesn't handle your DR needs. In fact,nothingshort of synchronous replication does that if you want a zero recovery point at the DR datacenter.\n"}
+{"text": "### Human: I need PyMQI on my windows 86x. \nI try to build setup.py with msvc as compiler \nBut when i try to do it I get the following errors:C:\\Python27\\Lib\\pymqi-1.5.4>python setup.py build client\nBuilding PyMQI client 32bits\nrunning build\nrunning build_py\nrunning build_ext\nbuilding 'pymqi.pymqe' extension\nC:\\Users\\Admin\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe /c /nologo /Ox /MD\n /W3 /GS- /DNDEBUG -DPYQMI_SERVERBUILD=0 \"-Ic:\\Program Files\\IBM\\WebSphere MQ\\tools\\c\\include\" -IC:\\Python27\\include -IC\n:\\Python27\\PC /Tcpymqi/pymqe.c /Fobuild\\temp.win32-2.7\\Release\\pymqi/pymqe.obj\npymqe.c\npymqi/pymqe.c(240) : error C2275: 'MQCSP' : illegal use of this type as an expression\n c:\\Program Files\\IBM\\WebSphere MQ\\tools\\c\\include\\cmqc.h(4001) : see declaration of 'MQCSP'\npymqi/pymqe.c(240) : error C2146: syntax error : missing ';' before identifier 'csp'\npymqi/pymqe.c(240) : error C2065: 'csp' : undeclared identifier\npymqi/pymqe.c(240) : error C2059: syntax error : '{'\npymqi/pymqe.c(247) : error C2065: 'csp' : undeclared identifier\npymqi/pymqe.c(247) : error C2224: left of '.AuthenticationType' must have struct/union type\npymqi/pymqe.c(248) : error C2065: 'csp' : undeclared identifier\npymqi/pymqe.c(248) : error C2224: left of '.CSPUserIdPtr' must have struct/union type\npymqi/pymqe.c(249) : error C2065: 'csp' : undeclared identifier\npymqi/pymqe.c(249) : error C2224: left of '.CSPUserIdLength' must have struct/union type\npymqi/pymqe.c(250) : error C2065: 'csp' : undeclared identifier\npymqi/pymqe.c(250) : error C2224: left of '.CSPPasswordPtr' must have struct/union type\npymqi/pymqe.c(251) : error C2065: 'csp' : undeclared identifier\npymqi/pymqe.c(251) : error C2224: left of '.CSPPasswordLength' must have struct/union type\npymqi/pymqe.c(256) : error C2065: 'csp' : undeclared identifier\npymqi/pymqe.c(256) : warning C4133: '=' : incompatible types - from 'int *' to 'PMQCSP'\nerror: command 'C:\\\\Users\\\\Admin\\\\AppData\\\\Local\\\\Programs\\\\Common\\\\Microsoft\\\\Visual C++ for Python\\\\9.0\\\\VC\\\\Bi\nn\\\\cl.exe' failed with exit status 2### Assistant: There is a solution on this page:https://github.com/dsuch/pymqi/issues/35First inpymqi/pymqe.cfile the declaration lineMQCSP csp = {MQCSP_DEFAULT};should be moved to the beginning of methodpymqe_MQCONNX, right after:PyObject* user_password = NULL;After doing this the build and installation succeed butimport pymqigives an error:ImportError: No module named pymqeThis can be fixed by copyingpymqe.pydfrom the path\\pymqi-1.5.4\\build\\lib.win32-2.7\\pymqi, topymqi-1.5.4\\pymqi\n"}
+{"text": "### Human: I'm trying to configureHermesJMS v1.14withWebSphereMQ v8.0, but I can not. I've seen several tutorials, and I've followed them, although none were exactly these versions.This is what I've done. I've downloaded this trial versionMQ V8.0 Trial for Multiplatform Multilingual eAssembly. I've installed it following these instructionshttp://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.ins.doc/q008640_.htm?lang=en.Then, I open HermesJMS and set the provider like first part of demo_mq.html (outdated link removed), but the libraries are:com.ibm.mq.commonservices.jarcom.ibm.mq.jarcom.ibm.mqjms.jarcom.ibm.mq.pcf.jarThen I click onScan, this is important, because this step is supposed to load all the classes of the jars, which we have to use later.Then I create the session, using the Loader I've just configured and, when you change the Loader, the combo with the Classes should refresh with the Connection Factories, in particular I have to usecom.ibm.mq.jms.MQQueueConnectionFactory, but it doesn't appear, seems like the previous step of scanning doesn't work.I've looked into the jars, and I know the classMQQueueConnectionFactoryis insidecom.ibm.mq.jar.So, is there any step I forgot? Do I need other libraries?Don't hesitate to ask for more information.Thanks in advance.UPDATE:Adding more information based on T.Rob answerYou didn't mention having applied the Fix Pack. There are a number of Java fixes in 8.0.0.1-3 that might make your setup more interesting and which you'd want to avoid.Yes, I used it, I forgot mention that, sorry.The same page also explains that the setmqjmsenv program can be used to set up the environmentI didn't mention this, I usedsetmqenvto configurePATHenvironment variable.SOLUTION to this 1st problem:I already solved it, but I think there is no \"procedure\" to do that, I found this in this webhttp://talksoa.blogspot.com.es/2013/12/configure-hermes-jms-to-connect.htmlWait, found a solution. You must first select the classpath group name, in the case above its WMQ7, from the drop down in the middle pane next to the 'Loader:' Then go back up to the first pane and select IBM WebSphereMQ under pluginI did something like this and voila! The class appears. Now I'm trying to configure the properties:Plug In: IBM WebSphereMQConnection Factory: Class -> com.ibm.mq.jms.MQQueueConnectionFactoryProperty: hostName ->Property: port -> (I had to change the default port 1414)Property: queueManager -> MY.QUEUE.MANAGERProperty: transportType -> 1And, when I doRight button->DiscoverI get the following error:ERROR hermes.browser.tasks.HermesBrowserTaskListener - MQJE001: Completion Code '2', Reason '2035'.I've looking for this error and it seems to be an authority error, so I've done:setmqaut -m MY.QUEUE.MANAGER -t qmgr -g +allmyUseris a user which I added tomqmgroup.Hope you can help me.Thanks.### Assistant: Then, I open HermesJMS and set the provider like first part ofhttp://www.hermesjms.com/demos/demo_mq.html, but the libraries are...You might want to try using IBM's specification for theCLASSPATHas found in the same documentation manual that you linked above. Their pageEnvironment variables used by IBM MQ classes for JMSexplains that you need only include one jar in theCLASSPATHand the manifest pulls in the others.The same page also explains that thesetmqjmsenvprogram can be used to set up the environment. You can run that, then capture the environment variable settings and arrange for Hermes to inherit them through explicit settings or through the service ID used to launch it.Also, be sure to use the IBM-provided tools to validate that the client has been properly installed and that you can connect to MQ using a known-good piece of software. It would be unfortunate to struggle away with Hermes for a week only to find out the MQ listener is on a different port or that you spelled the channel name wrong.You didn't mention having applied the Fix Pack. There are a number of Java fixes in 8.0.0.1-3 that might make your setup more interesting and which you'd want to avoid.I've downloaded this trial versionMQ V8.0 Trial for Multiplatform Multilingual eAssembly...If you go to thewebsphere-mqtag wiki, you will find links to MQ Advanced for Developers. It's a full-function, non-expiring, version of MQ you can have for free. The trial download will eventually expire. Hopefully not before you get Hermes talking to it, but it will expire and usually at the most inopportune moment.There too will be some links to the Fix Packs, but you can also easily (yes, that's debatable) find these by going to IBM Fix Central and searching.\n"}
+{"text": "### Human: My requirement is to read a csv and send multiple xml messages to IBM mq.The xmls created from csv are to be sent in a single batch or transaction.\nReason being the system reading these messages is not idempotent, and in case some xml messages are sent across and the remaining fail. I need to persist the failed xml messages for manual re-processing.Would be great if someone can point me a feature where multiple xml messages can be en-queued as a single batch.### Assistant: You seem to have conflicting requirements.Sending the messages in a batch is easy. You put them all under syncpoint, then issueCOMMIT. As long as there are not more messages than the queue depth or transaction UOW limits can hold, you are fine.Receiving them in a batch is another matter altogether. IBM MQ has message grouping and theBIND_ON_OPENparameter to make sure all affiliated messages go to the same place and can be accounted for.So far, this is all easy and based on options in the basic MQ API or JMS API. The greater issue I see is the statement that \"the system reading these messages is not idempotent\" which is a fancy way of saying that it does not detect and gracefully handle dupe messages. That's kind of a problem with any async messaging transport unless XA is used. It must either gracefully handle dupe messages or use a transaction coordinator to ensure there are no dupe messages. I'll assume for the moment that you are using 2-phase commit so this requirement is being met.The other potential issue arises from \"I need to persist the failed xml messages for manual re-processing.\" Not sure what \"manual reprocessing\" means here. IBM MQ will persist the messages, just mark it as such when youPUTit on the queue. When the QMgr is restored the messages will be delivered. However this statement seems to hint at a High Availability or Disaster Recovery requirement such that the messages are replicated.So the short answer is to choose persistence as message property when putting the message and to do so under 2-phase commit.The longer answer depends on what the references to idempotence and recovery actually allude to. If there are requirements here you'll need to add detail to the question.\n"}
+{"text": "### Human: Hello i am new to IBM WebSphere MQ File Transfer Edition and i have this question:First i need to explain the situation: I have an Agent declared and i want to create a Transfer to run every minute in a folder, and it will delete the source file.I want to know what happen when a transference is running and another minute pass. Will the Agent start a new Transference? If it creates a new , will it try to send again the files that are in the first Transference if they are still in the folder? or the Agent is going to wait until it finish the first transference and start the new one?Thanks for your help in advance!### Assistant: [\nUPDATED/CORRECTION:\n- Previously I stated that a scheduled transfer will not wait before starting a new instance, however this is incorrect. Testing I have performed has shown that a scheduled transfer will indeed not start a new instance of the transfer if a previously instance has not completed. Sorry for any confusion!\n]If you are using a \"scheduled transfer\":http://pic.dhe.ibm.com/infocenter/wmqfte/v7r0/topic/com.ibm.wmqfte.doc/create_schedule.htmthen the scheduled transfer willnotstart a new instance if a previous instance (transfer started by the scheduler) is already running. In this case, the WebSphere MQ FTE agent will instead publish a \"skipped\" audit message to the SYSTEM.FTE/LOG/ topic with the supplement:A previous instance of a repeating scheduled transfer (id:###...) is still running.However, I suggest you also look at Resource Monitoring as an alternative approach to scheduled transfers as it is a much more powerful feature.Read the following section of the WebSphere MQ FTE Infocenter about the topic and it should give you plenty of information to get going and try it out yourself:http://pic.dhe.ibm.com/infocenter/wmqfte/v7r0/topic/com.ibm.wmqfte.doc/resource_monitoring.htmI hope this helps you!\n"}
+{"text": "### Human: I saw lots of examples likehttp://hursleyonwmq.wordpress.com/2007/05/29/simplest-sample-applications-using-websphere-mq-jms/, even on IBM publib. As I guess this code had a flaw: Queue connection closed in main block, and not infinallyas I expected.What is the right way to close MQ connection without leaks?### Assistant: I think it is better to do it in finally.\ni.e.finally\n{\n try\n {\n session.close();\n }\n catch (Exception ex)\n {\n System.err.println(\"session.close() : \" + ex.getLocalizedMessage());\n }\n\n try\n {\n connection.close();\n }\n catch (Exception ex)\n {\n System.err.println(\"connection.close() : \" + ex.getLocalizedMessage());\n }\n}\n"}
+{"text": "### Human: I have a problem when i try to get message with put date/time beetween two dates (beginDate and endDate). Here is my query receiveSelected(\"JMSTimestamp BETWEEN \" + pBeginDate + \"AND \" + pEndDate). A message is in the queue and the timestamp is between the two values passed in argument. But nothing is returned by the query### Assistant: I've tried on a recent WMQ version and this works correctly; I've output the 10 messages, the timestamp and the message id. Then only got some of the messages.The correct ones are returned: have you confirmed the message is committed? and visible?You do mention 'date' - is the selector in the correct format..------------------------------------------------------------------------\n0:1389200177672 ID:414d5120514d5f76385f62696c626f20ff30cd5220008002\n1:1389200178874 ID:414d5120514d5f76385f62696c626f20ff30cd5220008003\n2:1389200180076 ID:414d5120514d5f76385f62696c626f20ff30cd5220008004\n3:1389200181277 ID:414d5120514d5f76385f62696c626f20ff30cd5220008005\n4:1389200182477 ID:414d5120514d5f76385f62696c626f20ff30cd5220008006\n5:1389200183677 ID:414d5120514d5f76385f62696c626f20ff30cd5220008007\n6:1389200184877 ID:414d5120514d5f76385f62696c626f20ff30cd5220008008\n7:1389200186078 ID:414d5120514d5f76385f62696c626f20ff30cd5220008009\n8:1389200187279 ID:414d5120514d5f76385f62696c626f20ff30cd522000800a\n9:1389200188479 ID:414d5120514d5f76385f62696c626f20ff30cd522000800b\n-------------------------------------------------------------------------------\nReceiving....\nSelector is : JMSTimestamp BETWEEN 1389200181277 AND 1389200186078\n--------------------------------\n1389200181277 ID:414d5120514d5f76385f62696c626f20ff30cd5220008005\n--------------------------------\n1389200182477 ID:414d5120514d5f76385f62696c626f20ff30cd5220008006\n--------------------------------\n1389200183677 ID:414d5120514d5f76385f62696c626f20ff30cd5220008007\n--------------------------------\n1389200184877 ID:414d5120514d5f76385f62696c626f20ff30cd5220008008\n--------------------------------\n1389200186078 ID:414d5120514d5f76385f62696c626f20ff30cd5220008009\n--------------------------------\n"}
+{"text": "### Human: I am working on a Notification Service using IBM MQ messaging provider with JBoss eap 6.1 environment. I am successfully able to send messages via MQ JCA provider rar i.e. wmq.jmsra.rar file. However on consumer part my current configuration looks like this@MessageDriven( \n activationConfig = { \n @ActivationConfigProperty(propertyName=\"destinationType\", propertyValue=\"javax.jms.Queue\"), \n @ActivationConfigProperty(propertyName=\"destination\", propertyValue=\"F2.QUEUE\"),\n @ActivationConfigProperty(propertyName=\"providerAdapterJNDI\", propertyValue=\"java:jboss/jms/TopicFactory\"),\n @ActivationConfigProperty(propertyName=\"queueManager\", propertyValue=\"TOPIC.MANAGER\"),\n @ActivationConfigProperty(propertyName=\"hostName\", propertyValue=\"10.239.217.242\"),\n @ActivationConfigProperty(propertyName=\"userName\", propertyValue=\"root\"),\n @ActivationConfigProperty(propertyName = \"channel\", propertyValue = \"TOPIC.CHANNEL\"),\n @ActivationConfigProperty(propertyName = \"port\", propertyValue = \"1422\") \n\n })My problem is that consumer of this service does not want to add any port numbers, hostName, queueManager properties in these beans. Also they do not want to use ejb-jar.xml to externalize these configs. I have researched and found that we can add a domain IBM Message Driven Bean but with no success. Any suggestions on what I can do here to externalize all these configurations ?EDIT: Adding --> The JCA resource adapter is deployed at consumer end if it makes it any easier.Thanks### Assistant: You can actually externalize an MDBs activation spec properties to the server configuration file.Create the ejb-jar.xml file, but do not put the actual value in the file, use a property placeholder:\n hostName\n ${wmq.host}\nDo this for all of the desired properties.Ensure that property replacement for Java EE spec files (ejb-jar.xml, in this case) is enabled in the server configuration file:\n trueThen, in the server configuration file, provide values for your properties:\n Once your MDBs are packaged, you will not need to change any of the files in the MDB jar - just provide the properties in the server configuration.\n"}
+{"text": "### Human: Following on from aprior questionwe have discovered some behaviour which I cannot understand with MQ channels.At startup, we issue the following commands:STRSBS SBSD(QMQM/QMQM)\nSTRMQM MQMNAME(IA001.QUEUE.MANAGER)\nSTRMQMCSVR MQMNAME(IA001.QUEUE.MANAGER)\nSTRMQMLSR MQMNAME(IA001.QUEUE.MANAGER)\nDLYJOB DLY(300)\nSTRMQMMQSC SRCMBR(IA1_RESTRT) SRCFILE(MQSCRIPTS/MQSETUP) MQMNAME(IA001.QUEUE.MANAGER)The script run at the end contains a series of channel start commands. Periodically we get an error in this step with a channel 'in use' and when investigating we find the channel is running.The delay shown above was recently introduced as we thought the various pieces might need time to start properly before the channels were started, however this uncovered something curious in that we encountered the 'in use' error with three channels.It seems that, given time, the channels are starting themselves. But I cannot figure out how or why? I'm not 100% familiar with channel initiation but from what I can learn from the documentation we do not have it set up \u2013 I scanned a configuration dump and found no entries of INITQ( ) with anything other than blanks.What is starting our channels? I cannot replicate this behaviour on our test system at all.### Assistant: If a channel was previously in RETRYING status before the queue manager last ended, this state is remembered over the restart and your channel will be out back into RETRYING upon queue manager restart, and may then successfully connect.\n"}
+{"text": "### Human: In the followingJBoss/HornetQ user manual pageyou can see how HornetQ provides a mechanism for streaming data to a Message for a Queue using a java.io.InputStream. A JMS version of the same code is given. Has anyone come across an equivalent using IBM MQSeries / WebsphereMQ?Say I have a large amount of data to place in the JMS Message which to me is just a stream of bytes. In the Hornet example, the stream is only read when the message is sent, so if it is, say a FileInputStream, then we only need enough memory to buffer a chunk of the bytes. I can use a javax.jms.BytesMessage to send in chunks of bytes and use the BytesMessage to buffer them. The problem with this is that the IBM implementation of BytesMessage (com.ibm.msg.client.jms.internal.JmsBytesMessageImpl) has to cache them until the Message is sent and if that is a large amount of data it is a problem. Worse it appears that although I am only sending bytes, the IBM implementation appears to keep duplicate copies, one in a BytesArrayOutputStream the other in a DataOutputStream.### Assistant: In WebSphere MQ the closest thing to what you describe is areference message. The method described in the Infocenter requires custom programming of channel exits to grab the filesystem object and put it into a message before it is transmitted over the channel. A complementary exit on the remote side saves the payload to a file and puts a reference to the file in the message that is returned to the app.We also have programs in WMQ that take STDIN or a pipe at one end and put messages to a queue on the other end. A pair of these can act as a pipe through which line-oriented ASCII data flows between processes on separate machines. However, there's no JMS implementation of this and it doesn't work too well for binary data.\n"}
+{"text": "### Human: I am importing a Jar file \"com.ibm.mq.jar\" into my workspace(Eclipse IDE).\nWhile importing, a screen came where I could see all the classes in the Jar file.After I imported it into the work space, I was able to import the package and following statement didn't give any error.import com.ibm.mq.*;But, in code I am not able to use any of the classes which were there in the package.\nLike, \"MQC\" is a class in the package, but in code it doesn't reflect(\"MQC cannot be resolved as a type\" error comes if I try to use it).This jar file actually contains Websphere MQ API classes.Can anyone advise, what am I missing.### Assistant: If you're using MQ 7, check its documentationhere. There was some stuff going on about deprecation ofcom.ibm.mq.mqcand, depending on the version you use, that class was replaced bycom.ibm.mq.constants.MQConstants. Like this one, there are other cases.In factcom.ibm.mqonly contains the exceptionMQException, so you won't find any classes there. I suggest you check the version you're using and dig a little deeper into the docs, as a first step.\n"}
+{"text": "### Human: My application receives MQTT messages via JMS on a Websphere AS. The MQTT endpoint is a Websphere MQ.Is there any way to identify the sender of the message (the sending device, not Websphere MQ ;-) )? I could not find a matching field in the jms message header...### Assistant: When creating the MQTT channel there are options to use either the MQTT Client ID or the Username for authorization checks. If the channel is configured to use JAAS and the option to use the Username is selected, IbelievetheMQMD.UserIDinherits the Username. I don't have JAAS authentication configured but when I get some time later I'll test it and update.I was able to test the option that uses the ClientID for authorization and it doesnotresult in the client ID ending up in theMQMD.UserIDfield.Since identity propagation is a common requirement, I'd suggest raising aRequest For Enhancement(RFE) stating that either Client ID or Username should propagate to theMQMD.UserID, depending onthe channel setting.\n"}
+{"text": "### Human: getting below error after i configure MQ connection factory.java.lang.ClassCastException: com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle incompatible with com.ibm.mq.jms.MQQueueConnectionFactorymy code snippet where the exception is pointing to :String queueConnectionJndi = props.getProperty(queueConnection + MQ_CONN);\n queueConnectionFactory = MQQueueConnectionFactory)initialContext.lookup(queueConnectionJndi);I am not able to find out the root cause of this.can any body please help me on this, Thanks in advance.### Assistant: There is no way to be sure without more context, but it looks like this method call:initialContext.lookup(queueConnectionJndi);is returning an object of type com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle which cannot be cast to com.ibm.mq.jms.MQQueueConnectionFactory.Can you provide more context?\n"}
+{"text": "### Human: I see a bunch of errors that looks likeAMQ8077: Entity 'tcs-mq-user ' has insufficient authority to access object 'SYSTEM.INTERNAL.REPLY.QUEUE'on the mq error logs whenever I access the queue objects via MQ Explorer. This is repeated for many system objects such as....SYSTEM.MQEXPLORER.REPLY.MODEL SYSTEM.ADMIN.COMMAND.QUEUE\n SYSTEM.SELECTION.VALIDATION.QUEUE SYSTEM.DEFAULT.MODEL.QUEUE\n SYSTEM.RETAINED.PUB.QUEUE SYSTEM.PENDING.DATA.QUEUE\n SYSTEM.NDURABLE.MODEL.QUEUE SYSTEM.MQSC.REPLY.QUEUE\n SYSTEM.JMS.TEMPQ.MODEL SYSTEM.INTERNAL.REPLY.QUEUE\n SYSTEM.INTER.QMGR.PUBS SYSTEM.INTER.QMGR.FANREQ\n SYSTEM.INTER.QMGR.CONTROL SYSTEM.HIERARCHY.STATE\n SYSTEM.DURABLE.SUBSCRIBER.QUEUE SYSTEM.DURABLE.MODEL.QUEUE\n SYSTEM.DOTNET.XARECOVERY.QUEUE SYSTEM.DEFAULT.REMOTE.QUEUE\n SYSTEM.DEFAULT.MODEL.QUEUE SYSTEM.DEFAULT.LOCAL.QUEUE\n SYSTEM.DEFAULT.INITIATION.QUEUE SYSTEM.DEFAULT.ALIAS.QUEUE\n SYSTEM.DEAD.LETTER.QUEUE SYSTEM.CLUSTER.TRANSMIT.QUEUE\n SYSTEM.CLUSTER.REPOSITORY.QUEUE SYSTEM.CLUSTER.REPOSITORY.QUEUE\n SYSTEM.CLUSTER.HISTORY.QUEUE SYSTEM.CLUSTER.COMMAND.QUEUE\n SYSTEM.CICS.INITIATION.QUEUE SYSTEM.CICS.INITIATION.QUEUEHow do I get rid of these?### Assistant: When WMQ Explorer paints the queues screen, it needs to enumerate all the queues and does so by issuing the command server equivalent ofDIS Q(*)as a PCF command. The results of that command are returned on a per-queue basis so each queue the user has access to display returnsMQCC=0whereas each queue the user has no access to display returnsMQCC=2, MQRC=2035. Since it does this for each queue hat is defined, you will need to authorizetcs-mq-userto at least display all queues.Sincetcs-useris in themq-usergroup (based on notes in previous postings) then do this:SET AUTHREC PROFILE('**') GROUP('mq-users') OBJTYPE(QUEUE) AUTHADD(DSP)Note that you needtwoasterisks in the profile name because WMQ recognizes dot characters as node separators. For example, using a profile ofSYSTEM*would match a queue namedSYSTEM_QUEUEbut not one namedSYSTEM.QUEUEbecause the single asterisk wildcard matches only a single node in the name. A two-asterisk wildcard likeSYSTEM**would match both names. To match allSYSTEMqueues, you usually would use the patternSYSTEM.**, including the dot and both asterisks. That way the pattern excludes user-defined names likeSYSTEMICbut matches all the default object names. To match all queues, just use the pattern**as shown in the command example above.You will also get many of the same errors on the other objects. To get around all of these in one step, first apply the base authorizations as explained in the post onViewing Channels in WebSphere MQ Explorer. That gives the ability to display and/or inquire on all objects, then you can add more specific profiles to allow put, get, browse, etc. on just the objects wheremq-userrequires more access.You may also want to have a look at theWebSphere MQ Security HeatsUp article on developerWorks for more background and setmqaut commands.\n"}
+{"text": "### Human: I think I tried to start a channel that is already running or whatever. Whenever I start the sender channel, the receiver channel goes to a PAUSED state.I looked it upand found something about AdoptNewMCA configuration, not sure how to set it at the queue manager level. How do I fix this smoothly. Merely stopping and restarting the channels does not do it.Error log says:/02/2012 12:38:41 PM - Process(19161.269) User(mqm) Program(amqrmppa)\n Host() Installation(Installation1)\n VRMF(7.1.0.0) QMgr(QM_TEST2)\n\nAMQ9514: Channel 'QM_TEST1.TO.QM_TEST2' is in use.\n\nEXPLANATION: The requested operation failed because channel\n''QM_TEST1.TO.QM_TEST2' is currently active. ACTION: Either end the channel\nmanually, or wait for it to close, and retry the operation.\n----- amqrcsia.c : 1042 ------------------------------------------------------- \n08/02/2012 12:38:41 PM - Process(19161.269) User(mqm) Program(amqrmppa)\n Host(...) Installation(Installation1)\n VRMF(7.1.0.0) QMgr(QM_TEST2)\n\nAMQ9999: Channel ''QM_TEST1.TO.QM_TEST2' to host '17.2.33.44' ended abnormally.\n\nEXPLANATION: The channel program running under process ID 19161 for\nchannel ''QM_TEST1.TO.QM_TEST2' ended abnormally. The host name is\n'17.2.33.44'; in some cases the host name cannot be\ndetermined and so is shown as '????'. ACTION: Look at previous error\nmessages for the channel program in the error logs to determine the\ncause of the failure. Note that this message can be excluded\ncompletely or suppressed by tuning the \"ExcludeMessage\" or\n\"SuppressMessage\" attributes under the \"QMErrorLog\" stanza in qm.ini.\nFurther information can be found in the System Administration Guide.\n----- amqrmrsa.c : 887 --------------------------------------------------------### Assistant: When looking these things up, I'd start first with the product manuals. In this case, the Infocenter topic on channel statessays thata channel in PAUSED state is waiting on a retry interval. Thesub-topic on channel errorsexplains why sending or receiving channels can be in retry:If a channel is unable to put a message to the target queue because\n that queue is full or put inhibited, the channel can retry the\n operation a number of times (specified in the message-retry count\n attribute) at a time interval (specified in the message-retry interval\n attribute). Alternatively, you can write your own message-retry exit\n that determines which circumstances cause a retry, and the number of\n attempts made. The channel goes to PAUSED state while waiting for the\n message-retry interval to finish.So if you stop your channels, you should see a message in the XMitQ on the sending side. If you GET-enable that queue you can browse the message, look at the header and see which queue it is destined for. On the receiving side, look to see if that queue is full.Classic fast-sender, slow-consumer problem here. If the consumer can't keep up, the messages back up on the receiving QMgr, then the channel goes to retry and they begin to back up on the sending QMgr. Got to monitor depth and input handles on request queues.\n"}
+{"text": "### Human: I want to write ascriptfile that will append the arrived MQ messages in the Queue Manager in a log file.Please help### Assistant: If you want all messages arriving on a channel, you can use the LogIP exit from the BlockIP2 page ofmrmq.dk. An API exit such asSupportPac MA0Wcan log all messages put. An API exit can catche messages from local applications as well as those arriving over channels.If you want to script this, you can use a program such as Q (fromSupportPac MA01) to remove the messages from the queue as they arrive and append them to a file.For example,#!/usr/bin/ksh\n\nq -IMYQMGR/MY.QUEUE >> logfile.txtTypically, the script is triggered and configured to append new messages to the file. The problem with this is that it destructively removes the messages. If there is an application of record needing to use those messages it isn't a great solution. You could browse the queue but there's no guarantee of getting the messages before the app of record gets them - and the browse would periodically restart at the head of the queue so you might log the same message twice.Another scripting option is thePerl MQSeriesmodule. This module exposes all the options of the WMQ API as well as object-oriented methods. If you need something quick and dirty, the Q program is delivered as an executable. If you want something powerful that exposes all the APIs to your script (and don't mind compiling it) the Perl MQSeries module is a great way to go. Here's a code snippet, taken from the module's samples, showing how to GET messages:while (1) {\n $sync_flag = 0;\n undef $outcome;\n my $request_msg = MQSeries::Message::->new();\n my $status = $request_queue->\n Get('Message' => $request_msg,\n 'GetMsgOpts' =>\n {\n 'WaitInterval' => 5000, # 5 seconds\n 'Options' => (MQSeries::MQGMO_WAIT |\n MQSeries::MQGMO_SYNCPOINT_IF_PERSISTENT |\n MQSeries::MQGMO_CONVERT |\n MQSeries::MQGMO_FAIL_IF_QUIESCING),\n },\n );\n unless ($status) { # Error\n my $rc = $request_queue->Reason();\n die \"Error on 'Get' from queue $qmgr_name/$request_qname:\\n\" .\n \"\\tReason: $rc (\" . MQReasonToText($rc). \")\\n\";\n }\n next if ($status < 0); # No message availableOne thing people have done in the past is to convert the queue to an alias over a topic. The app that uses the messages is redirected to GET from a new queue and an administrative subscription connects the topic to the new queue. At this point the real app gets all the messages and a new subscription can be made for logging messages going through the topic.\n"}
+{"text": "### Human: I have a simple program connecting to a remote queue manager which seems to work fine and I can send and receive messages. However I have noticed that with every connection I am getting errors in the windows application event manager:Error on receive from host myhost (12.213.143.252).An error occurred receiving data from my host(12.213.143.252) over\n TCP/IP. This may be due to a communications failure.The return code from the TCP/IP recv() call was 10054 (X'2746').\n Record these values and tell the systems administrator.I thought this might be that I am not disconnecting on the client side correctly though I'm not sure what I am doing wrong. Here is the code I am using to test connecting which is still causing this issue:XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); \n IConnectionFactory cf = factoryFactory.CreateConnectionFactory();\n\n cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, WebSphereConfigObject.QueueManager);\n cf.SetStringProperty(XMSC.WMQ_HOST_NAME, WebSphereConfigObject.Host);\n cf.SetIntProperty(XMSC.WMQ_PORT, WebSphereConfigObject.Port);\n cf.SetStringProperty(XMSC.WMQ_CHANNEL, WebSphereConfigObject.ServerConnectionChannel);\n cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);\n IConnection connection = cf.CreateConnection();\n ISession session = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);\n connection.Start();\n session.Close();\n connection.Stop();\n connection.Close();any help much appreciated!### Assistant: From what I have seen that event 10054 is logged by a queue manager process, amqrmppa. The event is logged when socket connection between this queue manager process and the XMS client application terminates abruptly.Normal termination does not log any event.\n"}
+{"text": "### Human: In a Java program running in two Websphere nodes the following race scenario happens in a distributed transaction managed by Websphere Transaction Manager. The transaction spans across a JMS (Websphere-MQ) Transaction Source and a Database (Oracle) Transaction Source. I would like to understandWhy this (Exception in Thread 2, at step B6) exception happened? \nI expected no issues to happen. Thread 2 had proceeded only after making sure T1 is locked in Transaction TX2, so it is natural that Thread 1 was waiting for T1 table lock (within Transaction TX1) to be released. What I'm wondering about is that why did Thread 2 encounter a stage3CommitProcessing exception? How could I get more details about it, as the exception doesn't breathe any informtaion about it?How to debug such transaction related race scenario? I know it might be difficult to reproduce. But I think there could be some Websphere related logs that I could enable to see what made the commit fail during stage3? It would be great if someone could point me in that direction.How it could be avoided/resolved?Thread 1 (Running in Websphere node 1)A1: Start TX1\nA2: Read messages (maximum of 1000 at a time) from Queue Q1\nA3: LOCK TABLE T1 IN EXCLUSIVE MODE\n Got exception \"ORA-02049\": distributed transaction waiting for lock. \nRefer Log 1 for stack traceThread 2 (Running in Websphere node 2)B1: Start TX2\nB2: Read messages (maximum of 1000 at a time) from Queue Q1\nB3: LOCK TABLE T1 IN EXCLUSIVE MODE\nB4: Batch execute\n MERGE INTO T1 the messages read\nB5: Batch insert messages into T2\nB6: Commit TX2\n Got JTA transaction unexpectedly rolled back (maybe due to a timeout). Refer Log 2 for stack trace. This was while ***stage3CommitProcessing***.Log 1:org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [LOCK TABLE T1 IN EXCLUSIVE MODE]; nested exception is java.sql.SQLSyntaxErrorException: ORA-02049: timeout: distributed transaction waiting for lockat org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:94)\nat org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)\nat org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)\nat org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406)\nat org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:518)\nat org.springframework.jdbc.core.simple.SimpleJdbcTemplate.update(SimpleJdbcTemplate.java:248)\nat com.test.OracleTableLock.processMessage(OracleTableLock.java:52)\nat sun.reflect.GeneratedMethodAccessor833.invoke(Unknown Source)\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\nat java.lang.reflect.Method.invoke(Method.java:600)\nat org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)\nat org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)\nat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\nat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)\nat $Proxy153.receiveMessage(Unknown Source)\nat com.test.BatchProcessor.processMessage(BatchProcessor.java:343)\nat sun.reflect.GeneratedMethodAccessor779.invoke(Unknown Source)\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\nat java.lang.reflect.Method.invoke(Method.java:600)\nat org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)\nat org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)\nat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\nat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)\nat $Proxy155.receiveMessage(Unknown Source)\nat sun.reflect.GeneratedMethodAccessor778.invoke(Unknown Source)\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\nat java.lang.reflect.Method.invoke(Method.java:600)\nat org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)\nat org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65)\nat org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51)\nat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:453)\nat java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:329)\nat java.util.concurrent.FutureTask.runAndReset(FutureTask.java:162)\nat org.springframework.scheduling.commonj.TimerManagerTaskScheduler$TimerScheduledFuture.timerExpired(TimerManagerTaskScheduler.java:112)\nat com.ibm.ws.asynchbeans.timer.TimerImpl.callListenerMethod(TimerImpl.java:298)\nat com.ibm.ws.asynchbeans.timer.GenericTimer.run(GenericTimer.java:216)\nat com.ibm.ws.asynchbeans.J2EEContext$RunProxy.run(J2EEContext.java:264)\nat java.security.AccessController.doPrivileged(AccessController.java:224)\nat javax.security.auth.Subject.doAs(Subject.java:495)\nat com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:131)\nat com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:89)\nat com.ibm.ws.asynchbeans.J2EEContext$DoAsProxy.run(J2EEContext.java:335)\nat java.security.AccessController.doPrivileged(AccessController.java:251)\nat com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1146)\nat com.ibm.ws.asynchbeans.timer.TimerImpl.runListenerAsCJWork(TimerImpl.java:425)\nat com.ibm.ws.asynchbeans.am._Alarm.fireAlarm(_Alarm.java:333)\nat com.ibm.ws.asynchbeans.am._Alarm.run(_Alarm.java:230)\nat com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)\nCaused by: java.sql.SQLSyntaxErrorException: ORA-02049: timeout: distributed transaction waiting for lock\n\nat oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)\nat oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)\nat oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)\nat oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)\nat oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)\nat oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)\nat oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183)\nat oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:942)\nat oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)\nat oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1706)\nat oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1674)\nat oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:275)\nat com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.pmiExecuteUpdate(WSJdbcStatement.java:1683)\nat com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeUpdate(WSJdbcStatement.java:1041)\nat org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:508)\nat org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:1)\nat org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)\n... 50 moreLog 2:org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException\n at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1012)\n at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)\n at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)\n at com.test.BatchProcessor.processMessage(BatchProcessor.java:359)\n at sun.reflect.GeneratedMethodAccessor1541.invoke(Unknown Source)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:600)\n at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)\n at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)\n at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)\n at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)\n at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\n at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)\n at $Proxy204.receiveMessage(Unknown Source)\n at sun.reflect.GeneratedMethodAccessor1540.invoke(Unknown Source)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)\n at java.lang.reflect.Method.invoke(Method.java:600)\n at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)\n at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65)\n at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51)\n at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:453)\n at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:329)\n at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)\n at org.springframework.scheduling.commonj.TimerManagerTaskScheduler$TimerScheduledFuture.timerExpired(TimerManagerTaskScheduler.java:112)\n at com.ibm.ws.asynchbeans.timer.TimerImpl.callListenerMethod(TimerImpl.java:298)\n at com.ibm.ws.asynchbeans.timer.GenericTimer.run(GenericTimer.java:216)\n at com.ibm.ws.asynchbeans.J2EEContext$RunProxy.run(J2EEContext.java:264)\n at java.security.AccessController.doPrivileged(AccessController.java:224)\n at javax.security.auth.Subject.doAs(Subject.java:495)\n at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:131)\n at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:89)\n at com.ibm.ws.asynchbeans.J2EEContext$DoAsProxy.run(J2EEContext.java:335)\n at java.security.AccessController.doPrivileged(AccessController.java:251)\n at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1146)\n at com.ibm.ws.asynchbeans.timer.TimerImpl.runListenerAsCJWork(TimerImpl.java:425)\n at com.ibm.ws.asynchbeans.am._Alarm.fireAlarm(_Alarm.java:333)\n at com.ibm.ws.asynchbeans.am._Alarm.run(_Alarm.java:230)\n at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)\nCaused by: javax.transaction.RollbackException\n at com.ibm.tx.jta.TransactionImpl.stage3CommitProcessing(TransactionImpl.java:1217)\n at com.ibm.tx.jta.TransactionImpl.processCommit(TransactionImpl.java:991)\n at com.ibm.tx.jta.TransactionImpl.commit(TransactionImpl.java:913)\n at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:377)\n at com.ibm.tx.jta.TranManagerSet.commit(TranManagerSet.java:161)\n at com.ibm.ws.tx.jta.UserTransactionImpl.commit(UserTransactionImpl.java:293)\n at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009)\n ... 37 more### Assistant: Assuming that this is a WebSphere MQ resource oproblem, let's try to answer your questions in turn.Why this (Exception in Thread 2, at step B6) exception happened?Why did Thread 2 encounter a stage3CommitProcessing exception?How could I get more details about it?Chances are that the QMgr involved has not been configured with sufficient log space to contain all the messages that are under syncpoint. Although you have taken care to serialize access to the database, the queue is not serialized and so the QMgr must manage up to 2000 records under syncpoint at once. More details are available in the QMgr's error log.How to debug such transaction related race scenario?Are there Websphere related logs that I could enable to see what made the commit fail during stage3?Take a look in/var/mqm/qmgrs/[QMgr name]/errors/AMQERR01.logfor details of whether it was WebSphere MQ that rolled back the transaction.Also, print the JMS linked exceptions. Always. JMS provides a multi-level exception where the lower levels contain provider-specific error information. Often these convey to the application the same information you would otherwise have to go digging through the QMgr's error logs to get.If I'm correct about the cause of the problem, the easiest way to test it is to have two instances try to read 100 records each under syncpoint.How it could be avoided/resolved?Size the logs so that they can contain all of the messages that might be under syncpoint at any given moment. For example, if the messages are each 1k in size and you need 1000 of them under syncpoint for each of 10 instances, you will need at a minimum about 10MB of log extents. These are defined by the QMgr's Primary and Secondary log size and count settings. Remember that the QMgr also maintains syncpoints, for example when managing channels, and so whatever space you calculate needs to take into account channel batch sizes and a few MB for QMgr internal transactions.Please see the section in the Infocenter oncalculating log file sizesfor more detail. For more background, please seeCircular vs. Linear Logsin IBM developerWorks.\n"}
+{"text": "### Human: Does anybody have experience with configuring distribution lists (sending a message to one queue, and having that message be forwarded to several other queues) for Websphere MQ v7? I want to configure it on my queue manager, rather than the client having to know all the queues to send the messages to. Also, I would prefer not to use a topic, because I want to be able to manage each queue separately. Is there some configuration file, or some way to use WebSphere MQ Explorer to do this?Thanks### Assistant: A program that uses a distribution list doesn't have to \"know\" the queues it sends to in the sense of hard-coding the names. But itdoeshave to supply the list of queue names. Typically you can place these into a namelist and have the sending program retrieve them there. When the program callsPUTit must also be prepared to parse a structure of return codes rather than a single MQRC.However, you really should reconsider using a topic. You can create administrative subscriptions for each destination queue. This allows you to send the publications to any local or remote queue that you like. It also have the advantage of being able to add or delete destinations without having to restart - or worse, recompile - the sending application.You can use WMQ Explorer either to manage a namelist or to manage the topic and administrative subscriptions. The topic/subscriptions method is the only way to do this purely through configuration. To use distribution lists requires a program specifically designed for the purpose.\n"}
+{"text": "### Human: I have to a develop a .NET Windows Service application that should run on an Active/Active cluster.A Windows Service instance (one instance among many in cluster nodes) should listen to an IBM Websphere MQ and distribute the queue items to all cluster nodes (including the distributor node) based on the load on each service instance. When the primary node fails, another service instance on secondary node should takeover the distribution task. Also, the distributor node should be able to control the concurrency level ofTaskSchedulerinstance in Windows Service on all the nodes. For this, I should be able to communicate between cluster nodes without having a DB table or another queue.I googled and found there is aC/C++ Platform SDKavailable. But, Is there any .NET API available to check the hearbeat and to perform intra-communication between nodes inside a cluster server? Or if you could suggest me a best way to implement this would be very helpful. Thanks.### Assistant: There are probably much better platforms than Windows Clustering for this, but since you asked about Windows Clustering here's my take:The MSCS/WSFC cluster API doesn't really provide a mechanism for intra-process communication beyond the fairly limited cluster database (really just a replicated registry key). But you could use the cluster API/tools to host the coordinator process and provide high availability.The easiest way to do this would be to just build a normal Windows service for your coordinator and then use the built in \"Generic Service\" cluster resource/application type to monitor it. That will let you assign an IP address to the coordinator that will follow it around the cluster. Note that moving the coordinator service will be disruptive, so if the node crashes that is hosting the coordinator, there will be downtime while it is started up on the surviving node.I don't really see any reason to make the processing agents cluster aware. Just run them as services on each node, and let the coordinator monitor which ones are online.\n"}
+{"text": "### Human: I'm trying to fix a problem with an application that sends a message to the SWIFT network. The application is a .NET application and it uses IBM'samdqmdnet.dllassembly to communicate with the WebSphere MQ server. On the WebSphere MQ server the SWIFT Alliance software is running.The messages are sent from the application, but does not enter the SWIFT network. Some investigation has revealed the following error message:MQSeries Queue 'MQSWIFT/SWIFT.SENDER', Nbr 123, Session 4567, Sequence 890, Conversion error (From)\n MQ Msg Id : AMQ MQSWIFT X -\n Message Info : Error in FIN block 1: can not find tag F01 in message\n{.1.:.F.0.1. (rest of message removed)The start of the message sent is{1:F01and to me this looks like the message is encoded in UNICODE (UTF-16) but the SWIFT software expects ASCII. The SWIFT software sees{.1.:.F.0.1..My question is: How do I send the message to the WebSphere MQ queue using ASCII encoding?The connection has the propertiesMQC.TRANSPORT_PROPERTY,MQC.HOST_NAME_PROPERTYandMQC.CHANNEL_PROPERTYset.The queue is opened using the optionsMQC.MQOO_OUTPUTandMQC.MQOO_FAIL_IF_QUIESCING.The message is created using the formatMQC.MQFMT_STRINGand default put message options:var mqMessage = new MQMessage { Format = MQC.MQFMT_STRING };\nmqMessage.WriteString(swiftMessage);\nvar mqMessageOptions = new MQPutMessageOptions();\nqueue.Put(mqMessage, mqMessageOptions);I have noticed that theMQCenumeration has the valueCODESET_819which probably refers to ASCII but I have no idea if I need to use it and how.### Assistant: The solution that worked for me was to set theCharacterSetproperty of theMQMessageto819:var mqMessage = new MQMessage {\n Format = MQC.MQFMT_STRING,\n CharacterSet = 819\n}\nmqMessage.WriteString(swiftMessage);A collegaue also told me that I should be able to use theMQMessage.Writeoverload that accepts a byte array. Something along these lines:var mqMessage = new MQMessage();\nmqMessage.Write(Encoding.ASCII.GetBytes(swiftMessage));However, I have not verified that this alternative approach works.\n"}
+{"text": "### Human: I have a repository queue manager say REPQMGR in a WebSphere MQ cluster. What mqsc command should i use on REPQMGR to get all the queue manager's list in the cluster. In specific i need to inquire a property value from all queue managers.### Assistant: runmqsc\nDIS CLUSQMGR(*) CLUSTER(clusname) ALLThis command will show you all the QMgrs in the cluster. You can also specify a particular attribute that you want to know about instead of usingALL.If you are writing script, have a look atSupportPac MO72. This is a version of runmqsc that a) can operate as a client; b) has a number of useful formatting options; and c) also managed CCDT files.In particular, you can tell MO72 to return results on a single line rather than the standard runmqsc two-column format. This means that a script can look for the object name and attribute name on the same output line rather than having to parse many lines for a single object.\n"}
+{"text": "### Human: I have a JMS-based application that I am running in on Websphere 6.0, and am migrating to Websphere 7. Both Websphere servers are backed with a Websphere MQ 6.0 server. I receive the following exception when attempting to deploy a test servlet to the Websphere 7 server:javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queueWebsphere 6.0 : RHEL 5.3Websphere 7.0.0.15: RHEL 5.3Websphere MQ 6.0: Windows Server 2003Servlet Test Code:public class JMSTestServlet extends HttpServlet {\n private static final long serialVersionUID = 1L;\n\n /**\n * @see HttpServlet#HttpServlet()\n */\n String MQConnectionFactory, MQQueue; \n\n public JMSTestServlet() {\n super();\n // TODO Auto-generated constructor stub\n System.out.println(\"JMSTestServlet: loading\");\n\n URL urlProps = getClass().getClassLoader().getResource(\"META-INF/startup.properties\");\n Properties props = new Properties();\n try\n {\n System.out.println(\"JMSTestServlet: loading properties\");\n props.load( urlProps.openStream() );\n\n MQConnectionFactory = props.getProperty(\"MQConnectionFactory\"); \n MQQueue = props.getProperty(\"MQQueue\"); \n\n System.out.println(\"JMSTestServlet: loading properties ... done!\");\n\n sendMessage(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n } catch (IOException e)\n {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n\n protected void sendMessage(String messageString) { \n QueueConnectionFactory fact;\n QueueConnection qConn = null;\n try { \n System.out.println(\"JMSTestServlet: creating context\");\n Context ctx = new InitialContext();\n fact = (QueueConnectionFactory)ctx.lookup(MQConnectionFactory);\n Destination destination = (Destination)ctx.lookup(MQQueue);\n\n System.out.println(\"JMSTestServlet: creating QueueConnection\");\n qConn = fact.createQueueConnection(); \n QueueSession qSess = qConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n MessageProducer prod = qSess.createProducer(destination); \n\n\n System.out.println(\"JMSTestServlet: sending Message\");\n TextMessage message = qSess.createTextMessage();\n message.setText(messageString);\n prod.send(message); \n\n System.out.println(\"JMSTestServlet: done sendMessage()\");\n } catch ( JMSException ex ) {\n ex.toString(); \n ex.printStackTrace();\n ex.getLinkedException().toString();\n ex.getLinkedException().printStackTrace();\n } catch ( NamingException ex ) {\n System.out.println(\"JMSTestServlet: naming exception \" + ex.toString());\n ex.printStackTrace();\n } catch ( Exception ex ) {\n System.out.println(\"JNDI API lookup failed: \" + ex.toString());\n ex.printStackTrace(); \n } finally {\n System.out.println(\"JMSTestServlet: cleaning up sendMessage()\");\n\n try\n {\n if ( qConn != null ) qConn.close();\n } catch (JMSException e)\n {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }\n\n /**\n * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)\n */\n protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n try { \n String messageString = request.getParameter(\"message\"); \n sendMessage(messageString);\n } finally {\n }\n }Properties file is:MQConnectionFactory=jms/QUEUECONNFACTORY\nMQQueue=jms/QUEUEWhen deployed to Websphere 6 I get messages in my remote queues. When I deploy to Websphere 7, I get:[4/13/11 14:53:55:622 EDT] 0000005c ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$QUEUECONNFACTORY$JMSManagedConnection@15. The exception is: javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue 'QUEUE'.\n[4/13/11 14:53:55:622 EDT] 0000005c ConnectionEve W J2CA0206W: A connection error occurred. To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source.\n[4/13/11 14:53:55:623 EDT] 0000005c ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource jms/QUEUECONNFACTORY. The exception is: javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue 'QUEUE'.\n[4/13/11 14:53:55:625 EDT] 0000005c SystemErr R javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue 'QUEUE'.I'm pretty sure I've configured the queues and connection factories on both Websphere servers the same. I'm at a loss as to how to resolve this issue, and the Google is of no help.Update 2011-04-15:I've extracted the following error from the logs:com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2035'I've read up on it at a few locations, and I really can't see where there's a difference between WAS 6 and WAS 7 to cause this issue.I'm running Websphere on both Linux hosts as root. I have a root account created on the Windows machine with full permissions to the MQ installation:setmqaut -t qmgr -m QM_webspheremq -p root +all### Assistant: I'll take a shot at answering this old post since it has been \"Bumped by Community user\" every four months since January 2019.First some background:WAS 6.0Included MQ jar files from Websphere MQ v5.3Depending on the specific version of WAS 6.0, the jars would be from Websphere MQ v5.3 CSD08 up to CSD14WAS 7.0.0.15Is supposed to include WebSphere MQ JCA resource adapter Version 7.0.1.3 (the default behavior here would have been that of the MQ v5.3 jars), but because of a bug, if you upgraded from WAS 7.0.0.0 to WAS 7.0.0.15, the WebSphere MQ JCA resource adapter Version 7.0.0.0 which came with WAS 7.0.0.0 would stay in place.The difference:With MQ v5.3 jar files, when you callfact.createQueueConnection();, a blank userid would be sent to the queue manager. If theSVRCONNchannel you connected to had a blankMCAUSERattribute then the connection would be running under the authority of the user account the Windows MQ queue manager was running as. In other words you would get full authority to the the queue manager and all queues (full MQ admin authority).With MQ v7.0.0.0 resource adapter, when you callfact.createQueueConnection();the JVM process ID will be sent to the queue manager. If theSVRCONNchannel you connect to had a blankMCAUSERattribute then the Windows MQ queue manager would attempt to run the connection under the authority of the JVM process ID. Based on the information in your question this would be the userroot.Summary:It worked under Websphere 6.0 because the connection runs with full MQ Admin authority.It failed under Websphere 7.0.0.15 because the connection runs withrootuser authority, and in this case you only provided therootuser withallauthority to the queue manager (qmgr) itself, but no authority to theQUEUE.Websphere must first connect to and inquire the queue manager object before it would open any queues. The error you got wasjavax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue 'QUEUE'.. This means that you did successfully connect to the queue manager, but then failed to connect to the queue.This could have been fixed by providing authority for theQUEUEto therootuser:setmqaut -t q -m QM_webspheremq -n QUEUE -p root +put +get +browse +inq +dspNote all of the versions of software listed in the question are now (8.5 years later) out of support from IBM. It would also not be advisable to have aSVRCONNchannel with a blankMCAUSERunless you were using some other method such as a security exit to set the MCAUSER to a non-MQ Admin id. In current IBM MQ versions you can use TLS with a client cert mapped on the queue manager to a non-MQ Admin id, or TLS without a cert + connection authentication to validate a user id and password sent by the client at the queue manager.\n"}
+{"text": "### Human: Here is the scenario,$hostname\nserver1I have the below script in server1,#!/bin/ksh\necho \"Enter server name:\"\nread server\n\nrsh -n ${server} -l mquser \"/opt/hd/ca/scripts/envscripts.ksh\"\nqdisplay\n # script ends.In above script I am logging into another server say server2 and executing the script \"envscripts.ksh\" which sets few alias(Alias \"qdisplay\") defined in it.I can able to successfully login to server1 but unable to use the alias set by script \"envscripts.ksh\".Geting below error,-bash: qdisplay: command not foundcan some please point out what needs to be corrected here.Thanks,\nVignesh### Assistant: The other responses and comments are correct. Yourrshcommand needs to execute both the ksh script and the subsequent command in the same invocation. However, I thought I'd offer an additional suggestion.It appears that you are writing custom instrumentation for WebSphere MQ. Your approach is to remote shell to the WMQ server and execute a command to display queue attributes (probably depth).The objective of writing your own instrumentation is admirable, however attempting to do it as remote shell is not an optimal approach. It requires you to maintain a library of scripts on each MQ server and in some cases to maintain these scripts in different languages.I would suggest that a MUCH better approach is to use the MQSC client available inSupportPac MO72. This allows you to write the scripts once, and then execute them from a central server. Since the MQSC commands are all done via MQ client, the same script handles Windows, UNIX, Linux, iSeries, etc.For example, you could write a script that remotely queried queue depths and printed a list of all queues with depth > 0. You could then either execute this script directly against a given queue manager or write a script to iterate through a list of queue managers and collect the same report for the entire network. Since the scripts are all running on the one central server, you do not have to worry about getting$PATHright, differences in commands like tr or grep, where ksh or perl are installed, etc., etc.Ten years ago I wrote the scripts you are working on when my WMQ network was small. When the network got bigger, these platform differences ate me alive and I was unable to keep the automation up and running. When I switched to using WMQ client and had only one set of scripts I was able to keep it maintained with far less time and effort.The following script assumes that the QMgr name is the same as the host name except in UPPER CASE. You could instead pass QMgr name, hostname, port and channel on the command line to make the script useful where QMgr names do not match the host name.#!/usr/bin/perl -w\n#-------------------------------------------------------------------------------\n# mqsc.pl\n#\n# Wrapper for M072 SupportPac mqsc executable\n# Supply parm file name on command line and host names via STDIN.\n# Program attempts to connect to hostname on SYSTEM.AUTO.SVRCONN and port 1414 \n# redirecting parm file into mqsc.\n#\n# Intended usage is...\n#\n# mqsc.pl parmfile.mqsc\n# host1\n# host2\n# \n# -- or --\n#\n# mqsc.pl parmfile.mqsc < nodelist\n#\n# -- or --\n#\n# cat nodelist | mqsc.pl parmfile.mqsc\n#\n#-------------------------------------------------------------------------------\nuse strict;\n$SIG{ALRM} = sub { die \"timeout\" };\n\n$ENV{PATH} =~ s/:$//;\n\nmy $File = shift;\ndie \"No mqsc parm file name supplied!\" unless $File;\ndie \"File '$File' does not exist!\\n\" unless -e $File;\n\nwhile () {\n my @Results;\n chomp;\n next if /^\\s*[#*]/; # Allow comments using # or *\n s/^\\s+//; # Delete leading whitespace\n s/\\s+$//; # Delete trailing whitespace\n # Do not accept hosts with embedded spaces in the name\n die \"ERROR: Invalid host name '$_'\\n\" if /\\s/;\n\n # Silently skip blank lines\n next unless ($_);\n\n my $QMgrName = uc($_);\n\n #----------------------------------------------------------------------------\n # Run the parm file in\n eval {\n alarm(10);\n @Results = `mqsc -E -l -h $_ -p detmsg=1,prompt=\"\",width=512 -c SYSTEM.AUTO.SVRCONN &1 | grep -v \"^MQSC Ended\"`;\n };\n\n if ($@) {\n if ($@ =~ /timeout/) {\n print \"Timed out connecting to $_\\n\";\n } else {\n print \"Unexpected error connecting to $_: $!\\n\";\n }\n }\n alarm(0);\n\n if (@Results) {\n print join(\"\\t\", @Results, \"\\n\");\n }\n}\nexit;The parmfile.mqsc is any valid MQSC script. One that gathers all the queue depths looks like this:DISPLAY QL(*) CURDEPTH\n"}
+{"text": "### Human: I wrote a API EXIT for WebSphere MQ 7 on Windows, when I put to or get from queue a simple message from command line like: \"amqsput\" or \"amqsget\", I would get some log files containing information like time, message data, queue name, etc.That's what I expect for my test program writen in Java, but when I used code below:MQMessage msg = new MQMessage();msg.writeUTF(\"Hello, World!\");MQPutMessageOptions pmo = new MQPutMessageOptions();queue.put(msg, pmo);I got blank log file. Then I used code below:MQMessage msg = new MQMessage();msg.writeString(\"Hello, World!\");MQPutMessageOptions pmo = new MQPutMessageOptions();queue.put(msg, pmo);Then I saw familar data in log file.I opened MQ explorer, I saw two messages in \"Message Browser\":Hello, World!%Hello, World!I'm totally lost here, where is this \"%\" from? My api exit didn't record the put action because of the encoding?Any advices would be appreciated!\nThank you!### Assistant: I'm pretty certain I remember reading somewhere thatwriteUTF()outputs length information as well as the string.Ah, yes, here it is:From IBM's owndocoonWriteUTF():This method takes an ActiveX string and writes it into the message data buffer at the current position in UTF format. The data writtenconsists of a 2-byte length followed by the character data. DataOffset is incremented by the length of the string if the method succeeds.(my italics). As you've already discovered,WriteString()is the way to do itwithouta length.\n"}
+{"text": "### Human: I'm currently working in C# and I need to check the state of the JMS connection that i made (whether it's connected / disconnected). I'm sure that I can connect and disconnect succesfully..its just that i need to display the status of the connection in my UI.Is there any properties of the JMS connection that states connection status? Or is there any other method that i can use to check the connection status?Thanks for your help. :)Currently, I'm using the ExceptionListener to listen for any exceptions and a flag will be set to false when any exception is catched. And when I'm connecting, I will set the flag to true vice versa when i disconnect, I will set the flag to false.This flag will be used by my UI to detect whether the connection is up or not.However I was thinking that if theres any property / methods of the IBM connection which can be used to show the state of the connection as its a much better solution. For SonicMQ, theres .getConnectedState() which shows whether the connection is active or inactive.I was wondering whether if IBM have something similar to SonicMQ?### Assistant: You can use theConnection.setExceptionListener()method to be notified asynchronously of exceptions detected in the connection. If a problem is detected theonException()method is called.Be sure to set theFAILIFQUIESCEproperty on the factories and destinations so that your connection is notified and closed in an orderly fashion when the QMgr is shut down by the administrator.In v7 of WMQ it is possible so enable session reconnection in the transport. In this case, the application may not be aware that the connection was interrupted but you can treat it as having been continuously connected.Note that, for the most part, exceptions are driven by the application's API calls. So if the connection is lost, you may not know about it in real time but rather find out when an API call is made. If the application sits idle for long periods of time and you want a real-time display of connection status. Please see also \"How to find out if JMS Connection is there?\" for more on that topic.WMQ v7 has options to reconnect the client automatically. You must be using v7 at both the client and the server for this to work. Since v6 is end-of-life as of Sept 2011, it is best if you develop this app on v7. You can download the v7 client asSupportPac MQC7. WhenJMS client reconnectis enabled, the application may not be aware of the connection activity except as a delay in responding to an API call while the connection is rebuilt. The length of that delay depends on channel tuning set by the administrator and in the connection factory.\n"}
+{"text": "### Human: I am disconnecting from MQQueue and MQQueueManager with the following code:Queue.Close();\nlog.Info( \"Queue IsOpen: \" + Queue.IsOpen.ToString() );\nQueue = null;\n\nQueueManager.Disconnect();\nQueueManager.Close();\nlog.Info( \"QM IsOpen: \" + QueueManager.IsOpen.ToString() );\nlog.Info( \"QM IsConnected: \" + QueueManager.IsConnected.ToString() );\nQueueManager = null;And I get the following log entries for this:Queue IsOpen: false\nQM IsOpen: false\nQM IsConnected: falseBut after few hours when I runnetstat -ncommand from command prompt I get a long list of connections to MQ server and the State in those connections isCLOSE_WAIT.Any ideas why the TCP connections doesn't get fully closed? Are there any way that I could kill those from code? Currently I'll have to restart the client app which cleans up the open connections.WebSphere MQ version is 6.0.2.6 and the .NET libraries are from MQ 7.### Assistant: Looking in the Migration Guide there's a section calledUpgrading a WebSphere MQ client from Version 6.0 to Version 7.0which suggests a possible explanation. It states that as of v7 the TCP tuning is stored in the client configuration file. So if you have enabled TCP Keepalive in the Windows registry, the v7 client will ignore it. The format and location of the file is described inWebSphere MQ client configuration file.Of course for this to be the problem, there has to be a socket leak. You did not mention which version of WMQ V7 client you have but the Fix Pack README files do show a number of APARs related to socket leaks, failure to clean up after disconnects and so forth. None of these directly mention C# or .Net but there are enough problems around connection/disconnection issues to make it worth an upgrade.So first & easiest fix to attempt is to add TCP Keepalive to the client configuration file and see if it helps. Disable connection sharing while you are in there as well. It's not supposed to be a factor but then it's not supposed to leak sockets either. Can't hurt. Next is to applyFix Pack 7.0.1.2(latest as of this writing) and see if that fixes the problem. After that, it's PMR time. Hope that helps.\n"}
+{"text": "### Human: I'm not extremely familiar with IBM MQSeries, but I am writing c# scripts which write and read files from my queue server. The problem is my read works but my write doesn't. Please notice that I am using the same queue so don't bother going in that direction.My code firstly accesses the MQserver with the following code:MQQueueManager qManager;\nMQQueue queue;\nMQMessage queueMessage;\nMQGetMessageOptions queueGetMessageOptions;\nMQPutMessageOptions queuePutMessageOptions;\n\nstring QueueName;\n\npublic MQAccess(string queueName, string queueManager, string connection, string channel)\n{\n QueueName = queueName;\n\n qManager = new MQQueueManager(queueManager, channel, connection);\n\n queue = qManager.AccessQueue(QueueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);\n}I am able to read files from my queue with this code:public bool NextMessage(ref string message, ref DateTime putDateTime)\n{\n queueMessage = new MQMessage();\n queueMessage.Format = MQC.MQFMT_STRING;\n queueGetMessageOptions = new MQGetMessageOptions();\n\n queueGetMessageOptions.Options = MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING;\n\n try\n {\n queue.Get(queueMessage, queueGetMessageOptions);\n }\n catch (MQException mqex)\n {\n if (mqex.ReasonCode == MQC.MQRC_NO_MSG_AVAILABLE)\n {\n message = \"\";\n return false;\n }\n else\n throw mqex;\n }\n message = queueMessage.ReadString(queueMessage.MessageLength);\n putDateTime = queueMessage.PutDateTime;\n\n if (message.StartsWith(\"\u00b4\u2557\u2510\"))\n {\n message = message.Substring(3, message.Length - 3);\n }\n\n return true;\n}If I however try to write with the following code it gives me errors:public void WriteMessage(string message)\n{\n queueMessage = new MQMessage();\n queueMessage.WriteString(message);\n queueMessage.Format = MQC.MQFMT_STRING;\n queuePutMessageOptions = new MQPutMessageOptions();\n\n queue.Put(queueMessage, queuePutMessageOptions);\n}My error catch gives me the error:Error in the applicationWhich doesn't show much of course. So I checked the event log on the server and this showed me the error:An error occurred receiving data from\n stx041774 (192.168.225.51) over\n TCP/IP. This may be due to a\n communications failure.The return code from the TCP/IP (recv)\n call was 10054 (X'2746'). Record these\n values and tell the systems\n administrator.I looked up 10054 and means:An existing connection was forcibly\n closed by the remote host.Does anyone have any idea what I can do to make this work? Is there perhaps an MQC option I have to set for writing? Because I have no idea what to do with the options, I'm not even sure if this is the issue.Please keep in mind that I also close my connection every time with:public void Close()\n{\n queueMessage = null;\n queue.Close();\n qManager.Close();\n}\n\n~MQAccess()\n{\n queueMessage = null;\n queue.Close();\n qManager.Close();\n}### Assistant: Squig was close but no cigar. When you open the queue, you need to specify both inputandoutput on the open options if you want to both read and write messages. The example code has only input options specified.\n"}
+{"text": "### Human: When calling:MQQueueConnectionFactory cf ...\ncf.createConnection();The com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.handshakeCompleted method begins:public void handshakeCompleted(HandshakeCompletedEvent event) {\n X509Certificate[] peerCertificateChain = event.getPeerCertificateChain();\n ...getPeerCertificateChain in javax.net.ssl.SSLSession:default X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException {\n throw new UnsupportedOperationException(\"This method is deprecated and marked for removal. Use the getPeerCertificates() method instead.\");\n}causing this exception:Exception in thread \"HandshakeCompletedNotify-Thread\" java.lang.UnsupportedOperationException: This method is deprecated and marked for removal. Use the getPeerCertificates() method instead.\n at java.base/javax.net.ssl.SSLSession.getPeerCertificateChain(SSLSession.java:295)\n at java.base/javax.net.ssl.HandshakeCompletedEvent.getPeerCertificateChain(HandshakeCompletedEvent.java:173)\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.handshakeCompleted(RemoteTCPConnection.java:2448)\n at java.base/sun.security.ssl.TransportContext$NotifyHandshake$1.run(TransportContext.java:685)\n at java.base/sun.security.ssl.TransportContext$NotifyHandshake$1.run(TransportContext.java:682)\n at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)\n at java.base/sun.security.ssl.TransportContext$NotifyHandshake.run(TransportContext.java:682)\n at java.base/java.lang.Thread.run(Thread.java:832)The project's only IBM MQ dependency is:com.ibm.mq:com.ibm.mq.allclient:9.2.0.0Why is javax.net.ssl.getPeerCertificateChain() calling that deprecated method? It looks like the problem is in the HandshakeCompletedEvent class, not MQ.Edit: This issue started with Java 15.### Assistant: In the latest release, they apparently provide JAVA 17 support.Sources:https://www.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/8/899/ENUSLP21-0278/index.htmlhttps://search.maven.org/artifact/com.ibm.mq/com.ibm.mq.allclient/9.2.4.0/jar\n"}
+{"text": "### Human: I am trying to extract AAA and BBB from the output of the command \"dspmq\". \n$dspmq<- this command gives output as -->QMNAME(AAA) STATUS(Running)\nQMNAME(BBB) STATUS(Running)But it doesn't work with the below code.perl -e 'use Data::Dumper qw(Dumper);my @qmgrlist = `dspmq`;$size = @qmgrlist;foreach my $i (@qmgrlist){my @temp1 = split /QMNAME\\(/, $i;print @temp1;}'AAA) STATUS(Running)\n\nBBB) STATUS(Running)I am able to truncate\"QMNAME(\"but unable to truncate those to the right ofAAAandBBB. Basically I want to get the string between\"QMNAME(\"and the immediate\")\". Please assist.### Assistant: I think a regex approach is better thansplit()here, but you could usesplit()by splitting on parentheses and taking the second item in the returned list.for (@qmgrlist) {\n say +(split /[()]/)[0];\n}And a brief note on your use of command-line options to run this code. You can make it simpler if you a) pipe the output ofqspmqinto your code and b) use-nto process a record at a time.$ perl -nE 'say +(split /[()]/)[1]' `dspmq`There's also-Mto load modules (e.g.-MData::Dumper), but you don't seem to be using Data::Dumper any more.\n"}
+{"text": "### Human: I'd like set up a battery of tests for testing new installations of QMs. Most of them will be in a \"remote\" setup. I'd like to be able to send a message to the new QM and receive a response. Is there any way to make a \"loop\" just with normal configuration (i.e. without using exits) ?### Assistant: My former employer was a bank and we had many connections to clearing \nhouses and other vendors. On many of these I was able to have the business partner set up loopback queues on their end. These consisted of a QRemote on my QMgr that pointed to a QRemote on the other side, which pointed to a QLocal on the originating QMgr on my side. When a message isPUTto the QRemote it flowed to the other side, landed on the QRemote there, then was directed back to the QLocal.If the message didn't make it back, we would then start our inbound channel (which was defined as aRQSTRon our side). If this caused the channel to start and the message arrived then we knew the channel initiator on the other side was down but at least we could keep the channel running until it was fixed. But if this didn't work we knew there was some problem on their side other than channel triggering.And, yes, this was production. We figured that non-transactional instrumentation messages are valid in Production environments. As far as we were concerned, this was the same as a ping or cluster control message. Of course, we had a web screen and other instrumentation to kick them off so usage of the utility was controlled and were recorded.There are similar methods in which QMgr aliasing is used and this can greatly cut down on the number of loopback queues needed in a large network. Do NOT be tempted to do this! When we use QRemotes that specify a fully-qualified destination, all they can do is send and receive loopback messages on the prescribed queue. But if a QRemote is used without anRQNAMEthen it can be used to send messages toanyqueue on the adjacent QMgr.Let's say you haveQMAandQMB:runmqsc QMA\nDEFINE QLOCAL(QMB.LOOPBACK) REPLACE\nDEFINE QREMOTE(QMB.LOOPBACK.RMT) +\n XMITQ(QMB) +\n RQMNAME(QMB) +\n RNAME(QMB.QMA.LOOPBACK.RMT) +\n REPLACE\nEND\n\nrunmqsc QMB\nDEFINE QREMOTE(QMB.QMA.LOOPBACK.RMT) +\n XMITQ(QMA) +\n RQMNAME(QMA) +\n RNAME(QMB.LOOPBACK) +\n REPLACENow you can go to the server hostingQMAand do:echo Hello World | amqsput QMB.LOOPBACK.RMT QMANote that the name of the loopback reflector onQMBhasbothQMgr names in it. This is because you probably want to set up lopback from both sides and cannot useQMB.LOOPBACK.RMTboth as a reflectorandto initiate loopbacks. In that case the object inventory looks more like this:runmqsc QMA\nDEFINE QLOCAL(QMB.LOOPBACK) REPLACE\nDEFINE QREMOTE(QMB.LOOPBACK.RMT) +\n XMITQ(QMB) +\n RQMNAME(QMB) +\n RNAME(QMB.QMA.LOOPBACK.RMT) +\n REPLACE\n\nDEFINE QREMOTE(QMA.QMB.LOOPBACK.RMT) +\n XMITQ(QMB) +\n RQMNAME(QMB) +\n RNAME(QMA.LOOPBACK) +\n REPLACE\nEND\n\nrunmqsc QMB\nDEFINE QREMOTE(QMB.QMA.LOOPBACK.RMT) +\n XMITQ(QMA) +\n RQMNAME(QMA) +\n RNAME(QMB.LOOPBACK) +\n REPLACE\n\nDEFINE QLOCAL(QMA.LOOPBACK) REPLACE\nDEFINE QREMOTE(QMA.LOOPBACK.RMT) +\n XMITQ(QMA) +\n RQMNAME(QMA) +\n RNAME(QMA.QMB.LOOPBACK.RMT) +\n REPLACE\nENDNote that all of the objects sort out based on the name of the remote QMgr. Some people prefer names likeLOOPBACK.QMB.RMTto make all the loopback queues cluster together in a list of objects or a backup.All of this is a great target for automation since the names of the objects can all be derived from the names of the QMgrs.\n"}
+{"text": "### Human: I'm trying to build a custom mq exit to archive messages that hit a queue. I have the following code.class MyMqExits implements WMQSendExit, WMQReceiveExit{\n\n@Override\npublic ByteBuffer channelReceiveExit(MQCXP arg0, MQCD arg1, ByteBuffer arg2) {\n // TODO Auto-generated method stub\n\n if ( arg2){\n def _bytes = arg2.array()\n def results = new String(_bytes)\n println results;\n }\n\n return arg2;\n}\n...The content of the message (header/body) is in the byte buffer, along with some unreadable binary information. How can I parse the message (including the body and the queue name) from arg2? We've gone through IBM's documentation, but haven't found an object or anything that makes this easy.### Assistant: Assuming the following two points:1) Your sender application has not hard coded the queue name where it puts messages. So you can change the application configuration to send messages to a different object.2) MessageId of the archived message is not important, only message body is important.Then one alternative I can think of is to create an Alias queue that resolves to a Topic and use two subscribers to receive messages.1) Subscriber 1: An administratively defined durable subscriber with a queue provided to receive messages. Provide the same queue name from which your existing consumer application is receiving messages.2) Subscriber 2: Another administratively defined durable subscriber with queue provided. You can write a simple java application to get messages from this queue and archive.3) Both subscribers subscribe to the same topic.Here are steps:// Create a topic\ndefine topic(ANY.TOPIC) TOPICSTR('/ANY_TOPIC')\n// Create an alias queue that points to above created topic\ndefine qalias(QA.APP) target(ANY.TOPIC) targtype(TOPIC)\n// Create a queue for your application that does business logic. If one is available already then no need to create.\ndefine ql(Q.BUSLOGIC)\n// Create a durable subscription with destination queue as created in previous step.\ndefine sub(SB.BUSLOGIC) topicstr('/ANY_TOPIC') dest(Q.BUSLOGIC)\n// Create a queue for application that archives messages.\ndefine ql(Q.ARCHIVE)\n// Create another subscription with destination queue as created in previous step.\ndefine sub(SB.ARCHIVE) topicstr('/ANY_TOPIC') dest(Q.ARCHIVE)Write a simple MQ Java/JMS application to get messages fromQ.ARCHIVEand archive messages.\n"}
+{"text": "### Human: How can we disable authorizations on MQ version 7.0.1.3 on windows platform?I know in version 7.0 you can disable channel authorizations. But I cannot find a way to disable authorizations in 7.0.1.3.### Assistant: The authorizations on 7.0.1.3 can be disabled by putting environment variable MQSNOAUT=yes on both windows and UNIX. The variable has to be set before creation of queue manager and during the life cycle of queue manager, authorizations cannot be re-enabled.Below link explains in detail the use of MQSNOAUT:http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.amqzag.doc%2Ffa13260_.htm\n"}
+{"text": "### Human: I'm very new to ibm mq, I find out the documents or books related to mb are so few, the only one I found is 'WebSphere MQ Using Java' written in 2004. But the real world has changed a lot.\n I installed and verified mq server 7.5 on redhat linux 64 bit successfully according tothisI also created queue managermyqm1, queueLQ.TEST, channelJAVA.CHANNELand did some test through command lines on server to ensure they work well. However when I installed a mq client on windows xp and wrote below java code, it always throw aexception:com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2035'my code:import com.ibm.mq.*; import com.ibm.mq.constants.MQConstants;/** * Simple example program */ public class MQSample {// code identifier\nstatic final String sccsid = \"@(#) MQMBID sn=p000-L120604 su=_H-IvIK4nEeGko6IWl3MDhA pn=MQJavaSamples/wmqjava/MQSample.java\";\n\n// define the name of the QueueManager\nprivate static final String qManager = \"myqm1\";\n// and define the name of the Queue\nprivate static final String qName = \"LQ.TEST\";\n\n/**\n * Main entry point\n *\n * @param args - command line arguments (ignored)\n */\npublic static void main(String args[]) {\n try {\n MQEnvironment.hostname = \"58.2.221.196\"; \n MQEnvironment.channel = \"JAVA.CHANNEL\"; \n MQEnvironment.port = 1414;\n MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);\n MQEnvironment.userID = \"mqm\"; \n MQEnvironment.password = \"mqm\";\n MQEnvironment.CCSID = 1208;\n\n // Create a connection to the QueueManager\n System.out.println(\"Connecting to queue manager: \" + qManager);\n MQQueueManager qMgr = new MQQueueManager(qManager);\n\n // Set up the options on the queue we wish to open\n int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;\n\n // Now specify the queue that we wish to open and the open options\n System.out.println(\"Accessing queue: \" + qName);\n MQQueue queue = qMgr.accessQueue(qName, openOptions);\n\n // Define a simple WebSphere MQ Message ...\n MQMessage msg = new MQMessage();\n // ... and write some text in UTF8 format\n msg.writeUTF(\"Hello, World!\");\n\n // Specify the default put message options\n MQPutMessageOptions pmo = new MQPutMessageOptions();\n\n // Put the message to the queue\n System.out.println(\"Sending a message...\");\n queue.put(msg, pmo);\n\n // Now get the message back again. First define a WebSphere MQ\n // message\n // to receive the data\n MQMessage rcvMessage = new MQMessage();\n\n // Specify default get message options\n MQGetMessageOptions gmo = new MQGetMessageOptions();\n\n // Get the message off the queue.\n System.out.println(\"...and getting the message back again\");\n queue.get(rcvMessage, gmo);\n\n // And display the message text...\n String msgText = rcvMessage.readUTF();\n System.out.println(\"The message is: \" + msgText);\n\n // Close the queue\n System.out.println(\"Closing the queue\");\n queue.close();\n\n // Disconnect from the QueueManager\n System.out.println(\"Disconnecting from the Queue Manager\");\n qMgr.disconnect();\n System.out.println(\"Done!\");\n } catch (MQException ex) {\n ex.printStackTrace();\n System.out.println(\"A WebSphere MQ Error occured : Completion Code \" + ex.completionCode\n + \" Reason Code \" + ex.reasonCode);\n\n\n } catch (java.io.IOException ex) {\n System.out.println(\"An IOException occured whilst writing to the message buffer: \" + ex);\n }\n return;\n} }Can anybody throw a light to me on that? I'm totally down.### Assistant: To expand on Shashi's answer, since WMQ V7.1 the default CHLAUTH rules block all access on all SVRCONN channelsandthey block administrative access on all SVRCONN channels. If you really want to connect toJAVA.CHANNELasmqmthen you will need to overridebothof these behaviors.If you are actually willing to allow remote, unauthenticated connections to the QMgr with an administrative user ID, then you have the option of disabling CHLAUTH rules altogether. You can do this by issuing theALTER QMGR CHLAUTH(DISABLED)command inrunmqschowever this is HIGHLY discouraged because it leaves the QMgr open to anonymous remote code execution using the WMQ administrative user ID. This is, however, what you appear to be trying to do.The recommended approach would be to use an ID that isnotadministrative. For example, if you made an ID calledmquserwith a private group also calledmquserthen you could grant it rights to connect and inquire on the QMgr and to open the designated queue for put, get, browse and inquire. Since the ID is not administrative, it would be relatively safe to use on unauthenticated channels. You could change your code to specify the ID asmquserinstead ofmqmand then use a CHLAUTH rule to allow the connection. For example:SET CHLAUTH('JAVA.CHANNEL') TYPE(USERMAP) +\n CLNTUSER('mquser') USERSRC(MAP) +\n MCAUSER('mquser') ACTION(ADD)The above rule tells the QMgr \"when you see a connection from themquserID onJAVA.CHANNEL, then set MCAUSER tomquserand allow the connection.\"When you grant permissions, remember to grant them on the group and not the user. For example, if usingsetmqautuse the-goption and not the-poption. If there are any issues with authorization errors, you can sort these out easily using event messages. First, enable events using theALTER QMGR AUTHOREV(ENABLED). This will cause the QMgr to emit an event message into theSYSTEM.ADMIN.QMGR.EVENTqueue. You can useSupportPac MH05orSupportPac MS0Pto parse the event messages. For any given authorization event the message tells you the ID that requested access, the API call (connect, open, close etc.), the object the call was made against and the exact options that were used.Prior to WMQ V7.1, WebSphere MQ allowed all remote connections, even anonymous, administrative ones. Although this allowed you to connect easily, in today's more hostile network environment the ability to remotely and anonymously execute code on the QMgr's host server is seen as an unacceptable security risk. So now a new QMgr is set to not allowanyremote administrative access by default. As the administrator this requires you to explicitly disable security to get the old behavior or to explicitly provision secure access.\n"}
+{"text": "### Human: I'd like to write some code to monitor the queue size on Websphere 7 MQ.\nThis is the code I've come up withMQEnvironment.hostname = \"10.21.1.19\"; \n MQEnvironment.port = 1414;\n MQEnvironment.channel = \"SYSTEM.CDEF.SVRCONN\";\n MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);\n\n MQQueueManager qMgr = new MQQueueManager(\"MYQMGR\");\n\n MQQueue destQueue = qMgr.accessQueue(\"PUBLISH\", MQC.MQOO_INQUIRE);\n System.out.println(destQueue.getCurrentDepth());\n destQueue.close();\n qMgr.disconnect();How do I know what the \"Channel\" is?How do I know what the queue manager name is that I pass into MQQueueManager?Or is there another API that I should look at?I need it work with WRS 7 SIB and MQ.Thanks\nJeff Porter### Assistant: I used the jars from WS 7.0.1.1com.ibm.mq.jar\ncom.ibm.mq.jmqi.jar\ncom.ibm.mq.jmqi.system.jar\ncom.ibm.mq.commonservices.jar\ncom.ibm.mq.headers..jar\ncom.ibm.mq.jmqi.remote.jarI got the Queue Manager name and the Channel name from \"IBM Webshpere MQ Explorer\" (Client Connection node in the tree)import com.ibm.mq.MQEnvironment;\n import com.ibm.mq.MQQueue;\n import com.ibm.mq.MQQueueManager;\n import com.ibm.mq.constants.CMQC;\n int openOptions = CMQC.MQOO_INQUIRE + CMQC.MQOO_FAIL_IF_QUIESCING + CMQC.MQOO_INPUT_SHARED;\n\n MQEnvironment.hostname = \"10.2.51.19\";\n MQEnvironment.port = 1414;\n MQEnvironment.channel = \"SW1_QM_CH1\";\n\n MQQueueManager qMgr = new MQQueueManager(\"SW1_QM\");\n\n MQQueue destQueue = qMgr.accessQueue(\"E_RETRY\", openOptions);\n System.out.println(\"E_RETRY size:\" + destQueue.getCurrentDepth());\n destQueue.close();\n qMgr.disconnect();Hope this helps someone else out!\n"}
+{"text": "### Human: I've developed a library using the latest IBM amqmdnet.dll assembly, 9.1.3When I run the .NET Core console application (2.2) I got the following exceptionTypeLoadException: Could not load type 'System.Web.Configuration.WebConfigurationManager' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.I've disassembled the file with dotPeek and it references System.WebStanding atdocumentationit supports .NET Core. The assembly I've created is a standard .NET Class library and when referenced by a .NET Full Framework console application it works.Any suggestion?\nThanks### Assistant: amqmdnet.dllis only for .net framework not core.In the documentationlinkyou provided it states:From IBM MQ Version 9.1.1, the amqmdnetstd.dll library is available for .NET Standard support on Windows. Sample applications, including source files, are also supplied; see Sample applications for .NET.I suggest you useamqmdnetstd.dll.\n"}
+{"text": "### Human: I have a micro-service which subscribes to atopicin WebSphere MQ. The subscription ismanagedanddurable. I explicitly set thesubscription name, so that it can be used to connect back to the queue, after recovering from any micro service failure. The subscription works as expected.But I might have to scale up the micro service and run multiple instances. In this case I will end up with having multiple consumers to the same topic. But here it fails with error2429 : MQRC_SUBSCRIPTION_IN_USE. I am not able to run more than one consumer to the topic subscription. Note : A message should be sent only to one of the consumers.Any thought ?IBM Websphere Version : 7.5\nI use the C-client API to connect to the MQ.### Assistant: When using a subscriber what you describe is only supported via the IBM MQ Classes for JMS API. In v7.0 and later you can use Cloned subscriptions (this is a IBM extension to the JMS spec), in addition in MQ v8.0 and later you can alternately use Shared subscriptions which is part of the JMS 2.0 spec. With these two options, multiple subscribers can be connected to the same subscription and only one of them will receive each published message.UPDATE 20170710According to this APARIV96489: XMS.NET DOESN'T ALLOW SHARED SUBSCRIPTIONS EVEN WHEN CLONESUP PROPERTY IS ENABLED, XMS.NET is also supposed to support Cloned subscriptions but due to a defect this is will not be supported until 8.0.0.8 or 9.0.0.2 or if you request the IFIX for the APAR above.You can accomplish something similar with other APIs like C by converting your micro-service to get from a queue instead of subscribing to a topic.To get the published messages to the queue you have two options:Setup a administrative subscription on the queue manager. You can do this a few different ways. The example below would be using a MQSC command.DEFINE SUB('XYZ') TOPICSTR('SOME/TOPIC') DEST(SOME.QUEUE)Create a utility app that can open a queue and create a durable subscription with that provided queue, the only purpose of this app would be to subscribe and unsubscribe a provided queue, it would not be used to consume any of the published messages.Using the above method, each published message can only be read (GET) from the queue by one process or thread.\n"}
+{"text": "### Human: Can there more than one listener to a queue manager ? I have used one listener/queue manager combination so far and wonder if this possible. This is because we have 2 applications connecting to same queue manager and seems to have problem with that.### Assistant: There are a couple meanings for the termlistenerin an MQ context. Let's see if we can clear up some confusion over the terminology and then answer the question as it relates to each.As defined in the spec, aJMS listeneris an object that implements a callback mechanism. It listens on destinations for messages and callsonMessagewhen they arrive. The destinations may be queues or topics hosted by any JMS-compliant transport provider.In IBM MQ terms, alisteneris a process (runmqlsr) that handles inbound connection requests on a server. Although these can handle a variety of protocols, in practice they are almost exclusively TCP listeners that bind a port (1414 by default) and negotiate connection requests on sockets.TCP PortsTim's answer applies to the second of these contexts. MQ can listen for sockets on multiple ports and indeed it is quite common to do so. Each listener listens on one and only one port. It may listen on that port across all network interfaces or can be bound to a specific network interface. No two listeners can bind to the same combination of interface and port though.In a B2B context the best practice is to run a dedicated listener for each external business partner to isolate each of their connections across dedicated access paths. Internally I usually recommend separate ports for QMgr-to-QMgr, app-to-QMgr and interactive user connections.In that sense it is possible to run multiple listeners on a given QMgr. Each of those listeners can accept many connections. Their job is to negotiate the connection then hand the socket off to a Message Channel Agent which talks to the QMgr on behalf of the remotely connected client or QMgr.JMS ListenersBased on comments, Ulab refers to JMS listeners. These objects establish a connection to a queue manager and then wait inGETmode for new messages arriving on a destination. On arrival of a message, they call theonMessagemethod which is an asynchronous callback routine.As to the question \"can there more than one (JMS) listener to a queue manager?\" the answer is definitely yes. A multi-threaded application can have multiple listeners connected, multiple application instances can connect at the same time, and many thousands of application connections can be handled by a single queue manager with sufficient memory, disk and CPU available.Of course, each of these applications is ultimately connected to one or more queues so then the question becomes one of whether they can connect tothe samequeue.Many listeners can listen on the same queue so long as they do not get exclusive access to it. Each will receive a portion of the messages arriving.Listeners on QMgr-managed subscriptions are exclusively attached to a dynamic queue but multiple instances on the same topic will all receive the same messages.If the queue is clustered and there is more than one instance of it multiple listeners will be required to get all the messages since they will normally be distributed by MQ workload distribution across those instances.\n"}
+{"text": "### Human: i'm trying to make transactional an entire flow of Spring integration, the flow starts with an adapter to an IBM MQ Queue, and then we have a complex flow with ActiveMQ Queues, and i'm getting a com.atomikos.icatch.HeurHazardException: Heuristic Exception when atomikos is trying to register the resources.Here's my applicationContext.xml.\n \n \n \n \n \n\n\n\n \n \n \n\n\n\n \n\n\n\n \n \n \n\n\n\n \n \n\n\n \n \n \n \n\n\n\n \n \n \n\n\n\n\n\n.\n. //OTHER SPRING INTEGRATION ELEMENTS\n.\n //Final Channel to the output adapter.\n\n\n\n \n \n \n \n com.atomikos.icatch.standalone.UserTransactionServiceFactory\n \n \n \n\n\n\n \n \n\n\n\n \n\n\n\n\n \n \n \n \n\n\n \n\n\n\n \n \n \nThis is the exception:INFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING core version: 3.9.3\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.automatic_resource_registration = true\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.client_demarcation = false\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.threaded_2pc = false\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.serial_jta_transactions = true\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.serializable_logging = true\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.log_base_dir = .\\\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.max_actives = 50\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.checkpoint_interval = 500\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.enable_logging = true\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.output_dir = .\\\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.log_base_name = tmlog\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.max_timeout = 300000\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.tm_unique_name = 10.200.204.8.tm\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING java.naming.factory.initial = com.sun.jndi.rmi.registry.RegistryContextFactory\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING java.naming.provider.url = rmi://localhost:1099\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.service = com.atomikos.icatch.standalone.UserTransactionServiceFactory\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.force_shutdown_on_vm_exit = false\nINFO com.atomikos.icatch.config.imp.AbstractUserTransactionService USING com.atomikos.icatch.default_jta_timeout = 10000\nWARN com.atomikos.datasource.xa.XAResourceTransaction XAResourceTransaction 10.200.204.8.tm001540002610.200.204.8.tm157: no XAResource to commit - the required resource is probably not yet intialized?\nWARN com.atomikos.icatch.imp.CommitMessage Unexpected error in commit\ncom.atomikos.icatch.HeurHazardException: Heuristic Exception\nat com.atomikos.datasource.xa.XAResourceTransaction.commit(XAResourceTransaction.java:707)\nat com.atomikos.icatch.imp.CommitMessage.send(CommitMessage.java:72)\nat com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:83)\nat com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:79)\nat com.atomikos.icatch.imp.Propagator.submitPropagationMessage(Propagator.java:58)\nat com.atomikos.icatch.imp.HeurHazardStateHandler.onTimeout(HeurHazardStateHandler.java:131)\nat com.atomikos.icatch.imp.CoordinatorImp.alarm(CoordinatorImp.java:933)\nat com.atomikos.timing.PooledAlarmTimer.notifyListeners(PooledAlarmTimer.java:112)\nat com.atomikos.timing.PooledAlarmTimer.run(PooledAlarmTimer.java:99)\nat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\nat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\nat java.lang.Thread.run(Thread.java:744)I need the entire flow from the inputChannel to concentradorOutputChannel to be within the TX.Thanks for your help.### Assistant: Solved, just needed to remove the files tmlog.lck and tmlog6.log\n"}
+{"text": "### Human: I have connected remotely to a QMgr via MQ Explorer on Windows. The MQ server version is 7.5.0.1. I can put messages inSYSTEM.ADMIN.COMMAND.EVENTfrom MQ Explorer successfully and when I dumpSYSTEM.ADMIN.COMMAND.EVENT, I can see my messages. As long as I know, I should be able to run PCF commands and MQSC commands via this channel. So, I putDISPLAY QMGR ALLmessage inside this queue and I can successfully see this message on MQ Server. My question is how can I run this message remotely via this channel? Thanks.IBM Doc indicates that I should be able to receive the command result inSYSTEM.MQSC.REPLY.QUEUE. But I can not browse this queue from client MQ Explorer. The queue type for this queue isModel.### Assistant: Couple of problems here.First, you are using the wrong queue. The command server listens onSYSTEM.ADMIN.COMMAND.QUEUE. The queue to which you are sending messages,SYSTEM.ADMIN.COMMAND.EVENTis the queue to which the QMgr puts event messages after executing commands, provided of course that command events are enabled.The second problem, as Jason mentions, is that therunmqscprocessor takes human-readable script and converts it into commands the QMgr can understand. Passing textual commands directly to the command server won't work.Typically we do what you want by passing the commands to runmqsc directly such as...echo DISPLAY QMGR ALL | runmqsc MYQMGRNAMEIf you require the ability to do this as a client, then you want to either downloadSupportPac MO72, or head over to MQ Gem and pick up a copy ofMQSCX. Either of these will accept the command above on a local queue manager, and both can also be supplied with MQ Channel params and connect to a remote QMgr.In addition to this basic functionality, the MQSCX product also has its own internal script parsing and execution. Suppose, for instance, that you want to do something depending on the command level of the QMgr.Usingrunmqscyou could issue the command above, filter the resulting 2-column output throughgrep,awk, or similar, then capture the final output into a variable. You might need to do this multiple times to capture multiple values, invoking a newrunmqsceach time and parsing the output in your script. You must then generate the string for the actual command you wanted to run when you started all this, and pass it to another invocation ofrunmqsc.Alternatively, MQSCX lets you issue theDISPLAYcommand, then reference the resulting values directly by name. For example, you can pass MQSCX a couple lines of script telling it to inquire on the QMgr and then take a conditional action based on the command version, all without ever having to drop back into shell, bat or Perl script.Full disclosure, I do not work for or get a commission from MQ Gem. I just don't like to beat my head against the wall writing 100 lines of code where 2 will do. If you do any amount of MQSC scripting, the ROI on MQSCX is measured in minutes. And it happens to be 100% on-topic as an answer to this question.\n"}
+{"text": "### Human: I want to log messages that come into MQ Queue to database/file or another logging queue and I can not modify existing code. Are there any methods to implement some kind of message logging utility that will act like HTTP sniffer? Or maybe MQ have some built-in finctionality to log messages?Thanks in advance for your ansers.### Assistant: I think this is possible by creating ALIAS QUEUE that points to a topic.AssumingRECV.Qas the queue that your application currently receives messages from and processes.1) First create a topic, sayLOG.TO.DATABASE.2) Then create an alias queueALIAS.LOG.TO.DATABASEwithBase objectset toLOG.TO.DATABASEand setBase TypeasTopic.3) Then create a local queueLOG.TO.DATABASE.Q4) Create a durable subscription,SUB.FOR.RECV.Qthat points toRECV.Qas destination.5) Create another durable subscriptionSUB.FOR.LOG.TO.DABASEthat points toLOG.TO.DATABASE.Qas destinationNow the sender application need to put messages toALIAS.LOG.TO.DATABASE. Since the alias queue actually points to topic, the messages gets published ontoLOG.TO.DATABASE. To this topic we have two subscriptions registered, so both will get the same message. Your consumer application will continue to work as is whereas a new application can be written to process messages from other subscription.\n"}
+{"text": "### Human: On several occasions I have received the following error from a .Net (C#, 4.0) application out of the blue on sending a message thru a producer:CWSMQ0082E: Failed to send to CompCode: 2, Reason: 2009. A problem was encountered whilst sending a message. See the linked exception for more information.Of course, theLinkedException(why not use theInnerExceptionIBM???) is null i.e. no more information available.Code I'm using (pretty straightforward):var m = _session.CreateBytesMessage();\nm.WriteBytes(mybytearray);\n\nm.JMSReplyTo = myreplytoqueue;\nm.SetIntProperty(XMSC.JMS_IBM_MSGTYPE, MQC.MQMT_DATAGRAM);\n\nm.SetIntProperty(XMSC.JMS_IBM_REPORT_COA, MQC.MQRO_COD);\nm.SetIntProperty(XMSC.JMS_IBM_REPORT_COD, MQC.MQRO_COA);\n\nmyproducer.Send(m, DeliveryMode.Persistent, mypriority, myttl);(Offtopic: I hate theSetIntPropertyway of setting properties. Which came up with that idea? It takes ages to look up all sorts of constants all over the place and its allowed values.)The exception is thrown on the .Send method. I'm using XMS.Net (IA9H / 2.0.0.7). Theonly Google resultthatturns upturns out to have a different reason code (and even if it were the same, it should be fixed in my version if I understand correctly). This occurs randomly (though it seems to happen more often when it's been a while since a message has been sent/received) and I have no way to reproduce this.I have ab-so-lute-lynoidea how to troubleshoot this or even where to start looking. Is this something caused by the server-side? Is it caused by XMS.net or some underlying IBM WebSphere MQ infrastructure?Some results that I found thatseemsimilar are suggesting to setSHARECNVto any value higher than 0 or to \"true\" / \"yes\" butthe documentationexplicitly tells me the default is 10. Also; I have no idea if this is the cause so changing it to another value feels like a shotgun approach.Anybody any idea on how to go about solving this? I could of course just catch the exception, tear everything (channels, sessions, whatever) down and restart but that's just plain ugly IMHO.### Assistant: The 2009 return code means \"Connection Broken.\" Basically, the underlying TCP socket is gone and the client finds out about it at the time of the API call. It is possible to tune the channels using heartbeat and keepalive so that WMQ tries harde to keep the socket alive. However if the socket is timed out by the underlying infrastructure, nothing WMQ can do will help. Examples we've seen are that firewalls and load balancers are often set to detect idle connections and sever them.Modern versions of WMQ client will attempt toreconnect transparently. The application just blocks a bit longer when this occurs.Short of using the automatic reconnect, the only solution is in fact to rebuild the connection. Since it will get a new connection handle, all the object handles must be rebuilt as well.Many of the tuning functions described here are available through theclient configuration file, available in v7.0 and greater clients. In particular, theTCP stanzaof that file enables keepalive. (The TCP spec says that if keepalive is provided, it must be disabled by default.) The QMgr hasa similar ini filewith configuration stanzas, including one for keepalive. The latest WMQ client is available asSupportPac MQC71if you need that.\n"}
+{"text": "### Human: Does anyone know if there is an implementation ofjavax.jms.QueueConnectionFactoryfor WebSphere MQ and where to get it? I Googled it and searched IBM website but couldn't find anything. I don't want to retrieve the connection or factory from Websphere MQ via JNDI, I need my own connection factory.### Assistant: I think you need three jarscom.ibm.mq.jar\ncom.ibm.mqbind.jar\ncom.ibm.mqjms.jarYou instantiate aMQQueueConnectionFactoryand i hope you can take it from there.And here's more info:IBMs HOWTOOh, and MQ can do \"real\" JMS instead of MQ - only the JMS implementation seemed to have problems closing the Channel properly - at least in our environment.\n"}
+{"text": "### Human: I have Sender and receiver console applications for IBM MQ XMS. The sender populates the Queue and the receiver dequeue the queue manger using receive method. I am using the while loop with bool value to keep running the receiver so that whenever a new message is available in the queue receiver can get that data.\nNow i want to change the receiver code to Asynchronous Message Listener instead of consumer.Receive().\nThe code snippet is,consumerAsync = sessionWMQ.CreateConsumer(destination); \nmessageListener = new MessageListener(OnMessageCallBack);\nconsumerAsync.MessageListener = messageListener;\n\nconnectionWMQ.Start();\nWhile(true)\n{\n console.writeline(\"Wait for message\");\n}The above code fetches only the already available data and not the new one. For example if i have 2 data in my queue while starting the receiver application those messages getting downloaded. but when i keep the receiver application running and send a new data from sender app its not getting downloaded and i have to restart the receiver application to get that data. The similar scenario was working fine with\nsynchronous mode consumer.ReceiveNoWait().What am I missing?### Assistant: Version of XMS? Version 9.2 has a bug that was confirmed by IBM 10.28.2020. They're working on a fix.No APAR yet.Temporary solution would be to downgrade to client version 9.1.Update: Received a fix built on version 9.2.0.1IT34722. Tested ok. Should be released with fixpack 9.2.0.4.\n"}
+{"text": "### Human: I am currently reading from a remote queue, which is filled with transactions (messages). I am reading it by accessing the queue and measuring the size of records.getOptions.options = MQC.MQGMO_CONVERT + MQC.MQGMO_WAIT;queue.getCurrentDepth();Only when the size of the queue is greater than 0. I proceed to get the message.My problem is that for some messages I get the following error:\nMQJE001: Completion Code '2', Reason '2033'.But only for some messages, the funny thing is that I have a custom retry variable and the 3rd retry gets a blank message.My possible solutions:At first I thought it could be the waitInterval and I have been varying it from 150 ms to 30 seconds. For some messages I get them correctly in less than 100 ms. But the messages that give me problems take all the waitInterval and then give the error and get the blank message to the third retry.The second test was to verify the parameters of the MQMessage class, where I originally have:messageType: 8encoding: 273format:characterSet: 0When I get a message correctly, the following parameters remain:messageType: 8encoding: 273format: MQSTRcharacterSet: 819When I have a message that causes error 2033 at the third retry I get a blank message and the parameters change to the following:messageType: 8encoding: 273format:characterSet: 819I came to think that the messages in the queue were not indicating the correct format. So I contacted support and they verified that all messages have the correct conversion headers.So I am still in doubt as to why this problem, if someone has faced something similar, would appreciate your comment. Thank you.### Assistant: You are treating IBM MQ as a database and that will cause you all kinds of grief.This is how you should be retrieving the messages:MQGetMessageOptions gmo = new MQGetMessageOptions();\ngmo.options = CMQC.MQGMO_WAIT + CMQC.MQGMO_FAIL_IF_QUIESCING;\ngmo.waitInterval = 5000; // wait up to 5 seconds\nMQMessage receiveMsg = null;\nboolean getMore = true;\n\nwhile(getMore)\n{\n receiveMsg = new MQMessage();\n\n try\n {\n // get the message on the queue\n queue.get(receiveMsg, gmo);\n\n /*\n * Now go do something with the message\n */\n }\n catch (MQException e)\n {\n if ( (e.completionCode == CMQC.MQCC_FAILED) &&\n (e.reasonCode == CMQC.MQRC_NO_MSG_AVAILABLE) )\n {\n // No message - loop again\n }\n else\n {\n System.out.println(\"MQException: \" + e.getLocalizedMessage());\n System.out.println(\"CC=\" + e.completionCode + \" : RC=\" + e.reasonCode);\n getMore = false;\n }\n }\n catch (IOException e)\n {\n System.out.println(\"IOException:\" +e.getLocalizedMessage());\n }\n}\n"}
+{"text": "### Human: We have enabled SSL onMQ version '7.1.0.7'OS->'Linux 2.6.32-642.11.1.el6.x86_64'two months back [aug-2016] and its working fine with SSL enabled and disabled modeJava Client usesjdk1.7.0_21Worked cipher/suite ->SSL_RSA_WITH_RC4_128_SHA <> RC4_SHA_USWhen I try to connect to a MQ v7.1.0.7 queue manager the application is throwing below error:com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2397'.\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:228)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:553)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:593)\n at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:95)\n at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:198)\n at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:882)In the queue manager error logAMQERR01.LOGI see this:AMQ9616: The CipherSpec proposed is not enabled on the server.\n\n EXPLANATION: The SSL or TLS subsystem at the server end of a channel\n been configured in such a way that it has rejected the CipherSpec\n proposed by an SSL or TLS client. This rejection occurred during the\n secure socket handshake (i.e. it happened before the proposed\n CipherSpec was compared with the CipherSpec in the server channel\n definition).We have aMQ v6.0.2.12queue manager where this is working fine.Could some one provide help what went wrong for system , which was working before?Resolved by adding below lines in qm.ini fileSSL:\n AllowSSLV3=Y\n AllowWeakCipherSpec=YUpdated (2017/01/27) with additional questions:Worked belowTLSv1TLS_RSA_WITH_DES_CBC_SHA SSL_RSA_WITH_DES_CBC_SHA TLSv1 TRUETLS_RSA_WITH_3DES_EDE_CBC_SHA SSL_RSA_WITH_3DES_EDE_CBC_SHA TLSv1 TRUEFailed withTLSv1.2TLS_RSA_WITH_RC4_128_SHA256 SSL_RSA_WITH_RC4_128_SHA TLSv1.2 FALSEI tried with these settings:SSLContext sslContext = SSLContext.getInstance(\"TLSv1\");-Dcom.ibm.mq.cfg.preferTLS=true-Dcom.ibm.mq.cfg.useIBMCipherMappings=falseError iscom.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2397'In theAMQERR01.LOGThere is a mismatch between the CipherSpecs on the local and remote ends\nof channel 'TEST.CH'. The channel will not run until this mismatch is \nresolved.The CipherSpec required in the local channel definition is \n'TLS_RSA_WITH_RC4_128_SHA256'. The name of the CipherSpec negotiated during\nthe SSL handshake is 'RC4_SHA_US'. A code is displayed if the name of the\nnegotiated CipherSpec cannot be determinedUpdated (2017/01/29) with additional questions:SSLContext sslContext = SSLContext.getInstance(\"TLSv1.2\");MQEnvironment.sslFipsRequired = true;MQEnvironment.sslCipherSuite =\"SSL_RSA_WITH_AES_256_CBC_SHA256\";ALTER CHANNEL(TEST.CH) CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_AES_256_CBC_SHA256)REFRESH SECURITY TYPE(SSL)Client Execute/apps/java/jdk1.7.0_21/bin/java -Dcom.ibm.mq.cfg.preferTLS=true -Dcom.ibm.mq.cfg.useIBMCipherMappings=false -classpath .:/tmp/mqssl/com.ibm.mq.jmqi.jar:/tmp/mqssl/com.ibm.mq.jar:com.ibm.ws.webservices.thinclient_8.5.0.jar MQProducerSSLGetting error asMQJE001: Completion Code '2', Reason '2400'MQRC_UNSUPPORTED_CIPHER_SUITE (2400)Updated (2017/01/30) with additional questions:Still same error , but in my client java prg have enabledSystem.setProperty(\"javax.net.debug\", \"all\");to see all activities while execute client. Its PrintingTLS_RSA_WITH_AES_256_CBC_SHA256asIgnoring unavailable cipher suiteas belowIgnoring unavailable cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256Before callMQJE001: Completion Code '2', Reason '2400'. \nMQJE001: Completion Code '2', Reason '2400'.Tested with IBM-JDK-71 Same ExceptionSSL_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA<><>ECDHE_ECDSA_3DES_EDE_CBC_SHA256SSL_ECDHE_RSA_WITH_NULL_SHA<><>ECDHE_RSA_NULL_SHA256Updated (2017/01/31) with additional questions:com.ibm.mq.jarSpecification-Version: 7.1.0.1 \nSpecification-Vendor: IBM Corporation \nImplementation-Title: WebSphere MQ classes for Java \nImplementation-Version: 7.1.0.1 - k710-001-120424com.ibm.mq.jmqi.jarSpecification-Version: 7.1.0.1 \nSpecification-Vendor: IBM Corporation \nImplementation-Title: WebSphere MQ Interface for Java \nImplementation-Version: 7.1.0.1 - k710-001-120424Updated (2017/01/31 A) with additional questions:Since MQ and Client Running in same machine ,gotSpecification-Version: 7.1.0.7jarsTesting done with 2 scenariosby changing the classpathWithout-Dcom.ibm.mq.cfg.useIBMCipherMappings=falsejdk1.7.0_21/bin/java -Dcom.ibm.mq.cfg.preferTLS=true -classpath .:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:/opt/mqm/java/lib/com.ibm.mq.jar MQProducerSSLgot exceptionMQJE001: Completion Code '2', Reason '2400'With-Dcom.ibm.mq.cfg.useIBMCipherMappings=false/apps/hostlink/java/jdk1.7.0_21/jdk1.7.0_21/bin/java -Dcom.ibm.mq.cfg.preferTLS=true -Dcom.ibm.mq.cfg.useIBMCipherMappings=true -classpath .:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:/opt/mqm/java/lib/com.ibm.mq.jar MQProducerSSLgot exceptionMQJE001: Completion Code '2', Reason '2393'com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2393'. \nat com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:232) \nat com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:553) \nat com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:593) \nat com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:96) \nat com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:198) \nat com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:893) \nat com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:780) \nat com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:729) \nat com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:177) \nat com.ibm.mq.MQQueueManager.(MQQueueManager.java:674) \nat MQProducerSSL.main(MQProducerSSL.java:89) \nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2393;AMQ9204: Connection to host 'localhost(2017)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2393;AMQ9771: SSL handshake failed. [1=java.lang.IllegalArgumentException[Cannot support TLS_RSA_WITH_AES_256_CBC_SHA256 with currently installed providers],3=localhost/127.0.0.1:2017 (localhost),4=SSLSocket.createSocket,5=default]],3=localhost(2017),5=RemoteTCPConnection.makeSocketSecure]Updated (2017/01/31 B) with additional questions:MQEnvironment.sslFipsRequired = false; \nMQEnvironment.sslCipherSuite = \"TLS_RSA_WITH_AES_128_CBC_SHA256\"; \nALTER CHANNEL(TEST.CH) CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_AES_128_CBC_SHA256) \n/apps/hostlink/java/jdk1.7.0_21/jdk1.7.0_21/bin/java -Dcom.ibm.mq.cfg.preferTLS=true -Dcom.ibm.mq.cfg.useIBMCipherMappings=false -classpath .:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:/opt/mqm/java/lib/com.ibm.mq.jar MQProducerSSLMQJE001: Completion Code '2', Reason '2397'.MQJE001: Completion Code '2', Reason '2397'.\ncom.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2397'.\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:232)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:553)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:593)\n at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:96)\n at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:198)\n at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:893)\n at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:780)\n at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:729)\n at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:177)\n at com.ibm.mq.MQQueueManager.(MQQueueManager.java:674)\n at MQProducerSSL.main(MQProducerSSL.java:89)Worked below TLSv1----Spec----TLS_RSA_WITH_DES_CBC_SHA---Suite----SSL_RSA_WITH_DES_CBC_SHATLSv1 TRUENot working , when given below parameters , throwing **MQJE001: Completion Code '2', Reason '2400'** \n\n-Dcom.ibm.mq.cfg.useIBMCipherMappings=false \n-Dcom.ibm.mq.cfg.preferTLS=truedoubt on TLSv1 , if TLSv1 working without above parameters , why need to provide -Dcom.ibm.mq.cfg.preferTLS=true for TLSv2?even with IBM-JDK 7.1 also TLSv2 not working, what could be issue?Need to try with MQ8?Updated (2017/02/01) with additional questions:Complete Exception in consoleMQJE001: Completion Code '2', Reason '2397'.\ncom.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2397'.\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:232)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:553)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:593)\n at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:96)\n at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:198)\n at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:893)\n at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:780)\n at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:729)\n at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:177)\n at com.ibm.mq.MQQueueManager.(MQQueueManager.java:674)\n at MQProducerSSL.main(MQProducerSSL.java:89)\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9204: Connection to host 'localhost(2017)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Error signing certificate verify],3=localhost/127.0.0.1:2017 (localhost),4=SSLSocket.startHandshake,5=default]],3=localhost(2017),5=RemoteTCPConnection.protocolConnect]\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2098)\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1347)\n at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:924)\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:221)\n ... 10 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Error signing certificate verify],3=localhost/127.0.0.1:2017 (localhost),4=SSLSocket.startHandshake,5=default]\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1310)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:714)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:356)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:265)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:144)\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1709)\n ... 13 more\nCaused by: javax.net.ssl.SSLHandshakeException: Error signing certificate verify\n at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)\n at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1886)\n at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)\n at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:987)\n at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:285)\n at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)\n at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)\n at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)\n at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)\n at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)\n at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1280)\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1273)\n at java.security.AccessController.doPrivileged(Native Method)\n at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1271)\n ... 18 more\nCaused by: java.security.NoSuchAlgorithmException: SHA224withRSA Signature not available\n at java.security.Signature.getInstance(Signature.java:224)\n at sun.security.ssl.JsseJce.getSignature(JsseJce.java:241)\n at sun.security.ssl.HandshakeMessage$CertificateVerify.(HandshakeMessage.java:1552)\n at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:982)\n ... 29 morefrom AMQERR01.LOG----- amqrmrsa.c : 930 --------------------------------------------------------\n01/31/2017 08:45:00 PM - Process(14444.328) User(mqm) Program(amqrmppa)\n Host(testvm) Installation(Installation1)\n VRMF(7.1.0.7) QMgr(TLSTEST.QM)\n\nAMQ9665: SSL connection closed by remote end of channel '????'.\n\nEXPLANATION:\nThe SSL or TLS connection was closed by the remote host 'localhost (127.0.0.1)'\nduring the secure socket handshake. The channel is '????'; in some cases its\nname cannot be determined and so is shown as '????'. The channel did not start.\nACTION:\nCheck the remote end of the channel for SSL and TLS errors. Fix them and\nrestart the channel.\n----- amqccisa.c : 6478 -------------------------------------------------------\n01/31/2017 08:45:00 PM - Process(14444.328) User(mqm) Program(amqrmppa)\n Host(testvm) Installation(Installation1)\n VRMF(7.1.0.7) QMgr(TLSTEST.QM)\n\nAMQ9492: The TCP/IP responder program encountered an error.\n\nEXPLANATION:\nThe responder program was started but detected an error. \n\nThe host name was 'localhost (127.0.0.1)'; in some cases the host name cannot\nbe determined and so is shown as '????'.\nACTION:\nLook at previous error messages in the error files to determine the error\nencountered by the responder program.\n----- amqrmrsa.c : 930 --------------------------------------------------------removed old jars from classpath , but still same exceptionConsole Output have below lines printed for Algorithmmatching alias: ibmwebspheremqtlstest.qm\n*** Certificate chain\nchain [0] = [\n[\n Version: V3\n Signature Algorithm: SHA1withRSA,In client , passing key.jks file , which is created at MQ level with 'runmqckm'whether need to specify different Algorithm on creation for TLSv2 ?TLSV2 WORKED WITH JDK8 and ibm/java-x86_64-71SSLContext sslContext = SSLContext.getInstance(\"TLSv1.2\");Oracle JDK8MQEnvironment.sslFipsRequired = false; \nMQEnvironment.sslCipherSuite = \"TLS_RSA_WITH_AES_128_CBC_SHA256\"; \nALTER CHANNEL(TEST.CH) CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_AES_128_CBC_SHA256)IBM-JDK 7.1MQEnvironment.sslFipsRequired = false;\nMQEnvironment.sslCipherSuite = \"SSL_RSA_WITH_NULL_SHA256\";\nALTER CHANNEL(TEST.CH) CHLTYPE(SVRCONN) SSLCIPH(TLS_RSA_WITH_NULL_SHA256)But question onhow to work any TLSv2 cipher with lesser version of Oracle java than 8?To resolve/work-around the issue:will try one by one1) use the IBM JVM2) test with Oracle Java v83) Try MQ v84) other option to setSSLCAUTH=OPTIONALand not require client side certificate.Trying with JDK8 and MQ8Now Trying to do the same with JDK8 + MQ8 , MQServer8 and MQSeriesGSKit-8.0.0-4.x86_64 installed , but now issue with creating certificate with runmqckm commandexport LD_LIBRARY_PATH=/opt/mqm/gskit8/lib64 \nexport PATH=$PATH:/opt/mqm/gskit8/bin \nrunmqckm \n\nbash: runmqckm: command not foundpartially Worked with runmqakmBut failed to create jks files as belowrunmqakm -keydb -create -db /var/mqm/qmgrs/TLSTEST\\!QM/ssl/key.jks -pw password -type jks \nCTGSK3017W The database type \"jks\" is not recognized.ResolvedNo Need to set below pathexport LD_LIBRARY_PATH=/opt/mqm/gskit8/lib64 \nexport PATH=$PATH:/opt/mqm/gskit8/bin### Assistant: IBM MQFix Pack 7.1.0.7released November 19th 2015 includes the following APAR:IV73396: DEPRECATION OF SSLV3 CIPHERSPECS IN WEBSPHERE MQ V7 QUEUE MANAGERSPROBLEM DESCRIPTION:Once this change is applied, any queue managers created will disallow the use of the following CipherSpecs on channel definitions associated with the queue manager:AES_SHA_USRC4_SHA_USRC4_MD5_USTRIPLE_DES_SHA_USDES_SHA_EXPORT1024RC4_56_SHA_EXPORT1024RC4_MD5_EXPORTRC2_MD5_EXPORTDES_SHA_EXPORTNULL_SHANULL_MD5FIPS_WITH_DES_CBC_SHAFIPS_WITH_3DES_EDE_CBC_SHAAttempting to use or configure one of these CipherSpecs will result in one or more of the following messages in the queue manager error log: AMQ8242,AMQ9616, AMQ9635.This was a result of SSLv3 being formally deprecated in June 2015 as a result of the IETF approving and publishingRFC7568IntroductionSince it was released in 1996, the SSLv3 protocol [RFC6101] has been subject to a long series of attacks, both on its key exchange mechanism and on the encryption schemes it supports. Despite being replaced by TLS 1.0 [RFC2246] in 1999, and subsequently TLS 1.1 in 2002 [RFC4346] and 1.2 in 2006 [RFC5246], availability of these replacement versions has not been universal. As a result, many implementations of TLS have permitted the negotiation of SSLv3.The predecessor of SSLv3, SSL version 2, is no longer considered sufficiently secure [RFC6176]. SSLv3 now follows.There is a very good IBM developerWorks blog post \"SSL and TLS Cipher Specification Deprecations for the MQ Product\" posted May 19 2016 by Miguel A. Rodriguez that goes into detail about which ciphers are deprecated in various Fix Packs.I would recommend that you find a supported TLSv1.2 cipher to use that is compatible with both the Java client and the IBM MQ SVRCONN channel. There were many updates as a result of SSLv3 being deprecated which opened up more TLS ciphers to Java clients using either IBM or Non-IBM JREs.A good write up about the changes IBM made to the Java client cipher support is IBM developerWorks blog post \"MQ Java, TLS Ciphers, Non-IBM JREs & APARs IT06775, IV66840, IT09423, IT10837 -- HELP ME PLEASE!\" posted on June 9th 2016 by Tom Leend.The reason you do not have a problem with IBM MQ v6.0.2.12 is because that version has been out of support for over four years (since September 30th 2012) and IBM would not release any security updates for a End of Service version like it does for supported versions.I would recommend that you move to a supported version of IBM MQ. When considering which version to upgrade to, note that two of thecurrentlysupported versions will be going out of support over the next 16 months:MQ v7.1 goes out of support in less than four months onApril 30th 2017.MQ v7.5 goes out of support onApril 30th 2018.MQ v8.0 and v9.0 do not have currently announced end of support dates.IBM developerWorks blog post \"MQ Java, TLS Ciphers, Non-IBM JREs & APARs IT06775, IV66840, IT09423, IT10837 -- HELP ME PLEASE!\" states that APARIV66840which added theuseIBMCipherMappingssetting is included in 7.1.0.7 and this should allow the use of TLSv1.2 Cipherspecs with a Oracle JRE.The table in the APARIV66840has this information:The following WebSphere MQ CipherSuite to CipherSpec mappings have\nbeen enabled by this APAR for WebSphere MQ v7.1 and v7.5 where the\nclasses for Java and classes for JMS support SHA-2:\ufff4Oracle CipherSuite IBM MQ CipherSpec\nTLS_RSA_WITH_NULL_SHA256 TLS_RSA_WITH_NULL_SHA256\nTLS_RSA_WITH_AES_128_CBC_SHA256 TLS_RSA_WITH_AES_128_CBC_SHA256\nTLS_RSA_WITH_AES_256_CBC_SHA256 TLS_RSA_WITH_AES_256_CBC_SHA256If you compare that to the v7.1 Knowledge center pageSpecifying CipherSpecs, you find that all three of those are TLSv1.2 Cipherspecs.For comparison with the IBM JRE Ciphersuite name, the v7.1 Knowledge center pageSSL CipherSpecs and CipherSuites in WebSphere MQ classes for Javalists a similar mapping:IBM CipherSuite IBM MQ CipherSpec\nSSL_RSA_WITH_NULL_SHA256 TLS_RSA_WITH_NULL_SHA256\nSSL_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_256_CBC_SHA\nSSL_RSA_WITH_AES_256_CBC_SHA256 TLS_RSA_WITH_AES_256_CBC_SHA256UPDATE (2017/01/27) to address further questionsThe MQ CipherSpec TLS_RSA_WITH_RC4_128_SHA256 is not one of those listed in APARIV66840has having been enabled for non-IBM JREs under MQ v7.1, it is only listed under v8.0. Above I listed the three TLSv1.2 CipherSpecs that were added to MQ v7.1.I would suggest you try TLS_RSA_WITH_AES_256_CBC_SHA256 as the CipherSpec on the MQ channel and TLS_RSA_WITH_AES_256_CBC_SHA256 as the Java CipherSuite.The settings below should work with the my suggested CipherSpec/CipherSuite, please note that I changed it fromTLSv1toTLSv1.2SSLContext sslContext = SSLContext.getInstance(\"TLSv1.2\");\n-Dcom.ibm.mq.cfg.preferTLS=true\n-Dcom.ibm.mq.cfg.useIBMCipherMappings=falseUPDATE (2017/01/30) to try and address further questionsIn your question you mention these jar files in your classpath:/tmp/mqssl/com.ibm.mq.jmqi.jar:/tmp/mqssl/com.ibm.mq.jarWill you please confirm which version of the IBM MQ product each of these are from, you can do this on linux with the unzip utility:unzip -p com.ibm.mq.jar META-INF/MANIFEST.MF|grep Implementation-VersionOutput will be:Implementation-Version: x.x.x.x - pxxx-xxx-YYMMDDUPDATE (2017/01/31) to address further questionsAPARIV66840which includes the-Dcom.ibm.mq.cfg.useIBMCipherMappings=falsesetting is not included in MQ until v7.1.0.7, this is the version you stated is being used.Based on the output you provided the jar files you are referencing are from a v7.1.0.1 install which doesnotinclude support for TLS on non-IBM JREs such as Oracle JRE.You also note that the jar files are in/tmp/mqssl, please note that prior to v8 of MQ IBM does not support copying the jar files outside of the default location where they are installed.IBM Technote \"Supported way to install WebSphere MQ Java jar files, JMS jar files, or C/C++ libraries\" states:+++ Section 1: MQ 7.xThe only supported way to get the MQ jar files or the MQ C/C++ library files onto a system is to install either:the WebSphere MQ product orthe WebSphere MQ Client SupportPacs.To legally download and use a client you must first accept the terms and conditions specified in the License Agreement.Do not copy the WebSphere MQ jar files to application EAR or WAR files.Do not copy the WebSphere MQ jar or MQ C/C++ library files from other machines:Fix Packs cannot be applied to an \"installation\" where jar or C/C++ library files have been copied from another machine, and this makes it much more difficult to ensure that all of these jar/library files are kept in step with each other, and are at compatible levels.Copying jar/library files between machines can also result in multiple copies of the files residing on the same machine, which can cause problems servicing the code and debugging problems.If your application is on the same server as the MQ v7.1.0.7 Queue Manager then you can just reference the jar file that are in the directory/opt/mqm/java/lib.If your application is not on the same server and you plan to stay with v7.1 or go with v7.5 I would recommend installing the latest full client install, see my note above on suggestions for versions based on when they are End of Service.If you decide to go with v8 or v9, IBM Technote \"Supported way to install WebSphere MQ Java jar files, JMS jar files, or C/C++ libraries\" also states:b) Starting with MQ 8.0.0.4, you can use Redistributable files:Installation scenarios for MQ 8.0 and 9.0 in Linux and Windows- Chapter 8: You need to redistribute MQ runtime libraries with your application.How to download the MQ 8.0.0.4+ and MQ 9.0.0.x redistributable client images for Linux x86-64 and Windows 64-bitBitesize Blogging: MQ 8.0.0.4 Redistributable ClientsWhat this means is that with v8.0.0.4 and higher you can download a MQ JMS and Java only redistributable client.The MQ JMS and Java only redistributable client client packages are available from FixCentralhere.UPDATE (2017/01/31 A) to address further questionsAfter searching on the error you are receiving I found this dW Answers post \"Why do I get AMQ9771, 2393 SSL Initialization error from a MQ Java/JMS application when trying to use an TLS AES 256 cipher?\". It states that the following:In this case, the issue is caused by attempting to use AES 256 strong\ncipher algorithms.Most Java JREs, including Oracle/Sun and IBM's have Import Limits on\nCryptographic Algorithms enabled. This limits the maximum key sizes\nand also some algorithms.When trying to use a AES 256 cipher, such as\nECDHE_RSA_AES_256_CBC_SHA384 orTLS_RSA_WITH_AES_256_CBC_SHA256with a\nMQ Java/JMS application, you need to ensure your JRE supports this\ncipher. In most cases, when the stronger cipher algorithms are needed,\nsuch as AES 256 ciphers, the JCE Unlimited Strength Jurisdiction\nPolicy Files must be obtained and installed in the JDK/JRE.This is noted in the JDK/JRE documentation: For Oracle 1.7:http://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.htmlThe link above to the oracle site states:If stronger algorithms are needed (for example, AES with 256-bit\nkeys), theJCE Unlimited Strength Jurisdiction Policy Filesmust be\nobtained and installed in the JDK/JRE.It is the user's responsibility to verify that this action is\npermissible under local regulations.I would suggest that you either use the lower CipherSuiteTLS_RSA_WITH_AES_128_CBC_SHA256, or follow the advise above to obtain and install theJCE Unlimited Strength Jurisdiction Policy Files.UPDATE (2017/02/01) to address further questionsThe error that caught my eye wasCaused by: java.security.NoSuchAlgorithmException: SHA224withRSA Signature not available.I searched on google for this and found the following dW Answers post \"How to resolve issue with MQ v7.x Java client getting SSL error NoSuchAlgorithmException: SHA224withRSA Signature not available?\" which states the following:Assuming using Oracle JVM:We have found that the root cause of the issue is the signature\nalgorithm SHA224withRSA is not supported by Oracle JRE 1.7, see\nsignature algorithms available:https://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.htmlIn the above link the table of interest is under \"The SunRsaSign Provider\" which lists the following supported signature algorithms:MD2withRSAMD5withRSASHA1withRSASHA256withRSASHA384withRSASHA512withRSANote thatSHA224withRSAisnoton the list.The same dW Answers post goes on to state:This signature algorithm is available in the IBM JVM and also in\nOracle JVM 1.8.https://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.htmlIn the above link the table of interest is under \"The SunRsaSign Provider\" which lists the following supported signature algorithms:MD2withRSAMD5withRSASHA1withRSASHA224withRSASHA256withRSASHA384withRSASHA512withRSANote thatSHA224withRSAison the list.Recommendations from the dW post:Try with Oracle Java 8 (1.8)Try with IBM JavaUPDATE (2017/02/01 B) to address further questionsTaking into account all of the information gathered through the troubleshooting above the answer is that it is not possible to use a TLSv1.2 cipher with a Oracle Java less than 8 using MQ v7.1.0.7 MQ Java client.Based on the last dW Answers post I provided, IBM suggested trying with MQ v8, but I do not think they tested this configuration so it may also not work.If you do want to try with MQ v8 I would suggest you go with the latest v8.0.0.5 Java only redistributable client client packages which I provided links already.\n"}
+{"text": "### Human: I'd like to implement a kind of a tracing mechanism within IIB. Can the IIB (WMB) publish messages to a topic, using the MQ* nodes and not JMS*? I don't see any node that could do so.### Assistant: Using the below code, you could set the Topic.SET OutputRoot.Properties.Topic = 'Sample';This will be followed by Publication Node which submits the message to the topic. This will be given out to any subscribers waiting for that topic.\n"}
+{"text": "### Human: Hello I have one big problem with connecting to IBM WebSphere MQ using JMSI use:Win 7JDK 1.7IBM WebSphere MQ server 7.5.0.2GlassFish 4.0I make one QueueManager namedtest1and one queue in that namedtest1qand one channel for negotiation namedtest1channelMy code is here:StandaloneSender s = new StandaloneSender();\ntry{\n s.send(\u201chello word\u201d);\n}catch (Exception e){\n e.printStackTrace();\n}StandaloneSender.javaimport javax.jms.Message;\nimport javax.jms.QueueConnection;\nimport javax.jms.QueueSender;\nimport javax.jms.QueueSession;\nimport javax.jms.Session;\nimport javax.naming.NamingException;\n\npublic class StandaloneSender {\n private P2PUtils utils;\n private QueueConnection connection;\n private QueueSession session;\n private QueueSender sender;\n public void send(String message) throws NamingException, JMSException, IOException {\n StandaloneSender sender = new StandaloneSender();\n sender.connect();\n sender.sendMessage(message);\n sender.disconnect();\n }\n\n public StandaloneSender() {\n utils = new P2PUtils();\n }\n\n private void connect() throws NamingException, JMSException {\n connection = utils.getConnection();\n session =\n connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n sender = session.createSender(utils.getQueue());\n System.out.println(\"Sender started.\");\n }\n\n private void sendMessage(String text) throws JMSException {\n Message message = session.createTextMessage(text);\n sender.send(message);\n System.out.println(\n \"Sent message <\"\n + text\n + \"> with ID <\"\n + message.getJMSMessageID()\n + \">\");\n }\n private void disconnect() throws JMSException {\n sender.close();\n session.close();\n connection.close();\n System.out.println(\"Sender stopped.\");\n }\n}P2PUtils.javaimport javax.jms.JMSException;\nimport javax.jms.Queue;\nimport javax.jms.QueueConnection;\nimport javax.jms.QueueConnectionFactory;\nimport javax.naming.Context;\nimport javax.naming.NamingException;\n\npublic class P2PUtils extends JmsUtils {\n\n private static final String QCF_NAME = \"test1\";\n private static final String QUEUE_NAME = \"test1q\";\n\n public QueueConnection getConnection() throws NamingException, JMSException {\n Context context = getInitialContext();\n QueueConnectionFactory qcf =\n (QueueConnectionFactory) context.lookup(QCF_NAME);\n return qcf.createQueueConnection();\n }\n\n public Queue getQueue() throws NamingException {\n Context context = getInitialContext();\n return (Queue) context.lookup(QUEUE_NAME);\n }\n}JmsUtils.javaimport java.util.Properties;\n\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\n\npublic class JmsUtils {\n private static final String CF_CLASS_NAME = \"com.ibm.mq.jms.context.WMQInitialContextFactory\";\n private static final String WMQ_URL = \"localhost:1414/SYSTEM.DEF.SVRCONN\";\n\n protected Context getInitialContext() throws NamingException {\n Properties props = new Properties();\n props.put(Context.INITIAL_CONTEXT_FACTORY, CF_CLASS_NAME);\n props.put(Context.PROVIDER_URL, WMQ_URL);\n return new InitialContext(props);\n }\n}But I have got this exception from glassfish:[2014-02-17T16:35:25.286+0330] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=25 _ThreadName=Thread-4] [timeMillis: 1392642325286] [levelValue: 1000] [[\n javax.naming.ServiceUnavailableException: Unable to connect to the target queue manager localhost:1414/SYSTEM.DEF.SVRCONN [Root exception is com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.]\n at com.ibm.mq.jms.context.MQContext.(MQContext.java:196)\n at com.ibm.mq.jms.context.WMQInitialContextFactory.getInitialContext(WMQInitialContextFactory.java:29)\n at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)\n at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)\n at javax.naming.InitialContext.init(InitialContext.java:242)\n at javax.naming.InitialContext.(InitialContext.java:216)\n at com.surena.MQ.JmsUtils.getInitialContext(JmsUtils.java:17)\n at com.surena.MQ.P2PUtils.getConnection(P2PUtils.java:16)\n at com.surena.MQ.StandaloneSender.connect(StandaloneSender.java:32)\n at com.surena.MQ.StandaloneSender.send(StandaloneSender.java:22)\n at com.surena.servlet.MainServlet.doGet(MainServlet.java:50)\n at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)\n at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\n at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)\n at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)\n at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)\n at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)\n at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)\n at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)\n at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)\n at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)\n at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)\n at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)\n at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)\n at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)\n at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)\n at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)\n at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)\n at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)\n at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)\n at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)\n at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)\n at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)\n at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)\n at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)\n at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)\n at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)\n at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)\n at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)\n at java.lang.Thread.run(Thread.java:744)\nCaused by: com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:247)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:588)\n at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:630)\n at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:107)\n at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:205)\n at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:911)\n at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:799)\n at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:750)\n at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:157)\n at com.ibm.mq.MQQueueManager.(MQQueueManager.java:757)\n at com.ibm.mq.pcf.PCFAgent.connect(PCFAgent.java:230)\n at com.ibm.mq.pcf.PCFAgent.(PCFAgent.java:163)\n at com.ibm.mq.pcf.PCFMessageAgent.(PCFMessageAgent.java:140)\n at com.ibm.mq.jms.context.MQContext.(MQContext.java:183)\n ... 39 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2539;AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]],3=localhost(1414),5=RemoteConnection.initSess]\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2053)\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1226)\n at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:311)\n at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:337)\n at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:924)\n at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:236)\n ... 52 more\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]\n at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1111)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:727)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:400)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:299)\n at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:164)\n at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1598)\n ... 57 more]]And this from IBM MQ2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)\n Host(PROGRAMMER1) Installation(Installation1)\n VRMF(7.5.0.2)\nAMQ6118: An internal WebSphere MQ error has occurred (20006047)\n\nEXPLANATION:\nAn error has been detected, and the MQ error recording routine has been called.\nACTION:\nUse the standard facilities supplied with your system to record the problem\nidentifier and to save any generated output files. Use either the MQ Support\nsite: http://www.ibm.com/software/integration/wmq/support/, or IBM Support\nAssistant (ISA): http://www.ibm.com/software/support/isa/, to see whether a\nsolution is already available. If you are unable to find a match, contact your\nIBM support center. Do not discard these files until the problem has been\nresolved. \n----- amqxfdcp.c : 867 --------------------------------------------------------\n2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)\n Host(PROGRAMMER1) Installation(Installation1)\n VRMF(7.5.0.2)\nAMQ6184: An internal WebSphere MQ error has occurred on queue manager test1 \n .\n\nEXPLANATION:\nAn error has been detected, and the WebSphere MQ error recording routine has\nbeen called. The failing process is process 3924.\nACTION:\nUse the standard facilities supplied with your system to record the problem\nidentifier and to save any generated output files. Use either the MQ Support\nsite: http://www.ibm.com/software/integration/wmq/support/, or IBM Support\nAssistant (ISA): http://www.ibm.com/software/support/isa/, to see whether a\nsolution is already available. If you are unable to find a match, contact your\nIBM support center. Do not discard these files until the problem has been\nresolved.I used all jar file that included in MQ installation directoryplease help me.### Assistant: From your exception from glassfish I've picked out the interesting bits:-javax.naming.ServiceUnavailableException: Unable to connect to the target\nqueue manager localhost:1414/SYSTEM.DEF.SVRCONN [Root exception is\ncom.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.\n\n\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;\nAMQ9204: Connection to host 'localhost(1414)' rejected.\n[1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2539;\nAMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]],\n3=localhost(1414),5=RemoteConnection.initSess]\n\nCaused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;\nAMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]There are various hints here for you. The first is the MQRC return code 2539. You can look this up using the mqrc command line tool that comes with IBM MQ. Just typemqrc 2539and it will report:-2539 0x000009eb MQRC_CHANNEL_CONFIG_ERROR.Also we have a couple of error messages:-AMQ9204: Connection to host 'localhost(1414)' rejected.\nAMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]You can see the full error message description using the mqrc tool as well, just typemqrc AMQ9204. So we're getting the idea here that your network connection (channel) was not working right and the queue manager didn't like it for some reason. The next thing is to see what the queue manager had to say about it, as you did. In you error log you say you saw:-2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)\n Host(PROGRAMMER1) Installation(Installation1)\n VRMF(7.5.0.2)\nAMQ6118: An internal WebSphere MQ error has occurred (20006047)Now this is indicating that there is likely an FDC file that has been cut as well which will give more details, but there is also another error code that you can look up, again with the mqrc tool. Type inmqrc 0x20006047and it will report:-536895559 0x20006047. xecX_E_CONV_NOT_SUPThis suggests that it was unable to cope with data conversion between your client and the queue manager. The FDC file will give you more details.\n"}
+{"text": "### Human: I need to install a fresh copy of Websphere MQ Server on a Windows machine.However, the queue manager and other details need to be migrated from the Websphere MQ Server which is in place on another system.Of what I could gather from my excavations from the internet is that there exists a support pac(MS03) from IBM which provides with the functionality. The executable beingsaveqmgr.exefor MQ versions upto 7.0 and dmpmqcfg for MQ 7.1 on Windows platform.My question is: what should be the command that should be run to secure the details of the queue manager?Also,after getting the required information in a file how do I userunmqsccommand to restore all the definitions?Thanks in advance!### Assistant: The following command can be used to backup the queue manager config using saveqmgr (MS03 Support Pac) to a file:saveqmgr -m QUEUE_MANAGER -f BACKUP_FILEThe following command can be used to backup the queue manager config using dmpmqcfg in version 7.1 and higher to a file:dmpmqcfg -m QUEUE_MANAGER > BACKUP_FILEThe following command can be used to restore the queue manager config using runmqsc:runmqsc QUEUE_MANAGER < BACKUP_FILEFor the aboveQUEUE_MANAGERis the name of the queue manager you want to backup/restore andBACKUP_FILEis the name of the text file containing the backup.\n"}
+{"text": "### Human: I'm working on a standalone Java application that GETs several messages from one MQ queue, processes the data contained within the messages and then PUTs a new message onto another MQ queue. One of the requirements is for the GET and PUT operations to be within the same unit of work and I am able to do this by specifyingMQGMO_SYNCPOINTandMQGMO_SYNCPOINTget/put message options.What I don't understand how to do using the Java MQ API is perform the MQCMIT and MQBACK operations to explicitly commit or rollback the MQ unit of work.I've searched on the IBM MQ InfoCenter website and the JavaDoc but I can't find anything on the APIs used for committing and rolling back a unit of work.The version of WebSphere MQ I'm using is 7.5 and I'm connecting to the queue manager using binding mode.Would anyone be able to provide some example code showing how to explicitly commit or rollback the MQ unit of work using the Java MQ APIs or point me in the direction of the appropriate JavaDoc page please?### Assistant: The basic flow is that when you send the messages in a transaction it will hold the messages in a buffer until either a commit or rollback is called: if a commit is performed then the messages are sent, otherwise they are discarded.Below is a sample from Novell using the JMS APIs which should be the same as WebSphere MQ if you're using the JMS API :http://www.novell.com/documentation/extend52/Docs/help/MP/jms/tutorial/txSession-1.htmUPDATE :Below is another question on StackOverflow that has code for committing / rolling back using the Websphere MQ APIs :java websphere MQ\n"}
+{"text": "### Human: Linux Server Box running WebSphere MQ Server v7.1:I have created a user 'mq-user' that belongs to 'mq-users' group in Linux. Then I created a queue managerQM_TEST, and used MQSC to issue the following commands to create a queue and set up the security:SET AUTHREC OBJTYPE(QMGR) PRINCIPAL('mq-user') AUTHADD(ALL)\nSET AUTHREC PROFILE(SYSTEM.MQEXPLORER.REPLY.MODEL) OBJTYPE(QUEUE) PRINCIPAL('mq-user') AUTHADD(INQ,DSP,GET)\nSET SET AUTHREC PROFILE(SYSTEM.ADMIN.COMMAND.QUEUE) OBJTYPE(QUEUE) PRINCIPAL('mq-user') AUTHADD(INQ,DSP,PUT)\nDEFINE CHANNEL (TEST_CHANNEL) CHLTYPE (SVRCONN) TRPTYPE (TCP) MCAUSER('mq-user')\nSET CHLAUTH(TEST_CHANNEL) TYPE(ADDRESSMAP) ADDRESS(*) MCAUSER('mq-user')\nDEFINE QLOCAL (TEST_QUEUE)\nSET AUTHREC PROFILE(TEST_QUEUE) OBJTYPE(QUEUE) PRINCIPAL('mq-user') AUTHADD(ALL)\nDEFINE LISTENER (TEST_LISTENER) TRPTYPE (TCP) CONTROL (QMGR) PORT (1414)\nSTART LISTENER (TEST_LISTENER)Linux Client Box running WebSphere MQ Client v7.1 and WebSphere MQ Explorer:I am logged in as my username (arrehman) which is not part of mq-users group. However I am able to access the queue I created above both via a Java Application and via MQ Explorer clientwithout passing any user credentials. Why is it this way if security is in effect?Any further details needed, please let me know. Thanks.### Assistant: This line:SET CHLAUTH(TEST_CHANNEL) TYPE(ADDRESSMAP) ADDRESS(*) MCAUSER('mq-user')Says the following:For connections requestingTEST_CHANNEL...Originating fromanyIP address...Set the MCAUSER tomq-userIn other words, enable the channel such that any connections inherit the privileges ofmq-userregardless of where they originate and what identity they present. So the behavior you are seeing is the expected behavior based on theCHLAUTHrule above.There are a few other problems with the rules as listed:The use ofPRINCIPALrather thanGROUP. On non-windows servers if you specifyPRINCIPALwhat happens is that the QMgr looks up that ID, queries its primary group and then sets authorizations based on that. So ifmq-usershas a primary group ofstafforusersthat that is what gets authorized instead ofmq-usersand is probably not what you intended. Always usegroupso that you get the result you intend withsetmqautorAUTHREC.GrantingALLon the QMgr makes the ID/group administrative. One of the privileges at the QMgr level isSETand any user in a group withSETrights can set, among other things, authorization control lists. So even though you only grantedAUTHADD(INQ,DSP,PUT)themq-usersID can submit PCF commands to grant all access to all objects. Only grantCONNECTandINQUIREon the QMgr if that's all you need.There's an assumption stated (in bold, actually) that you would have expected to be required to pass user credentials. Please be aware that WMQ does not validate a user ID and password if you do provide them. It accepts the ID that you assert. The password field is available to exits which can be used to validate the ID and password against, for example, LDAP or the local OS. Such an exit can be purchased from a 3rd party or written but base WMQ doesn't do anything with the password. Had you specifiedUSERSRC(CHANNEL)on the mapping, then your ID would have been used and most likely rejected. But the rejection would have been either because it is in themqmgroup (which is blocked by a defaultCHLAUTHrule) or because there are noAUTHRECrecords for the group it is in.For more about hardening WMQ, there are a number of resources collectedhere. TheHardening WebSphere MQpresentation is from v7.0. Although v7.1 has new controls, the principals remain the same:Authenticate the connection using IP filtering (for apps or QMgrs where the connection originates in a locked datacenter), SSL/TLS and/or an exitMap the authenticated identity to anMCAUSERvalue by hard-coding it in the channel or by using an exit orCHLAUTHrule to dynamically set itAdministrative connections and high-value applications should be authenticated using TLS\n"}
+{"text": "### Human: I have wrote an MQ app, which is exe, but it only runs for a single instance and terminates itself. The desired functionality is to have it running continuously and keep processing the data and once the data is exhausted, it should keep listening for the new data.May some one please suggest me what needs to be done?Thanks!### Assistant: Currently your application probably loops through messages until it gets back a return code indicating that the queue is empty. In order to keep listening for new data, you need to do two things:Don't exit the loop when you get back a return code for \"empty queue.\" Loop around and attempt anotherReceive(). Youmustcombine this with the next recommendation though.When you perform theReceive()do so using a time-out. For example,consumer.Receive(20000)will wait 20 seconds for the next message before timing out.If you do not include the timeout, then the application will throw massive numbers of unsatisfied GET requests at the QMgr which will appear to be a runaway app and/or a runaway QMgr and you will see processes with high CPU utilization.You could sleep betweenReceive()calls but this is not very performant. Using aReceive(TIMEOUT)blocks the thread only while no messages are available. As soon as a message arrives, there is no delay in passing it to the thread. If you manually sleep the thread, it must poll the queue and will only do so at setsleep()intervals.The alternative is that you can set up a callback method so that the thread doesn't block. For example, if you have a callback methodOnNewMessageCallbackyou can create an async message listener withMessageListener messageListener = new MessageListener(OnNewMessageCallback);Both of these methods are described in the samples. If you installed the SDK and samples, these will be underC:\\Program Files (x86)\\IBM\\WebSphere MQ\\tools\\dotnet\\samplesor the equivalent, depending on where you installed WMQ.In case you are wondering how to tell the difference between \"no message on queue\" and some more serious error, check theMQException.ReasonCode. If it is 2033, then theReceive()timed out. That and all the other reason codes are definedhere.Once you have a program that will successfully loop around and wait for new messages, then you can either choose to run it as a service as described in Simon's response, or interactively as you do now.If you are developing on WMQ v6 please be aware that v6 is end-of-service as of September 2012 and that the .Net integration ismuchbetter in v7.0 or v7.1 of WMQ. You can download the latest WMQ v7.0 client with .Net classes fromSupportPac MQC7. The corresponding Infocenter ishere. The v7.1 client will be aSupportPacwhen it is released, but the exact name is not yet known. I'll try to remember to update this with a link when it is available. As of today, the v7.1 client is available through Passport Advantage using your IBM customer account. The v7.1 Infocenter ishere.\n"}
+{"text": "### Human: I am trying to write a health check for our JMS connection that connects to MQ using IBM JMS integrations codeibm-messaging/mq-jms-spring. I need to detect that the connection to MQ has been lost. I hooked the exceptionListener for the DefaultJmsListenerContainerFactory and that tells me when I lose the connection to MQ but I cannot find anything in the JMS stack that tells me when the connection gets (re)established.Code that calls the ExceptionListener@Override\nprotected void establishSharedConnection() {\n try {\n super.establishSharedConnection();\n }\n catch (Exception ex) {\n if (ex instanceof JMSException) {\n invokeExceptionListener((JMSException) ex);\n }\n logger.debug(\"Could not establish shared JMS Connection - \" +\n \"leaving it up to asynchronous invokers to establish a Connection as soon as possible\", ex);\n }\n}### Assistant: From a strictly JMS perspective, when theonExceptionmethod of yourExceptionListeneris invoked it is up to your application to re-establish the JMS connection usingConnectionFactory.createConnection. This is a blocking call so once it returns successfully then you know the connection has been re-established.If you're delegating the JMS connection management to Spring it's unlikely you will be able to be informed about when the JMS connection is re-established. I don't see any hooks in Spring JMS for this.\n"}
+{"text": "### Human: I need to send message from spring integration to Non jms application via IBM MQI have tried to send message but unfortunately, the receiver non jms application is not able consume due to unwanted Jms headers Included in the message and getting data format exceptionHow to remove jms headers before sending message to non jms application using spring integrationI have found some reference link in IBM MQ sitehttps://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q032140_.htm### Assistant: There are a number of ways to do this, as can be seen in the spread of comments and answers you have already received. How you do it really depends on you.As Daniel states you can modify the queue url.As Morag states you can use MQSC to alter the queue.You can also do this by code. You haven't provided any code so its not easy to tell you how to do this, but if you cast your destination (queue) to an MQDestination you can exclude the RFH2 headers using the IBM JMS API.RFH2 will be excludedimport javax.jms.Destination;\n import com.ibm.mq.jms.MQDestination;\n import com.ibm.msg.client.wmq.WMQConstants;\n ...\n\n Destination destination = ...\n ...\n\n\n MQDestination mqDestination = (MQDestination) destination;\n destination.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);I have this tested with this service in Springimport com.ibm.mq.jms.MQDestination;\nimport com.ibm.msg.client.wmq.WMQConstants;\n\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.jms.core.JmsTemplate;\nimport org.springframework.stereotype.Service;\n\nimport javax.jms.*;\n\n@Service\npublic class SendMessageNonJmsService {\n\n protected final Log logger = LogFactory.getLog(getClass());\n\n final private JmsTemplate myNonJmsTemplate;\n\n @Autowired\n private ConnectionFactory connectionFactory;\n\n SendMessageNonJmsService(JmsTemplate myNonJmsTemplate) {\n this.myNonJmsTemplate = myNonJmsTemplate;\n }\n\n public void sendAsNonJms(String msg) {\n Destination destination = null;\n JMSContext context = connectionFactory.createContext();\n destination = context.createQueue(\"queue:///audit\");\n try {\n MQDestination mqDestination = (MQDestination) destination;\n mqDestination.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);\n }\n catch (JMSException ex) {\n logger.warn(\"JMSException preparing message destination : \"\n + ex.getErrorCode() + \" : \"\n + ex.getMessage());\n }\n myNonJmsTemplate.send(destination, session -> session.createTextMessage(msg));\n }\n\n}As an alternative if you want your sending code to be as simple aspublic void sendAsNonJms(String msg) {\n myNonJmsTemplate.send(\"audit\", session -> session.createTextMessage(msg));\n }Then you can set a destination resolver on your JmsTemplate@Bean(\"myNonJmsTemplate\")\n public JmsTemplate myNonJmsTemplate() {\n JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory);\n jmsTemplate.setDestinationResolver(new OurDestinationResolver());\n return jmsTemplate;\n }where your destination resolver looks something like:import com.ibm.mq.jms.MQDestination;\nimport com.ibm.msg.client.wmq.WMQConstants;\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.jms.support.destination.DestinationResolver;\n\nimport javax.jms.*;\n\npublic class OurDestinationResolver implements DestinationResolver {\n\n protected final Log logger = LogFactory.getLog(getClass());\n\n @Autowired\n private ConnectionFactory connectionFactory;\n\n @Override\n public Destination resolveDestinationName(Session session, String dest, boolean pubSub) throws JMSException {\n Destination destination = null;\n\n if (pubSub) {\n destination = session.createTopic(dest);\n } else {\n destination = session.createQueue(dest);\n }\n\n MQDestination mqDestination = (MQDestination) destination;\n mqDestination.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);\n\n return destination;\n }\n}\n"}
+{"text": "### Human: IBM goes to great lengths documenting the possible error-codes for different MQ-related functions, but I cannot find an existing library function to translate the integer codes into human-readable strings.Something like libc'sstrerror(3)or OpenSSL'sERR_error_string(3)...I suppose, the programmers and operators are expected to have a handy (if dog-eared) reference book...Or does the function exist -- and just is not easy to find?### Assistant: You can convert the number, e.g. 2035, into a string such as \"MQRC_NOT_AUTHORIZED\" using theMQRC_STRfunction that is shipped in header filecmqstrc.h.If you want more than just the string representation of the constant, you could look into calling themqrcexecutable that is shipped with distributed platform versions of IBM MQ, and scraping the output. In my view the string version of the constant is enough for most people.#include /* Include for MQI Constants */\n#include /* Convert MQRC into string */\n\n:\n\nMQCONN(QMName,\n &hConn,\n &CompCode,\n &Reason);\nif (Reason)\n{\n printf(\"MQCONN to QMgr %.48s failed with reason %d (%s)\\n\",\n QMName, Reason, MQRC_STR(Reason));\n :\n}\n"}
+{"text": "### Human: I have a setup where there is a JMS Producer and JMS receiver. The sender application sends a message like :source text \u27e8\u0435, \u0451, \u0438, \u044e, \u044f\u27e9 abcdefgJMS receiver after receiving the message, puts it to a IBM MQ queue using pure IBM MQ API classes.While putting this message to MQ I am getting the below exception:INFO | 2020-09-17 09:45:19 | [main] mimq.MQReceiver (MQReceiver.java:211) - IO Exception Occurred: Input length = 1\njava.nio.charset.UnmappableCharacterException: Input length = 1\n at java.nio.charset.CoderResult.throwException(CoderResult.java:282)\n at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:816)\n at com.ibm.mq.jmqi.system.JmqiCodepage.stringToBytes(JmqiCodepage.java:923)\n at com.ibm.mq.MQMessage.writeString(MQMessage.java:2848)\n at com.ibm.mimq.MQReceiver.sendToAnotherQueue(MQReceiver.java:192)\n at com.ibm.mimq.MQReceiver.main(MQReceiver.java:113)Below is myMQ PUTcode :public static void sendToLocalQueue(String msg) {\n \n int port = 1414;\n String host = \"some-host\";\n String channel = \"some-channel\";\n String manager = \"some-QM\";\n String user = \"user\"; \n String passwd = \"passwd\";\n String qname = \"TEST\";\n String qmname = \"some-QM\";\n \n MQQueueManager qMgr;\n MQQueue inputQ;\n \n try { \n \n Hashtable h = new Hashtable();\n h.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);\n MQEnvironment.properties = h;\n MQEnvironment.hostname = host;\n MQEnvironment.port = port;\n MQEnvironment.channel = channel;\n \n MQEnvironment.userID = user;\n MQEnvironment.password = passwd;\n MQEnvironment.disableTracing();\n MQException.log = null;\n qMgr = new MQQueueManager(manager);\n \n MQMessage m = new MQMessage(); \n m.applicationOriginData = \"AMPS\";\n m.messageType = MQC.MQMT_DATAGRAM;\n m.format = MQC.MQFMT_STRING;\n m.encoding = MQC.MQENC_NATIVE;\n m.priority = 4;\n m.persistence = MQC.MQPER_PERSISTENT;\n m.characterSet = MQC.MQCCSI_Q_MGR;\n //m.characterSet = 1208;\n m.expiry = MQC.MQEI_UNLIMITED;\n m.writeString(msg);\n \n MQPutMessageOptions putOptions = new MQPutMessageOptions();\n putOptions.options = MQC.MQPMO_SYNCPOINT | MQC.MQPMO_FAIL_IF_QUIESCING; \n \n logger.info(\"Putting message to LAN MQ (TEST queue)....\"); \n qMgr.put(qname, qmname, m, putOptions);\n qMgr.commit();\n \n \n } catch(MQException me) {\n logger.info(\"Error Code : \" +me.getErrorCode());\n logger.info(\"LocalizedMessage : \" +me.getLocalizedMessage());\n logger.info(\"Message : \" +me.getMessage());\n logger.info(\"Reason : \" +me.getReason());\n me.printStackTrace();\n \n } catch (IOException e) {\n // TODO Auto-generated catch block\n logger.info(\"IO Exception Occurred : \" +e.getLocalizedMessage());\n e.printStackTrace();\n } \n}It is unable to put the message to the queue due to Unmappable character. The encoding is set to UTF-8 at Queue Manager level.However when I replace the below line :m.characterSet = MQC.MQCCSI_Q_MGR;With the line :m.characterSet = 1208;The issue is no more there.My question is why this conversion is not getting done at MQ level. What are settings I need to check to ensure the correct conversion. I have tried the below techniques, but not working :Setting java parameter as : -Dfile.encoding=UTF-8Myenvironment:Server : Linux\nMQ : 9.0 or 7.5\nJava : 1.8One more thing to mention, the same setup was working with 7.5 but not working with MQ 9.0 after migration. I know with my above one line code change I can pass the message. But I want to understand in MQ level, if I am missing out some configurations. Any advise would be much appreciated.Thank You.UPDATEThe Client Machine from where I am sending the Message over to MQ has CCSID :MQMD.CodedCharSetId = 1208The MQ server where I am connecting and sending the message has this :getDefaultProperty(Object) returns [819(0x333)] Integer\nsetCCSID(int) setter [819(0x333)]So when I am setting 1208 explicitely in my code it is working. When not the conversion is failing.UPDATE-2The valueMQC.MQCCSI_Q_MGR is Zeroas I saw in the jar. Hence the code is designed like this, if the value is Zero, it will fetch the default value from the Jar which is set to819. I learnt this when I turned on the MQ tracing. And the code is like this :getDefaultProperty(Object) returns [819(0x333)] Integer\nsetCCSID(int) setter [819(0x333)]This code is present inside the jar. So we need to explicitly set the charset value on the message. In my case it is 1208.### Assistant: The reason why this worked at MQ v7.5 and not at MQ v9.0 is because prior to IBM MQ v8.0 the IBM MQ classes for Java encoded data usingjava.nio.charset.Charset.encode(CharBuffer)which results in a default replacement of malformed or untranslatable data. Since the defaultcharacterSetis 819 (ASCII), this would result in any character you send that can not be converted to ASCII to be transparently replaced with the default replacement character, in most cases this means the data was replaced with the?character.After v8.0 the default behavior changed to report this situation as an error and no longer replace malformed or untranslatable data by default.Your solution to set the character set to UTF-8 is the best solution as this results in the exact data you intended to send being sent.Another option is to tell MQ to use the prior behavior.The description of the new behavior as well as how to configure IBM MQ classes for Java to use the prior behavior is described in the IBM MQ 9.0 Knowledge Center pageDeveloping applications>Developing JMS and Java applications>Using IBM MQ classes for Java>Character string conversions in IBM MQ classes for Java:From IBM\u00ae MQ Version 8.0, some of the default behavior regarding\ncharacter string conversion in the IBM MQ classes for Java\u2122 has\nchanged.Before IBM MQ Version 8.0, string conversions in IBM MQ classes for\nJava was done by calling the\njava.nio.charset.Charset.decode(ByteBuffer) and\nCharset.encode(CharBuffer) methods.Using either of these methods results in a default replacement (\nREPLACE) of malformed or untranslatable data.This behavior can obscure errors in applications, and lead to\nunexpected characters, for example ?, in translated data. From IBM MQ\nVersion 8.0, to detect such issues earlier and more effectively, the\nIBM MQ classes for Java use CharsetEncoders and CharsetDecoders\ndirectly and configure the handling of malformed and untranslatable\ndata explicitly.From IBM MQ Version 8.0, the default behavior is to REPORT such issues\nby throwing a suitable MQException....Setting system defaults--From IBM MQ Version 8.0, the following two Java system properties are\navailable to configure default behavior regarding character string\nconversion.com.ibm.mq.cfg.jmqi.UnmappableCharacterActionSpecifies the action to be taken for untranslatable data on encoding and decoding.\nThe value can be REPORT, REPLACE, or IGNORE.com.ibm.mq.cfg.jmqi.UnmappableCharacterReplacementSets or gets the replacement bytes to apply when a character cannot be mapped\nin an encoding operation The default Java replacement string is used\nin decoding operations.To avoid confusion between Java character and native byte\nrepresentations, you should specify\ncom.ibm.mq.cfg.jmqi.UnmappableCharacterReplacement as a decimal number\nrepresenting the replacement byte in the native character set.For example, the decimal value of ?, as a native byte, is 63 if the\nnative character set is ASCII-based, such as ISO-8859-1, while it is\n111 if the native character set is EBCDIC.If you wanted to mimic the prior behavior you would set the following system properties:-Dcom.ibm.mq.cfg.jmqi.UnmappableCharacterAction=REPLACE\n-Dcom.ibm.mq.cfg.jmqi.UnmappableCharacterReplacement=63You can also set it Programmatically with something like this:System.setProperty(\"com.ibm.mq.cfg.jmqi.UnmappableCharacterAction\", \"REPLACE\");\nSystem.setProperty(\"com.ibm.mq.cfg.jmqi.UnmappableCharacterReplacement\", \"63\");\n"}
+{"text": "### Human: These packages seem to have similar functionality. What's the difference?### Assistant: IBMMQDotnetClientis \"IBM MQ classes for .NET Standard\" also known as known as Base .NET Classes.Where asIBMXMSDotnetClient: called XMS that has the same set of interfaces as the Java\u2122 Message Service (JMS) API.Renders a JMS-like API and Implements JMS 1.1 Specification. Most of the features available in IBMMQDotnetClient are available in XMS as well and on top of these features,there are additional features like \"Asynchronous message consumer\", Message selectors, Poison message handling etc.Basically the difference is if you want to use JMS-like API's and looking for features like Asynchronous message consumer or message selectors,then you can use XMS.\n"}
+{"text": "### Human: I am able to connect to IBM mq through Pymqi using installed MQ client v9 on my Linux machine. There is requirement of connecting through SSL. How should I create key repository for two way TLS(mTLS)?### Assistant: I have configured mutual tls between a python application using PyMQI backed with theIBM MQ toolkit for MacOS(9.1.5.0) and a queue manager running on aRaspberry Pi(9.2.0.0).I have used self-signed certificates to make it easier to illustrate an end-to-end example of a TLS configuration with MQ. This would not normally be used in a production environment; your MQ administrator will typically provide any certificates that you might need to use which are often issued by a certificate authority. Where this is the case you can skip the certificate creation steps below.Here are the steps I took:Initial server and Python code setupSetup an IBM MQ server followingthis tutorialwhich provides the default developer configuration.Pulled in the the python sample code fromthis tutorialand put a message toDEV.QUEUE.1without TLS configured.General ConfigCreated some working directories on my Mac client.mkdir tlsTest\ncd tlsTest\nmkdir client\nmkdir serverQueue Manager configCreate the server keystore.cd serverrunmqakm -keydb -create -db key.kdb -pw -stashlsCheck to seekey.crl key.kdb key.rdb key.sth.Check that the store is empty.runmqakm -cert -list -db key.kdb -stashedNo certificates were found.Create the server certificate and put it in the new keystorekey.kdbrunmqakm -cert -create -db key.kdb -stashed -dn \"cn=qm,o=ibm,c=uk\" -label ibmwebspheremq -type cmsCheck the certificate.runmqakm -cert -list -db key.kdb -stashedCertificates found\n* default, - personal, ! trusted, # secret key\n- ibmwebspheremqqm1The '-' denotes the client's private key and personal certificate in this keystore.Extract the queue manager's public key.runmqakm -cert -extract -label ibmwebspheremq -db key.kdb -stashed -file QM.certCheck to see the certificate file.lsQM.cert key.crl key.kdb key.rdb key.sthInspect the certificate.runmqakm -cert -details -file QM.cert -stashedClient ConfigChange to the client directory.cd ../clientCreate the client keystore.runmqakm -keydb -create -db client.kdb -pw -stashCreate the client certificate and put it in the new keystoreclient.kdb.runmqakm -cert -create -db client.kdb -stashed -dn \"cn=pymqi,o=test,c=uk\" -label ibmwebspheremq -type cmsExtract the client's public key.runmqakm -cert -extract -label ibmwebspheremq -db client.kdb -stashed -file Client.certOptionally inspect the certificate by modifying previousrunmqakm -cert -listcommands from the earlier server steps.Exchange public keysPopulate the client's keystore with the queue manager's public key.runmqakm -cert -add -label ibmwebspheremq -db client.kdb -stashed -file ../server/QM.certCheck the certificate.runmqakm -cert -list -db client.kdb -stashedCertificates found\n* default, - personal, ! trusted, # secret key\n! ibmwebspheremqqm1\n- ibmwebspheremqappThe '!' shows that the queue manager's public key is trusted.Populate the queue manager's keystore with the client's public key.Change to the server directory.cd ../serverrunmqakm -cert -add -label ibmwebspheremq -db key.kdb -stashed -file ../client/Client.certCheck the certificates.runmqakm -cert -list -db key.kdb -stashedCertificates found\n* default, - personal, ! trusted, # secret key\n! ibmwebspheremqapp\n- ibmwebspheremqqm1Configure TLS on the Queue ManagerMove thekey.kdbandkey.sthfiles from thetlsTest/serverdirectory to/var/mqm/qmgrs/ssl/QM1directory on the queue manager's file system.Modify theDEV.APP.SVRCONNchannel to accept TLS 1.2 cipher suites.runmqsc QM1ALTER CHANNEL(DEV.APP.SVRCONN) CHLTYPE(SVRCONN) SSLCIPH(ANY_TLS12)Refresh the queue manager's security subsystem.REFRESH SECURITY(*) TYPE(SSL)TLS enabled the MQ PyMQI applicationAdd cipher spec and label into the Python app and include the sco options.cd.SSLCipherSpec = b'ANY_TLS12'\nsco = pymqi.SCO()\n#include file name but not file extension\nsco.KeyRepository = b'tlsTest/client/client'\nsco.CertificateLabel =b'ibmwebspheremqapp'Change theqmgr.connectline to addscooptions.qmgr.connect_with_options(queue_manager, user=b'app', password=b'', cd=cd, sco=sco)Test Python app.Alternate configuration to use environment variables to reference label and keystoreChange the python app to remove label and keystore.#sco = pymqi.SCO()\n#sco.KeyRepository = b'tlsTest/client/client'\n#sco.CertificateLabel =b'ibmwebspheremqapp'\n#qmgr.connect_with_options(queue_manager, user=b'app', password=b'', cd=cd, sco=sco)\nqmgr.connect_with_options(queue_manager, user=b'app', password=b'', cd=cd)Set environment variables.export MQSSLKEYR=tlsTest/client/client\nexport MQCERTLABL=ibmwebspheremqappTest Python app.\n"}
+{"text": "### Human: I am trying to consume message from MQ but the code hangs and doesn't show output.JmsFactoryFactory FF = jmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);\nJmsConnectionFactory cf = FF.createConnectionFactory();\ncf.setStringProperty(WMQConstants.WMQ_HOST_NAME, HOST);\ncf.setStringProperty(WMQConstants.WMQ_PORT, PORT);\ncf.setStringProperty(WMQConstants.WMQ_CHANNEL, CHANNEL);\ncf.setStringProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);\ncf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, QMGR);\ncf.setStringProperty(WMQConstants.WMQ_APPLICATIONNAME, \"JMS\");\nConnection connection = cf.createConnection();\nSession session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\ndestination = session.createQueue(queuename);\nMessageConsumer consumer1 = session.createConsumer(destination);\n\nMessage reply = consumer1.receive();\nSystem.out.println(reply);It doesn't show the message and hangs and doesn't even terminate.### Assistant: You need to callstart()on your instance ofjavax.jms.Connectionin order to get messages to flow to the consumer, e.g.:connection.start()Also, it's worth noting that callingjavax.jms.MessageConsumer#receive()is expected to block until a message is received so you're seeing the expected behavior there. If you don't want to block you can calljavax.jms.MessageConsumer#receive(long)and specify a timeout (in milliseconds).\n"}
+{"text": "### Human: I am trying to publish a simple message to ibmmq using java.The message sending is successful.But when i check the queue on ibm console .The Message is showed asBut I am expecting as simple String.Here is my code.when I am trying to convert I am getting below message \nThe message of type jms_bytes can not have its body assigned to java.lang.Stringimport com.ibm.mq.*;\nimport com.ibm.mq.constants.MQConstants;\nimport com.ibm.mq.jms.MQQueueConnectionFactory;\nimport com.ibm.msg.client.jms.JmsFactoryFactory;\nimport com.ibm.msg.client.wmq.WMQConstants;\n\nimport javax.jms.*;\nimport java.io.IOException;\nimport java.util.Hashtable;\n\npublic class PublisherTest\n{\n static private String CHANNEL = \"anychannel\";\n static private int PORT = 1414;\n static private String HOST = localhost;\n static private String QMANAGER = \"QM1\";\n static private String QUEUE = \"queue.test\";\n static private String USER = USER;\n static private Hashtable props =\n new Hashtable();\n static MQQueueManager qMgr = null;\n\n static private void putMsgOnQueue(String message) {\n // Disabling IBM cipher suite mapping due to\n // using Oracle Java and not IBM Java\n System.setProperty(\"com.ibm.mq.cfg.useIBMCipherMappings\", \"false\");\n // Enabling SSL debug to view the communication\n System.setProperty(\"javax.net.debug\", \"ssl:handshake\");\n\n props.put(MQConstants.CHANNEL_PROPERTY, CHANNEL);\n props.put(MQConstants.PORT_PROPERTY, PORT);\n props.put(MQConstants.HOST_NAME_PROPERTY, HOST);\n props.put(MQConstants.USER_ID_PROPERTY, USER);\n props.put(MQConstants.PASSWORD_PROPERTY, PASSWORD);\n props.put(MQConstants.SSL_CIPHER_SUITE_PROPERTY, \"TLS_RSA_WITH_AES_256_CBC_SHA256\");\n\n\n try {\n\n qMgr = new MQQueueManager(QMANAGER, props);\n\n\n // MQOO_OUTPUT = Open the queue to put messages\n // MQOO_INPUT_AS_Q_DEF = Using queue-defined defaults\n int openOptions = MQConstants.MQOO_OUTPUT;\n\n\n // creating destination\n MQQueue queue = qMgr.accessQueue(QUEUE, openOptions);\n\n // specify the message options...\n MQPutMessageOptions pmo = new MQPutMessageOptions(); // Default\n\n\n // MQPMO_ASYNC_RESPONSE = MQPUT operation is completed without the\n // application waiting for the queue manager to complete the call\n // Using this option can improve messaging performance,\n // particularly for applications using client bindings.\n pmo.options = MQConstants.MQPMO_ASYNC_RESPONSE;\n\n // create message\n MQMessage mqMessage = new MQMessage();\n\n\n System.out.println(\"Writing message to queue: \" + QUEUE);\n mqMessage.writeString(message.toString());\n\n // Put message on queue\n queue.put(mqMessage, pmo);\n\n // Close queue\n queue.close();\n\n // Get status\n MQAsyncStatus asyncStatus = qMgr.getAsyncStatus();\n\n // Print status code (0 = successful)\n System.out.println(asyncStatus.reasonCode);\n\n } catch (MQException e) {\n System.out.println(\"The connection to MQ could not be established.\" + e.getMessage());\n\n } catch (IOException e) {\n System.out.println(\"Error while writing message.\" +\n e.getMessage());\n } finally {\n try {\n qMgr.disconnect();\n } catch (MQException e) {\n System.out.println(\"The connection could not be closed.\" +\n e.getMessage());\n }\n }\n }\n\n\n public static void main(String[] args) {\n\n putMsgOnQueue(\"WELCOME\");\n }\n}ANY Help Would be Appreciated.### Assistant: The default message format is MQFMT_NONE. This means the message body consists of bytes. Your code is not setting message format. So my thinking is that MQ Console is indicating such messages as binary.Suggest you set the message format as string and run. This sets the message format as string.MQMessage mqMessage = new MQMessage();\n mqMessage.format = MQConstants.MQFMT_STRING;\n"}
+{"text": "### Human: I have developed a Java application to read the messages from MQ. The Java application has to read all the messages from the MQ, put them in to the list and return the list. I am usingwhileloop to read the messages one by one and breaking out if I caught the 2033 exception and return the list.My issue is I am getting 2033 exception after reading the single message. For example, I have pushed some 10 messages to the queue and run my application, the first loop reads the first message and put it in to the list. But in the second loop it throwing 2033 exception while getting the second message. Then I need to run the application to read the second message and same thing happens.Since I am new to MQ, I cant find the route cause why its happening. I am using Java8 and IBM MQ core library. Below is my code..package com.reciever.mq;\n\n\nimport com.ibm.mq.*;\nimport com.ibm.mq.constants.MQConstants;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport java.io.IOException;\nimport java.util.*;\n\n\npublic class MQReceiver {\n\n private static final Logger LOGGER = LoggerFactory.getLogger(MQReceiver.class);\n\n private static int GET_OPTIONS_CONSTANT = MQConstants.MQGMO_WAIT |\n MQConstants.MQGMO_PROPERTIES_COMPATIBILITY |\n MQConstants.MQGMO_ALL_SEGMENTS_AVAILABLE |\n MQConstants.MQGMO_COMPLETE_MSG |\n MQConstants.MQGMO_ALL_MSGS_AVAILABLE |\n MQConstants.MQGMO_SYNCPOINT;\n\n public static MQQueueManager queueManager;\n\n public static void main(String[] args) throws MQException {\n\n Hashtable mqOptions = new Hashtable<>();\n\n mqOptions.put(MQConstants.HOST_NAME_PROPERTY, \"host.name\"); //just a placeHolder\n mqOptions.put(MQConstants.CHANNEL_PROPERTY, \"channelName\");\n mqOptions.put(MQConstants.USER_ID_PROPERTY, \"userName\");\n mqOptions.put(MQConstants.TRANSPORT_PROPERTY, MQConstants.TRANSPORT_MQSERIES);\n mqOptions.put(MQConstants.PORT_PROPERTY, 1980);\n\n queueManager = new MQQueueManager(\"queueManager\", mqOptions);\n int options = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT\n | MQConstants.MQOO_FAIL_IF_QUIESCING | MQConstants.MQOO_PASS_ALL_CONTEXT | MQConstants.MQOO_INQUIRE;\n\n MQQueue mq = queueManager.accessQueue(\"queueNametoRead\", options);\n MQException.logExclude(2033);\n\n MQMessage mqMessage = new MQMessage();\n MQGetMessageOptions getOptions = new MQGetMessageOptions();\n getOptions.options = GET_OPTIONS_CONSTANT;\n getOptions.waitInterval = 1;\n\n //byte[] buffer = null;\n\n List