Aries' Blog

Freestyle technical blog

Artemis MQ with Springboot

ArtemisMQ is successor of ActiveMQ, using it with springboot is easy as auto-configuration is provided by spring-boot-starter-artemis. A starter project is created here. Below are some notes in using the starter project.

1. Artemis mode in Springboot config

There are 2 modes for the configuration spring.artemis.mode:

  • embedded
    Server mode, embed Artemis Server into the springboot app. Note: By default embedded server only accept internal connection. See point 2 to allow external connection.
  • native
    Client mode, no Artemis Server included. A JmsTemplate will be auto-configured for connecting to the Artemis Server specified by host & port properties.
          mode: native  # client mode
          host: localhost
          port: 61616

2. Allow embedded Artemis server to receive external connection

By default embedded Artemis won’t accept external connection. To allow this, edit springboot default config with below code.

public class ArtemisConfig implements ArtemisConfigurationCustomizer {
    public void customize(org.apache.activemq.artemis.core.config.Configuration configuration) {
        // Allow Artemis to accept tcp connections (Default port localhost:61616)
        configuration.addConnectorConfiguration("nettyConnector", new TransportConfiguration(NettyConnectorFactory.class.getName()));
        configuration.addAcceptorConfiguration(new TransportConfiguration(NettyAcceptorFactory.class.getName()));

3. Artemis auto destination creation feature

There is no need to define destinations (e.g. queue) in Artemis Server as destination are auto created when first use (e.g. incoming message).

Regex notes

Regex is very useful but hard to remember, I use it infrequently and always forget the syntax.

Regex reserved characters

Chars Description
. Any single character.
( ) Grouping delimitators.
[ ] Character set delimiters. OR at character level
| OR expression for patterns (one or another).
{ } Repetitions delimiters.
* Zero or more repetitions of the previous character.
+ One or more repetitions.
? Zero or one repetition. Also it’s used for lazy matches.
^ Start of the string. You can use it to force a pattern to match only at the start. Also it’s used as a NOT inside of character sets.
$ End of the string.
/ Separator. In many regex engines, regex patterns must be enclosed in /s
- Range definition. Used to define a range of consecutive characters, like A-Z
\ Escape character for all reserved characters, so \? will search for a literal ?. It’s also used for other special search patterns (see below).

Below online regex tester can provide great help.

Unicode character

Use \x{FFFF} pattern to search for unicode. It works for both Java & Notepad++

1. Java

Java regex engine is similar to Perl one.

I found this Java Regex Tester most helpful as it provide as a Java string view of the Regex which you can use directly in code. This tester is based on Java 6.

Java Regex engine spec is documented in java.util.regex.Pattern API doc, this link to Java 8 one.

2. Notepad++

Notepad++ support regex search by selecting Regular expression under Search Mode in the search window. It supports PCRE (PERL Compatible Regular Expressions). Use this tester and select PCRE.

Note that / (forward slash) need to be escaped in tester but not in notepad++.

So patterns

^http(s?):\/\/\/path\/to\/page and


both work in notepad++, but only the first one is valid in the tester.

3. Grep

Use grep -E or simply egrep to activate Extended Regular Expressions function, then grep will behave like Notepad++.


^http(s?):\/\/\/path\/to\/page and


both work with grep -E or egrep .