Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveMQ configuration in WildFly 10.1 #215

Open
fribergr opened this issue Aug 4, 2017 · 1 comment
Open

ActiveMQ configuration in WildFly 10.1 #215

fribergr opened this issue Aug 4, 2017 · 1 comment

Comments

@fribergr
Copy link

fribergr commented Aug 4, 2017

Hi,

I'm currently trying to use this module to configure ActiveMQ for WildFly 10.1 but I'm running into some trouble and I'm not sure what I'm doing wrong.

Essentially we have three parts of the configuration.
First part was to add the extension (<extension module="org.wildfly.extension.messaging-activemq"/>). I did this by using wildfly::cli:

    wildfly::cli { 'Add messaging-activemq':
        command => '/extension=org.wildfly.extension.messaging-activemq:add()',
        unless  => '(outcome == success) of /extension=org.wildfly.extension.messaging-activemq:read-resource',
    }

Second part is adding <mdb> to ejb subsystem. This was achieved by this code:

    wildfly::resource { '/subsystem=ejb3':
        content => {
            'default-resource-adapter-name' => {
                'EXPRESSION_VALUE' => $ra_name,
            },
            'default-mdb-instance-pool'     => 'mdb-strict-max-pool'
        }
    }

$ra_name comes from hiera and it has the following value:
${ejb.resource-adapter-name:activemq-ra.rar}

Last part (the one I'm stuck on) is trying to configure this (comes from default standalone-full.xml):

       <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
            <server name="default">
                <security-setting name="#">
                    <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
                </security-setting>
                <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
                <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
                <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
                    <param name="batch-delay" value="50"/>
                </http-connector>
                <in-vm-connector name="in-vm" server-id="0"/>
                <http-acceptor name="http-acceptor" http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput" http-listener="default">
                    <param name="batch-delay" value="50"/>
                    <param name="direct-deliver" value="false"/>
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0"/>
                <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
                <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
                <connection-factory name="RemoteConnectionFactory" connectors="http-connector" entries="java:jboss/exported/jms/RemoteConnectionFactory"/>
                <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
            </server>
        </subsystem>

I've only managed to come this far:

    wildfly::cli { 'Add amq subsystem':
        command => '/subsystem=messaging-activemq:add()',
        unless  => '(outcome == success) of /subsystem=messaging-activemq:read-resource',
    }

    wildfly::cli { 'Add amq default server':
        command => '/subsystem=messaging-activemq/server=default:add()',
        unless  => '(outcome == success) of /subsystem=messaging-activemq/server=default:read-resource'
    }

    wildfly::cli { 'Add amq security-settings':
        command => '/subsystem=messaging-activemq/server=default/security-setting=#:add()',
        unless  => '(outcome == success) of /subsystem=messaging-activemq/server=default/security-setting=#:read-resource',
    }

    wildfly::cli { 'Add amq security-settings role':
        command => '/subsystem=messaging-activemq/server=default/security-setting=#/role=guest:add(consume=true, create-durable-queue=false, create-non-durable-queue=true, delete-durable-queue=false, delete-non-durable-queue=true, manage=false, send=true)',
        unless  => '(outcome == success) of /subsystem=messaging-activemq/server=default/security-setting=#/role=guest:read-resource',
    }

The first two seems to work fine, but the other two generate puppet errors when we run and I cannot figure out why:

Error: /Stage[main]/Profile::Appserver::Wildfly_server::Activemq_setup/Wildfly::Cli[Add amq security-settings]/Wildfly_cli[Add amq security-settings]: Could not evaluate: undefined method `elements' for nil:NilClass
Error: /Stage[main]/Profile::Appserver::Wildfly_server::Activemq_setup/Wildfly::Cli[Add amq security-settings role]/Wildfly_cli[Add amq security-settings role]: Could not evaluate: undefined method `elements' for nil:NilClass

Do you have any better way of configuring this? I'm looking at the default standalone-full.xml for the desired state regarding activemq configuration.

@fribergr
Copy link
Author

fribergr commented Aug 4, 2017

Seems to be due to name of security-setting. I've tried escaping the hash tag, and wrapping it in quotes, but it doesn't seem to work.

I tried this instead:

    wildfly::cli { 'Add amq security-settings':
        command => '/subsystem=messaging-activemq/server=default/security-setting=a:add()',
        unless  => '(outcome == success) of /subsystem=messaging-activemq/server=default/security-setting=a:read-resource',
    }
    wildfly::resource { '/subsystem=messaging-activemq/server=default/security-setting=a/role=guest':
        content => {
            'consume'                  => true,
            'create-durable-queue'     => false,
            'create-non-durable-queue' => true,
            'delete-durable-queue'     => false,
            'delete-non-durable-queue' => true,
            'manage'                   => false,
            'send'                     => true
        }
    }

And it seems to create the correct config in the xml.

Do we need to name system-security #?
And Is there some escaping that is needed to make the hash tag work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant