Use custom artemis.profile with ApacheMQ Artemis - activemq-artemis

Can I pass my custom artemis.profile to my ActiveMQ Artemis broker (the profile then points to the required location for jolokia-access.xml).

There is no direct support for using a custom artemis.profile, but you can modify the bin/artemis script. Here are the relevant lines:
ARTEMIS_INSTANCE_ETC='/path/to/custom/etc'
. "$ARTEMIS_INSTANCE_ETC/artemis.profile"
The first line sets the path used to find artemis.profile. The second line actually pulls the values from artemis.profile into the artemis script.

Related

Debezium Server and using variables in the application.properties file

I'm trying to get Debezium Server running so that I can use GCP (Google) PubSub, and not have to use Kafka and the Kafka connectors. I have it mostly running, however, I'm having trouble with the using variables in the tranforms section to define a Topic name.
According to the documentation, when using the Outbox transformation, I can choose the Topic name by using the variable ${routedByValue} for the setting route.topic.replacement and this will use the value that is determined by the setting route.by.field. If the replacement setting is omitted, it will use a default topic name of outbox.event.<route.by.field value>.
When I try to use this variable in the 'application.properties' file ...
debezium.transforms.outbox.route.by.field=aggregate_type
debezium.transforms.outbox.route.topic.replace=${routedByValue}
... the Debezium Server stops with a NoSuchElementException, saying it cannot expand routedByValue. If I omit that setting, it works fine and defines the topic name as outbox.event.<route.by.field value>.
How can I use this variable correctly in the 'applications.properties' file so I can customise the topic name (e.g. route.topic.replace=myservice.${routedByValue})?
The way I got this to work was to do the following ...
debezium.transforms.outbox.route.by.file=aggregate_type
debezium.transforms.outbox.route.topic.replacement=$1
I believe this works because omitted from the config is another setting - debezium.transforms.outbox.route.topic.regex - and this has a default value of - (?<routedByValue>.*).
If I understand the documentation correctly, the $1 refers to the first group in the regex expression. In my case, this will return whatever the value of aggregrate_type equates to.
I'm using Debezium Server 2.1 with Pulsar as sink type and the #Dazfl answer solve my issue !
debezium.transforms=outbox
debezium.transforms.outbox.type=io.debezium.transforms.outbox.EventRouter
debezium.transforms.outbox.route.topic.replacement=outbox.event.transactions.$1
Although the Debezium Server docs says to use $routedByValue, this do not works as expeceted...

Create ActiveMQ Artemis broker with command line only

I'm trying to create an ActiveMQ Artemis broker instance using the command-line only but it seems that allow-anonymous option is ignored and the question "Allow anonymous?" comes anyway after I run the create command like this:
./artemis-2.17.0/bin/artemis create --user=test --password=test --allow-anonymous=Y ./broker-name
What is the right way to pass the allow-anonymous option and avoid to get that question?
If you run this command you will see all the available options for the create command:
artemis help create
One of these options is --allow-anonymous. This doesn't need to be set to any value. Also the options which do take a value do not need the equal sign (=). Therefore, your command should look like this:
artemis create --user test --password test --allow-anonymous ./broker-name

Wildfly - logging into one file

It seems my wildfly server produces separate log file for each day: like
server.log.2017-06-30 server.log.2017-07-06. Is it possible to make it logging into one (always same) file?
By default WildFly is configured to use a periodic-rotating-file-handler which rotates every day. If you don't want log rotation you can use a file-handler instead.
The following CLI commands will make the change to using a file-handler.
batch
/subsystem=logging/root-logger=ROOT:remove-handler(name=FILE)
/subsystem=logging/periodic-rotating-file-handler=FILE:remove
/subsystem=logging/file-handler=FILE:add(named-formatter=PATTERN, append=true, autoflush=true, file={relative-to=jboss.server.log.dir, path=server.log})
/subsystem=logging/root-logger=ROOT:add-handler(name=FILE)
run-batch
One attribute to note is the append attribute. I've set it to true so that you won't lose any log messages on a reboot or when this command is executed. If you're not concerned about losing log messages you could set it to false.

How to dynamically configure security for Artemis MQ addresses

Trying to dynamically create and provide security metadata for artemis mq topics (as opposed to defining them statically in broker.xml).
For that purpose I've implemented (as described here) the SecuritySettingPlugin interface.
Now, the issue is the getSecurityRoles/populateSecurityRoles of the implementation are called only at server startup.
So, at some point in time after the mq server has been started, a topic will be created :
org.apache.activemq.artemis.api.jms.management.JMSServerControl.createTopic("newTopic")
Now I would like artemis to call again my SecuritySettingPlugin implementation to get the updated security roles (which will include configuration for the newly created newTopic).
Is that possible ?
P.S. security-invalidation-interval does not invalidate roles configuration cache.
Seems there is a way to customize an address security by API :
ActiveMQServerControl.addSecuritySettings()

How to make ActiveMQ transportConnector property environmentaly-dependent

I'm looking for a way to replace this on my ActiveMQ config:
<transportConnector uri="tcp://localhost:60019"> disableAsyncDispatch="false"/>
with a "not-hardcoded" URI (e.g., replacing "localhost" with a variable that resolves to an instance dependent value). The problem is that as we have many JBoss instances per server, and that URI above resolves to 0.0.0.0:60019, only one instance at a time can be running, unless we configure it in a per-application basis, which is not only frustrating, but there are circumstances where it is not enough (should be per-instance based, which is much more frustrating).
Each JBoss server has its own IP address, so I thought of using ${jboss.bind.address} to circumvent this, but it won't syntax. We also have an environment variable %SERVERIP% which could be used for this calling it from a start up script, but I don't know if ActiveMQ reads an environment variable for assigning its transport connector URI.
Any help would be much appreciated.
Use a PropertyPlaceHolderConfigurer and you should be able to replace the uri with some ${variable} from file or from jvm system variable. This should work since ActiveMQ configuration is really just a Spring context.