-
1. Re: How to send mail to notify an app deployment?
ybxiang.china Sep 23, 2013 4:50 AM (in response to rodrigo.uchoa)why NOT send email/JMS by yourself in your core service?
It's controllable!
For example:
@Local(ICoreService.class)
@Singleton
@Startup
public class CoreService implements ICoreService{
...
@PersistenceContext
private EntityManager em;
@PostConstruct
public void start() throws Exception {
log.info(ServerConstants.SERVICE_STARTING_FLAG);
//send email or JMS here
log.info(ServerConstants.SERVICE_STARTED_FLAG);
}
@PreDestroy
public void destroy(){
log.info(ServerConstants.SERVICE_DESTROYING_FLAG);
//send email or JMS here
log.info(ServerConstants.SERVICE_DESTROYED_FLAG);
}
}
-
2. Re: How to send mail to notify an app deployment?
ybxiang.china Sep 23, 2013 4:51 AM (in response to rodrigo.uchoa)More info.
About sending email: JBoss AS 7.2.0 - Java EE application development - 10.How to configure and use email Session
-
3. Re: How to send mail to notify an app deployment?
ybxiang.china Sep 23, 2013 4:54 AM (in response to rodrigo.uchoa)it seems that JBoss 7 doesn't support JMX MBeans anymore.
~~~~~Are you sure?
I can flush JAAS cache through JMX:
@RolesAllowed({KnownJaasRoles.ADMINISTRATOR}) public void flushJaasCache(String securityDomain) {
try { javax.management.MBeanServerConnection mbeanServerConnection = java.lang.management.ManagementFactory .getPlatformMBeanServer(); javax.management.ObjectName mbeanName = new javax.management.ObjectName( "jboss.as:subsystem=security,security-domain=" + securityDomain); mbeanServerConnection.invoke(mbeanName, "flushCache", null, null); } catch (Exception e) { throw new SecurityException(e); } }