Is there a Powershell interface to read messages from MQ? - powershell

I'm looking at writing a collector to read log messages off an MQ queue. I could have someone write Java or C# code, or I can write it in Powershell. Big question is can I actually? I haven't seen anything that talks about using MQ as an input source to Powershell. It seems like it would fit the model from a "pipeline" perspective...

SupportPac MO74 is a Powershell interface and it's been updated to at least v8.0.0.2.

So, if you want to get the message from MS queue you can use msmq cmdlets. Check this
In the other hand if you want to read it from a websphere queue try MQ Modules
Similarly if you want to try with some other queues I assume they should have an API. You can load the dll thru relection and use it in powershell.

Related

JMS | IBM Websphere Application Server 8.5 | How to see messages and their formats lying on queues

I am working on a POC wherein I am trying to achieve SOAP over JMS. Basically I'll be submitting my SOAP messages directly to the jms queue and a consumer will further read these SOAP messages and process them. The reason we want to stick to SOAP is because it is a standard formatand we'll not have to do something extra to design a new standard form messages.
For this poc I am using the default messaging provider which comes by default with IBM websphere app server 8.5. I referred to the following and I am able to submit my messages to queue. The problem is that I expected the SOAP to stay as XML/String on my queue however it is getting converted into a byte message.
I want to check the message and its type on my queue using some kind of queue browser tool which could work with IBM WAS8.5 . I googled and found that there are a lot of Queue browser tools available for servers like Glassfish etc but I couldn't find any tool or option for IBM WAS8.5?
Can you please guide me on what I can do to ensure that my SOAP message stays as XML on JMS queue and any GUI tool/option I could use to see the message and its type on Queue ?
Regards
Aakash
You can use the SIB Explorer tool to view the messages on the queue in WAS. The link to the tool is here.
There is also the SIB Destination Handler tool that allows you to perform more actions on the messages that you might find useful for your issue (like printing out properties etc). The SIB Destination Handler tool can be found here.
In addition to tools mentioned by whitfiea you can use web admin console and go to:
Buses > myBus > Destinations > myQueue > Queue points >
myQueue#rad9vmNode02.server1-myBus > (switch to the Runtime tab) > Messages
then select the message. You should be able to see the message contents.

is it possible to write record as NO-UNDO in transaction?

