forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the Java Message System Factory and Queue inside a producer. I…
- Loading branch information
1 parent
93c76b4
commit 743706c
Showing
3 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/edu/harvard/iq/dataverse/ingest/IngestQueueProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package edu.harvard.iq.dataverse.ingest; | ||
|
||
import javax.annotation.Resource; | ||
// https://www.baeldung.com/jee-cdi-vs-ejb-singleton | ||
import javax.inject.Singleton; | ||
import javax.enterprise.inject.Produces; | ||
import javax.jms.JMSConnectionFactoryDefinition; | ||
import javax.jms.JMSDestinationDefinition; | ||
import javax.jms.Queue; | ||
import javax.jms.QueueConnectionFactory; | ||
|
||
@JMSConnectionFactoryDefinition( | ||
description = "Dataverse Ingest Queue Factory", | ||
name = "java:app/jms/factory/ingest", | ||
resourceAdapter = "jmsra", | ||
interfaceName = "javax.jms.QueueConnectionFactory", | ||
maxPoolSize = 250, | ||
minPoolSize = 1, | ||
properties = { | ||
"org.glassfish.connector-connection-pool.max-wait-time-in-millis=60000", | ||
"org.glassfish.connector-connection-pool.pool-resize-quantity=2" | ||
} | ||
) | ||
@JMSDestinationDefinition( | ||
description = "Dataverse Ingest Queue", | ||
name = "java:app/jms/queue/ingest", | ||
resourceAdapter = "jmsra", | ||
interfaceName="javax.jms.Queue", | ||
destinationName = "DataverseIngest" | ||
) | ||
@Singleton | ||
public class IngestQueueProducer { | ||
|
||
@Resource(lookup="java:app/jms/queue/ingest") | ||
Queue ingestQueue; | ||
|
||
@Resource(lookup="java:app/jms/factory/ingest") | ||
QueueConnectionFactory ingestQueueFactory; | ||
|
||
@Produces | ||
public Queue getIngestQueue() { | ||
return ingestQueue; | ||
} | ||
|
||
@Produces | ||
public QueueConnectionFactory getIngestQueueFactory() { | ||
return ingestQueueFactory; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters