Logstash + stomp + ActiveMQ - activemq

I'm using logstash to read a CSV file and post the information to my ActiveMQ using the stomp protocol.
Everything is working great, I only want to add persistence to those messages but I don't know how to tell logstash to do so.
The ActiveMQ site say I need to tell my stomp producer to add the "persistent:true" parameter, but I don't find any documentation about this on logstash site.
Anyone knows anything about this?
Thanks in advance,
http://activemq.apache.org/stomp.html

Well, persistence cannot be set on logstash stomp output.
If this is very important to you, it should be a simple fix in the source.
You can find the file here:
And this line:
#client.send(event.sprintf(#destination), event.to_json)
should be something like this:
#client.send(event.sprintf(#destination), event.to_json, :persistent => true)
You have to build it and install the plugin yourself. My Ruby skills are limited so I have no idea how to do that. Maybe consider adding that as a config param and contribute it with a pull request?

Now you can use the attribute headers to send persistent messages:
stomp {
host => "localhost"
port => 61612
destination => "my_queue"
headers => {
"persistent" => true
}
}
Source:
https://github.com/logstash-plugins/logstash-output-stomp/issues/7

Related

unknown exchange type 'x-delay-message' RabbitMq with MassTransit

I've been installed 'RabbitMQ Delayed Message Plugin'. and can be see on plugins list of RabbitMq.
and configured MassTnasit with RabbitMq Using the follow code:
var services = new ServiceCollection();
services.AddMassTransit(x =>
{
x.AddRabbitMqMessageScheduler();
x.UsingRabbitMq((context, cfg) =>
{
cfg.UseDelayedExchangeMessageScheduler();
cfg.ConfigureEndpoints(context);
});
});
and injected 'IMessageScheduler' interface to my business service and called 'IMessageScheduler.ScheduledPublish<>()'.
but I got this error: unknown exchange type 'x-delay-message' RabbitMq with MassTransit
For that version of RabbitMQ, you need the latest version of the plug-in which is available on GitHub.
I've updated the MassTransit Docker image to the latest as well: MassTransit/RabbitMQ
Updated rabbitmq_delayed_message_exchange plugin version from 3.8.0 to 3.8.9 resolved my issue.
We also faced the same issue while using the CloudMQ instance (RabbitMQ managed services).
Error: Error 400 (bad_request): unknown exchange type 'x-delayed-message'
Upon checking the RabbitMQ Instance details from the CloudMQ portal it was found that the plugin "delayed-message" was not installed & post installing the plugin resolved the issue.

Is there a way to set JMS to use SSL/TLS connecting to IBM MQ?

We have a Java application that uses JMS to communicate with IBM MQ. A part of their requirement is now to use TLS. Is there a way to do this? The parameters they were expecting to add are:
sslCipherSuite
hostname
port
channel
Is there any system environment property that we can set to JMS for this parameters?
the current code uses
import javax.jms.ConnectionFactory;
and we use to a config file to set system env variables.
environment.setProperty("java.naming.factory.initial", this.config.get("JMS_JndiContextFactory"));
this.setJndiExtraParameters(environment, this.config.get("JMS_JndiExtraParameters"));
while (!this.state.atLeast(State.GOT_FACTORY) && iterator.hasNext()) {
environment.setProperty("java.naming.provider.url", this.urlUsed = iterator.next());
try {
JmsClient.LOGGER.debug("Looking up connection factory");
this.factory = (ConnectionFactory)new InitialContext(environment).lookup(this.config.get("JMS_FactoryName"));
this.state = State.GOT_FACTORY;
}
im thinking if there is a way to set only another set of system properties instead of using
MQConnectionFactory
so we don't have to change something in the code?
i posted a similar question , reposted it because of lack of clarity

get all queue names for activemq in java

I'm trying to get all the names of the queues for activeMQ in java, I found couple topics here and here about that and people suggested using DestinationSource which I wasn't able to import in Eclipse when I was writing the code. I tried:
import org.apache.activemq.advisory.DestinationSource;
I'm using java 1.7 and latest activemq version 5.14.1. Any ideas if destinationsource is still supported or not?
Thanks,
The easiest way to get a handle on this information is by using Jolokia, which is installed by default. To do this, use an HTTP client to issue a GET request to one of the following URIs:
http://localhost:8161/api/jolokia/search/*:destinationType=Queue,*
http://localhost:8161/api/jolokia/search/*:destinationType=Topic,*
You will need to pass in the JMX username and password (default: admin/admin) as part of the HTTP request. The system will respond with something along the lines of:
{
"request" : {
"mbean" : "*:destinationType=Queue,*",
"type" : "search"
},
"status" : 200,
"timestamp" : 1478615354,
"value" : [
"org.apache.activemq:brokerName=localhost,destinationName=systemX.bar,destinationType=Queue,type=Broker",
"org.apache.activemq:brokerName=localhost,destinationName=systemX.foo,destinationType=Queue,type=Broker",
"org.apache.activemq:brokerName=localhost,destinationName=ActiveMQ.DLQ,destinationType=Queue,type=Broker"
]
}
The above shows the queues systemX.foo, systemX.bar, ActiveMQ.DLQ. Here's an example of using the curl command for this:
curl -u admin http://localhost:8161/api/jolokia/search/*:destinationType=Queue,* && echo ""
For a good explanation of how to use the Jolokia APIs, refer to the documentation.
The feature is still supported in the ActiveMQ project, with the caveat that it may not always work based on comments already given here. If you have advisory support enabled on the Broker then it should provide you with some insight into the destinations that exist, although JMX would give you more management of said destinations.
There's unit tests that show the DestinationSource feature which you can refer to. You need to put the 'activemq-client' jar in the class path so perhaps your IDE project isn't configured properly.

How can use config section in rebus 2?

I'm trying to configure rebus using app.config. This lines are working in older versions of rebus, but in the new version (Rebus 2) it does not work.
.Transport(t => t.UseMsmqAndGetInputQueueNameFromAppConfig())
.MessageOwnership(o => o.FromRebusConfigurationSection())
What are the equivalent ones in rebus 2?
Unfortunately, there's no equivalent for the queue name and worker configuration in Rebus 2.
You can configure your endpoint mappings with the Rebus.XmlConfig package by going
Configure.With(...)
(...)
.Routing(t => t.AddEndpointMappingsFromAppConfig())
(...)
though.
Maybe there will be some way of picking up settings from app.config/web.config in the future - but the configuration thing is one big thing that I know will not be portable to .NET core if it's based on ConfigurationManager.AppSettings, so I intentionally left it out.

What for a message browser would be available for activeMQ?

Is there a message / queue browser for activeMQ available?
I tried Hermes JMS, but it is not working for activeMQ 5.10, anymore.
We need a browser where we can export a message into XML.
Any suggestions?
Thanks and regards.
You can try hawtio which is a web console that has plugins for various technologies, such as ActiveMQ.
hawtio is created by the people who also created Camel and ActiveMQ and thus has great plugins for those.
http://hawt.io/
Hermes is able to connect to AMQ but perhaps you need to use older AMQ libs on the client/hermes side, like v5.7.0 or similar.
Hawt.io is great to read/move/browse/delete/send messages but you may need additional tools to export/import data.
You cannot export a JMS message to XML in a generic way. What you can do is to export the payload to a file (which may be XML).
To export messages into a files, you can use a command line tool called A. Then you can write a -b tcp://localhost:61616 -c 20 -o file.xml MY.QUEUE and you will have 20 messages exported to file-1.xml, file-2.xml .. file-20.xml.
Disclaimer: I am the author of "A".