we are making some loging issue, where we need write the logentries in the DB. But the process run in a transaction and by rollback are our new logentries also deleted. can I make a write in DB out of the transaction? something like write in temptable with NO-UNDO option...? that the new logentries still remain in DB...?
Another possibility would be to use an app server. Transactions on app server sessions are independent from transactions in the original session (that's what the optional and redundant "DISTINCT TRANSACTION" syntax is all about).
Another option would be to use a simple messaging system. One very easy to setup and use option is STOMP. It is platform neutral and very easy to get going with.
Julian Lyndon-Smith posted the following on PEG about a month ago, and it really is as easy to setup and use as he says (I've tried it, I used ApacheMQ which is also very easy to setup and use):
Following on from presentations in Boston and Finland, dot.r is
pleased to announce the open source Stomp project, available
immediately.
Download from either http://www.dotr.com or
https://bitbucket.org/jmls/stomp , the dot.r stomp programs allow you
to connect your progress session to any other application or service
that is connected to the same message broker.
Open source, free message brokers that support Stomp are:
Fuse
(http://fusesource.com/products/fuse-mq-enterprise/) [a Progress company now owned by Red Hat inc]
Fuse MQ Enterprise is a standards-based, open source messaging platform that deploys with a very small footprint. The lack of license
fees combined with high-performance, reliable messaging that can be
used with any development environment provides a solution that
supports integration everywhere
ActiveMQ
Apache ActiveMQ (tm) (http://activemq.apache.org/)is the most popular
and powerful open source messaging and Integration Patterns server. Apache
ActiveMQ is fast, supports many Cross Language Clients and Protocols, comes
with easy to use Enterprise Integration Patterns and many advanced features
while fully supporting JMS 1.1 and J2EE 1.4.
Apache ActiveMQ is released under the Apache 2.0 License.
RabbitMQ
RabbitMQ is a message broker. The principal idea is pretty simple: it
accepts and forwards messages. You can think about it as a post
office: when you send mail to the post box you're pretty sure that Mr.
Postman will eventually deliver the mail to your recipient. Using this
metaphor RabbitMQ is a post box, a post office and a postman.
The major difference between RabbitMQ and the post office is the fact
that it doesn't deal with paper, instead it accepts, stores and
forwards binary blobs of data - messages.
Please feel free to log any issues on the
https://bitbucket.org/jmls/stomp issue system, and fork the project in
order to commit back all those new features that you are going to add
...
dot.r Stomp uses the permissive MIT licence
(http://en.wikipedia.org/wiki/MIT_License)
Have fun, enjoy !
Julian
Every change to the database must be part of a transaction. If you do not explicitly start one it will be implicitly started for you and scoped to the next outer block with transaction capabilities.
However and although I would not recommend you to, work with sub-transactions. You can invoke a sub transaction by explicitly specifying a DO TRANSACTION within the transaction scope. Although the database will never know about it, the client can roll back the sub transaction while the database can commit the transaction.
But in order to implement something like this you must master the concepts of transaction scope, block behavior and error handling.
RealHeavyDude.
Write your log entries to a no-undo temp-table.
When the code will commit a transaction, or transactions aren't active (transactionID = ?) have your code write the log entries out.
I don't think there is any way to do this in ABL as you planned either efficiently (sprinkling temp-table flushes or other tidbits all over the place is gross) or reliably (what if the application crashes with an un-flushed temp-table?), as others have mentioned. I would suggest making your complicated logging less coupled to your app by making the database writes asynchronous, occurring outside of your application if possible.
Since you're on Windows, you could change your logging to use the .NET log4net library instead of ABL constructs. log4net has a few appenders that would be useful:
AdoNetAppender which lets you log directly to a database
RemoteSyslogAppender which uses the syslog protocol, letting you log to an external Unix syslog or rsyslog daemon (rsyslog supports writing log messages to databases)
UDPAppender which sends the log messages via UDP packets somewhere else to be handled (e.g. a logFaces server, which supports writing to databases)
If you must do it in ABL then you could use a named output stream specifically for your log messages (OUTPUT TO STREAM) which writes to a specific location where an external process is listening to handle it. This file could be a pipe created by something like mkfifo or just a regular text file that is monitored for changes with inotify (not sure what the Windows equivalents of these are). This external process would handle parsing the messages and writing them to the database (basically re-inventing rsyslog).
I like the no-undo temp-table idea, just be sure to put the database write part in a "FINALLY" block in case of unhandled exceptions.

How do I configure WebSphere MQ distribution lists on the server side?

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
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 it does have 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 calls PUT it 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.

How to check POP3 mailbox for new messages via Powershell?

Is it possible to check POP3 mailbox for new e-mails via Powershell? And if possible, how can this be achieved?
This link provides some information but doesn't suit me. I know about NetCmdlets but would prefer not to use commercial tools. Also I do not want to start outlook.application. In fact, my goal is to avoid starting outlook, as long as it possible (for performance reasons)
As far as I know, there is no native POP3 class in the .NET FRAMEWORK. So you can write one using sockets or you can use an exe client. You can try GetMail for Windows.
What about creating a TCP connection using TCPClient, and next, create a NetworkStream object, connected to the TCPClient object, to read data from the server?
You'll need System.Net.Sockets and System.Net.IO.
Anyway I would search for a C# answer and then try to get it to powershell.

What are pros and cons of Msmqdistributor service of Enterprise Library?

We are using EntLib Logging Application Block. And also it turned out that we should use msmq for logging because of performance.
Now we are trying to use Msmqdistributor service to log those messages in the queue.
What are pros and cons of Msmqdistributor service of Enterprise Library?
Please share your experience.
The main drawback is going to be the Microsoft Message Queue (MSMQ) itself. MSMQ has been around for awhile and it is a pretty cool tool. It does however lack utilities. Because of the way that data is stored in the queue, most people end up needing to write some helper utilities for debugging and manually manipulating the queue. Some other things to consider:
Queue size - if too many items get put in the queue, and aren't removed in a timely manner the server can stall.
Purpose - MSMQ is designed for multi-step transactions (such as billing), you mention you are going to use it for logging. If the log is just for debugging, Then a DB table or a flat file or sending errors to a bug tracker will serve you better. If you need complicated logging and are using MSMQ to send the information to a different copmuter, then you will find MSMQ more useful.