In Wildfly 9 is there a way to suspend only certain MDB - wildfly

I am able to call :suspend and :resume from the cli, however, this suspends all beans (EJB, MDB). Is there a way to only suspend message driven beans MDBs?
In my application all the work comes in via messages. If I can suspend the message consumers, I can be sure that rest of the system will continue to work until all the work in progress is finished. For example if an EJB was trying to put a message on the queue it will be able to do so.

You can use the following CLI operations on the MDB. For details see https://docs.jboss.org/author/display/WFLY10/Message+Driven+Beans+Controlled+Delivery. Though the documentation is for WildFly 10; it also works with WildFly 9.x
For standalone mode:
[standalone#localhost:9990 /] cd deployment=jboss-helloworld-mdb.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB
[standalone#localhost:9990 message-driven-bean=HelloWorldMDB] :stop-delivery
{"outcome" => "success"}
[standalone#localhost:9990 message-driven-bean=HelloWorldMDB] :start-delivery
{"outcome" => "success"}
For domain mode:
Stop delivery
/host=master/server=default/deployment=helloworld.app.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB:stop-delivery
Start delivery:
/host=master/server=default/deployment=helloworld.app.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB:start-delivery
If the MDB resides in an EJB jar inside an EAR file:
/host=master/server=default/deployment=helloworld.app.ear/subdeployment=helloworld.core.impl.jar/subsystem=ejb3/message-driven-bean=HelloWorldMDB:start-delivery

Related

WFLYCTL0362: Capabilities required by resource '/subsystem=microprofile-metrics-smallrye' are not available:

I am trying to migrate WildFly 21 to 24 .
I have these errors in the console. Server can not running it is stopped.
14:11:19,550 ERROR [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0362: Capabilities required by resource '/subsystem=microprofile-health-smallrye' are not available:
org.wildfly.extension.health.http-context; There are no known registration points which can provide this capability.
org.wildfly.extension.health.server-probes; There are no known registration points which can provide this capability. 14:11:19,550 ERROR [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0362: Capabilities required by resource '/subsystem=microprofile-metrics-smallrye' are not available:
org.wildfly.extension.metrics.http-context; There are no known registration points which can provide this capability.
I have added metrics and health extensions to standalone xmls
<extension module="org.wildfly.extension.microprofile.health-smallrye"/>
<extension module="org.wildfly.extension.microprofile.metrics-smallrye"/>
<subsystem xmlns="urn:wildfly:microprofile-health-smallrye:2.0" security-enabled="false" empty-liveness-checks-status="${env.MP_HEALTH_EMPTY_LIVENESS_CHECKS_STATUS:UP}" empty-readiness-checks-status="${env.MP_HEALTH_EMPTY_READINESS_CHECKS_STATUS:UP}"/>
<subsystem xmlns="urn:wildfly:microprofile-metrics-smallrye:2.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:wildfly}"/>
but for main configuration file I am using a different xml.
I saw in another questions using jboss.cli to add these extensions but jboss cli is not connecting because server can not running currently.
Do you have any suggestions or advices ?
Thanks.
You can still use CLI in "offline" mode to add the extension. First simply enter a CLI session with:
$JBOSS_HOME/bin/jboss-cli.sh
Then you can start the embedded server to make your changes.
embed-server
You should end up seeing something like this:
[disconnected /] embed-server
[standalone#embedded /]
From here you can enter CLI commands like:
/extension=org.wildfly.extension.microprofile.health-smallrye:add
/extension=org.wildfly.extension.microprofile.metrics-smallrye:add
/subsystem=microprofile-health-smallrye:add(security-enabled=false, empty-liveness-checks-status="${env.MP_HEALTH_EMPTY_LIVENESS_CHECKS_STATUS:UP}", empty-readiness-checks-status="${env.MP_HEALTH_EMPTY_READINESS_CHECKS_STATUS:UP}")
The output should look something like:
[standalone#embedded /] /extension=org.wildfly.extension.microprofile.health-smallrye:add
{"outcome" => "success"}
[standalone#embedded /] /extension=org.wildfly.extension.microprofile.metrics-smallrye:add
{"outcome" => "success"}
[standalone#embedded /] /subsystem=microprofile-health-smallrye:add(security-enabled=false, empty-liveness-checks-status="${env.MP_HEALTH_EMPTY_LIVENESS_CHECKS_STATUS:UP}", empty-readiness-checks-status="${env.MP_HEALTH_EMPTY_READINESS_CHECKS_STATUS:UP}")
{"outcome" => "success"}
Then you can just exit CLI.
I found out microprofile.health-smallrye and microprofile.metrics-smallrye are not supported in WildFly 24. You should use subsystem=metrics,subsystem=health.
If you look into this in detail check here.

Can not create jms-queue in wildfly using jboss-cli

I started wildfly 24 server with standalone-full.xml profile, when i run following command in jboss-cli to create jms-queue i get following error
[standalone#localhost:9990 /] jms-queue --profile=full add --queue-address=foo --entries=["java:/jms/queue/foo"]
WFLYCTL0175: Resource [
("subsystem" => "messaging-activemq"),
("server" => "default")
] does not exist; a resource at address [
("subsystem" => "messaging-activemq"),
("server" => "default"),
("jms-queue" => "foo")
] cannot be created until all ancestor resources have been added
What am i missing here? Any reference docs to create the jms server, queues?
Update:
I tried to create the server using web console first
And it filed with the required capabilities are not available, any documentation refernece that indicates what are the required capabilities i need to added prior configuring JMS
Yes don't use the profile parameter which is used in domain mode.
jms-queue add --queue-address=foo --entries=["java:/jms/queue/foo"]
works properly.
The issue is i was using wildfly "WildFly Preview EE 9.1 Distribution" the correct verirsion is "Jakarta EE 8 Full & Web Distribution"

Wildfly not starting properly

So I have a rather strange issue with wildfly not starting...
If I clean the standalone/deployments of everything but one .war file, wildfly starts perfectly. I can then add in all other .war files(6 in total) and wildfly deploys them without issues.
However if I have all the war files in there and start wildfly it completely fails. It stays in a state where everything is set to .isdeploying for maybe 5 minutes until everything gets set to failed.
The logs that I am getting from service wildfly status
Feb 09 08:49:12 wildfly[2079]: /etc/init.d/wildfly: 3: /etc/default/wildfly: default: not found
Feb 09 08:49:12 wildfly[2079]: * Starting WildFly Application Server wildfly
Feb 09 08:49:43 wildfly[2079]: ...done.
Feb 09 08:49:43 wildfly[2079]: * WildFly Application Server hasn't started within the timeout allowed
Feb 09 08:49:43 wildfly[2079]: * please review file "/var/log/wildfly/console.log" to see the status of the service
Has anyone seen anything like this before?
After looking aroung I found this just before it undeployed everything:
ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated t
he service container was 'add' at address '[
("core-service" => "management"),
("management-interface" => "http-interface")
]'
But I am still not sure what i means...
This happened to me too starting on WildFly 11 and above IIRC.
Are you trying to access to the public or management IP while the server is booting? Basically you have to wait until the server has started to access those IPs.
My workaround was use the marker files that deployment scanner checks.
https://docs.jboss.org/author/display/WFLY/Application+deployment#Applicationdeployment-MarkerFiles
Before you start wildfly you have to put a .skipdeploy file for each .war you want to skip. Then, when the server has started you only have to delete that file to let wildfly start the deployment. You can achieve this making a shell script and calling it from your standalone.sh
This error shows that your IP/Port is being used by another process.
Use below command to check it.
For windows: use netstat -aon | find "port number"
You can configure jboss.as.management.blocking.timeout system property to tune timeout (seconds) waiting for service container stabilityas below :
...
</extensions>
<system-properties>
<property name="jboss.as.management.blocking.timeout" value="900"/>
</system-properties>
<management>
...
Or, if still doesn't work this way, collect a series of thread dumps during your startup period so we can see what it might be getting stuck on.

How to add keycloak subsystem to secure WARs using jboss-cli

I am following the keycloak documentation to secure my WAR using wildfly adapter subsystem.
I am trying to add the following using jboss-cli.sh -
<secure-deployment name="WAR MODULE NAME.war">
<realm>bkofc</realm>
<auth-server-url>http://192.168.99.100:30001/auth</auth-server-url>
<bearer-only>true</bearer-only>
<ssl-required>EXTERNAL</ssl-required>
<resource>bkofc-svc</resource>
<credential name="secret">9bcc6d9f-9c72-4b58-b297-79f0f207d9e1</credential>
<use-resource-role-mappings>true</use-resource-role-mappings>
</secure-deployment>
However the "credential" attribute is not recognized :
[standalone#localhost:9990 /]
/subsystem=keycloak/securedeployment=my.war/:add(realm=bkofc,auth-server-
url=http://192.168.99.100/30001/auth, bearer-only=true, ssl-
required=EXTERNAL, resource=bkofc-svc, use-resource-role-mappings=true,
credential=9bcc6d9f-9c72-4b58-b297-79f0f207d9e1)
'credential' is not found among the supported properties: [allow-any-
hostname, always-refresh-token, auth-server-url, auth-server-url-for-
backend-requests, autodetect-bearer-only, bearer-only, client-key-password,
client-keystore, client-keystore-password, connection-pool-size, cors-
allowed-headers, cors-allowed-methods, cors-max-age, disable-trust-manager,
enable-basic-auth, enable-cors, expose-token, min-time-between-jwks-
requests, principal-attribute, public-client, realm, realm-public-key,
register-node-at-startup, register-node-period, resource, ssl-required,
token-minimum-time-to-live, token-store, truststore, truststore-passw
ord, turn-off-change-session-id-on-login, use-resource-role-mappings]
[standalone#localhost:9990 /]
Without the credential property, rest are getting added properly.
How can I fix this ?
You have to add credential a bit later, you should try something like:
/subsystem=keycloak/securedeployment=my.war/:add(realm=bkofc,auth-server-url=http://192.168.99.100/30001/auth, bearer-only=true, ssl-required=EXTERNAL, resource=bkofc-svc, use-resource-role-mappings=true)
/subsystem=keycloak/secure-deployment=my.war/credential=secret:add(value="9bcc6d9f-9c72-4b58-b297-79f0f207d9e1")

LogNotificationListener take a while on startup of Jboss

When I start my Jboss server (5.1), I have the following line in logs:
[LogNotificationListener] Adding notification listener for logging
mbean "jboss.system:service=Logging,type=Log4jService" to server
org.jboss.mx.server.MBeanServerImpl#1bfefb[ defaultDomain='jboss' ]
This line takes 30 seconds before to continue the startup.
I don't know what does this line (the code behind this line of course).
Why takes it a long time and what does it do ?
Thanks.
Enable DEBUG logging and you will see what's going on. Add to startup parameters
-Djboss.server.log.threshold=DEBUG
and you will see it in:
jboss-as/server/${profile}/log/server.log
Or change configuration to see it in console. Config file is here:
jboss-as/server/${profile}/conf/jboss-log4j.xml