[jboss-jira] [JBoss JIRA] (WFLY-7691) Custom pool not working when applied to Message-Driven Bean

Evandro Pomatti (JIRA) issues at jboss.org
Mon Nov 28 20:39:00 EST 2016


     [ https://issues.jboss.org/browse/WFLY-7691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Evandro Pomatti updated WFLY-7691:
----------------------------------
    Steps to Reproduce: 
1) Create a JMS Queue:



{noformat}
jms-queue add --queue-address=customQueue --entries=java:jboss/jms/customQueue
{noformat}



2) Create a custom pool with a max-pool-size greater than the default (let's use 50):



{code:java}
/subsystem=ejb3/strict-max-bean-instance-pool=customPool/:add(max-pool-size=50,timeout=5,timeout-unit=MINUTES)
{code}



3) Create a WAR application with an MDB and assign the annotation @Pool("customPool") to the MDB and also @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "50") to match the pool max size. Add a Thread.sleep to the onMessage() method to simulate.


{code:java}
@MessageDriven(name = "CustomMDB", activationConfig = {
		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
		@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/jms/customQueue"),
		@ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "50") })
@Pool("customPool")
public class DummyListener implements MessageListener {

	private static AtomicInteger count = new AtomicInteger();

	@Override
	public void onMessage(Message message) {

		try {
			System.out.println("Count: " + count.incrementAndGet());
			Thread.sleep(10000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
{code}


@Pool annotation needs the following dependency:

		<dependency>
			<groupId>org.jboss.ejb3</groupId>
			<artifactId>jboss-ejb3-ext-api</artifactId>
			<version>2.2.0.Final</version>
			<scope>provided</scope>
		</dependency>

4) Deploy the application and send 50 messages to the queue.

@Stateless
@Path("/enqueue")
public class DummyResource {

	@Inject
	@JMSConnectionFactory("java:/JmsXA")
	private JMSContext context;

	@Resource(mappedName = "java:jboss/jms/customQueue")
	private Queue customQueue;

	@GET
	public void get() {
		IntStream.range(0, 50).forEach(i -> context.createProducer().send(customQueue, "message"));
	}

}


Only 15 queue messages will be dequeue at a time, not the 50 that was specified in the pool.

I also don't know why 15, since the default MDB pool is configured to be 20.

  was:
1) Create a JMS Queue:



{noformat}
jms-queue add --queue-address=customQueue --entries=java:jboss/jms/customQueue
{noformat}



2) Create a custom pool with a max-pool-size greater than the default (let's use 50):


{panel:title=My title}
/subsystem=ejb3/strict-max-bean-instance-pool=customPool/:add(max-pool-size=50,timeout=5,timeout-unit=MINUTES)
{panel}


3) Create a WAR application with an MDB and assign the annotation @Pool("customPool") to the MDB and also @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "50") to match the pool max size. Add a Thread.sleep to the onMessage() method to simulate.

@MessageDriven(name = "CustomMDB", activationConfig = {
		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
		@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/jms/customQueue"),
		@ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "50") })
@Pool("customPool")
public class DummyListener implements MessageListener {

	private static AtomicInteger count = new AtomicInteger();

	@Override
	public void onMessage(Message message) {

		try {
			System.out.println("Count: " + count.incrementAndGet());
			Thread.sleep(10000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}

@Pool annotation needs the following dependency:

		<dependency>
			<groupId>org.jboss.ejb3</groupId>
			<artifactId>jboss-ejb3-ext-api</artifactId>
			<version>2.2.0.Final</version>
			<scope>provided</scope>
		</dependency>

4) Deploy the application and send 50 messages to the queue.

@Stateless
@Path("/enqueue")
public class DummyResource {

	@Inject
	@JMSConnectionFactory("java:/JmsXA")
	private JMSContext context;

	@Resource(mappedName = "java:jboss/jms/customQueue")
	private Queue customQueue;

	@GET
	public void get() {
		IntStream.range(0, 50).forEach(i -> context.createProducer().send(customQueue, "message"));
	}

}


Only 15 queue messages will be dequeue at a time, not the 50 that was specified in the pool.

I also don't know why 15, since the default MDB pool is configured to be 20.



> Custom pool not working when applied to Message-Driven Bean
> -----------------------------------------------------------
>
>                 Key: WFLY-7691
>                 URL: https://issues.jboss.org/browse/WFLY-7691
>             Project: WildFly
>          Issue Type: Bug
>          Components: EJB
>    Affects Versions: 10.1.0.Final
>            Reporter: Evandro Pomatti
>              Labels: mdb, pool
>
> I tried to configure a custom thread pool por an MDB in order to increase performance, but it seems that the association is being ignored by WildFly.
> When I associate my custom pool with increased size to 50 to my MDB, only 15 messages keep getting dequeue at a time.
> I also don't know why 15, since the default MDB pool "mdb-strict-max-pool" max size is configured to be 20.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list