Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-7691

Custom pool not working when applied to Message-Driven Bean

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Major
    • None
    • 10.1.0.Final
    • EJB
    • Hide

      1) Create a JMS Queue:

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

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

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

      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.

      Show
      1) Create a JMS Queue: jms-queue add --queue-address=customQueue --entries=java:jboss/jms/customQueue 2) Create a custom pool with a max-pool-size greater than the default (let's use 50): /subsystem=ejb3/strict-max-bean-instance-pool=customPool/:add(max-pool-size=50,timeout=5,timeout-unit=MINUTES) 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.

    Description

      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.

      Attachments

        Activity

          People

            yborgess1@redhat.com Yeray Borges Santana
            evandro.pomatti Evandro Pomatti (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: