= Containers and Resources
:index-group: Configuration
:jbake-date: 2018-12-05
:jbake-type: page
:jbake-status: published

== Containers

=== CMP_ENTITY

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Container?type=CMP_ENTITY
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| CmpEngineFactory
| Default value is `org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory`.

| TransactionManager
| Transaction manager used by the container.
|===

'''

=== BMP_ENTITY

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Container?type=BMP_ENTITY
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| PoolSize
| Specifies the size of the bean pools for this BMP entity container.
Default value is `10`.
|===

'''

=== STATELESS

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Container?type=STATELESS
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| TimeOut
| Specifies the time to wait between invocations, in milliseconds.
A value of `0` means no timeout.
Default value is `0`.

| PoolSize
| Specifies the size of the bean pools for this stateless SessionBean container.
Default value is `10`.

| StrictPooling
| Controls behavior when the pool reaches its maximum size.
If `true`, requests wait for instances to become available and the pool never grows beyond `PoolSize`.
If `false`, temporary instances are created for one invocation and then discarded.
Default value is `true`.
|===

'''

=== STATEFUL

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Container?type=STATEFUL
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| Passivator
| Responsible for writing beans to disk during passivation.
Known implementations:
`org.apache.openejb.core.stateful.RAFPassivater`
`org.apache.openejb.core.stateful.SimplePassivater`
Default value is `org.apache.openejb.core.stateful.SimplePassivater`.

| TimeOut
| Specifies the time to wait between invocations, in minutes.
A value of `0` means no timeout.
Default value is `20`.

| PoolSize
| Specifies the size of the bean pools for this stateful SessionBean container.
Default value is `1000`.

| BulkPassivate
| Number of instances to passivate at one time during bulk passivation.
Default value is `100`.
|===

'''

=== MESSAGE

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Container?type=MESSAGE
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| ResourceAdapter
| Resource adapter that delivers messages to the container.
Default value is *Default JMS Resource Adapter*.

| MessageListenerInterface
| Message listener interface handled by this container.
Default value is `jakarta.jms.MessageListener`.

| ActivationSpecClass
| Activation specification class.
Default value is `org.apache.activemq.ra.ActiveMQActivationSpec`.

| InstanceLimit
| Maximum number of bean instances allowed per MDB deployment.
Default value is `10`.
|===

'''

== Resources

=== javax.sql.DataSource

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Resource?type=javax.sql.DataSource
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| JtaManaged
| Determines whether the datasource is JTA managed.
Default value is `true`.

| JdbcDriver
| JDBC driver class name.
Default value is `org.hsqldb.jdbcDriver`.

| JdbcUrl
| JDBC URL for creating connections.
Default value is `jdbc:hsqldb:file:data/hsqldb/hsqldb`.

| UserName
| Default username.
Default value is `sa`.

| Password
| Default password.

| ConnectionProperties
| Properties passed to the JDBC driver when creating connections.
Format: `[propertyName=property;]*`
`user` and `password` are passed explicitly.

| DefaultAutoCommit
| Default auto-commit state of new connections.
Default value is `true`.

| DefaultReadOnly
| Default read-only state of new connections.
If not set, `setReadOnly` is not called.

| DefaultTransactionIsolation
| Default transaction isolation level.
Allowed values: `NONE`, `READ_COMMITTED`, `READ_UNCOMMITTED`, `REPEATABLE_READ`, `SERIALIZABLE`.

| InitialSize
| Initial number of connections created when the pool starts.
Default value is `0`.

| MaxActive
| Maximum number of active connections.
Default value is `20`.

| MaxIdle
| Maximum number of idle connections.
Default value is `20`.

| MinIdle
| Minimum number of idle connections.
Default value is `0`.

| MaxWait
| Maximum wait time (ms) for a connection before throwing an exception.
Default value is `-1`.

| ValidationQuery
| SQL query used to validate connections.

| TestOnBorrow
| Validate connections before borrowing.
Default value is `true`.

| TestOnReturn
| Validate connections before returning to the pool.
Default value is `false`.

| TestWhileIdle
| Validate connections during idle eviction runs.
Default value is `false`.

| TimeBetweenEvictionRunsMillis
| Time between idle eviction runs (ms).
Default value is `-1`.

| NumTestsPerEvictionRun
| Number of connections tested per eviction run.
Default value is `3`.

| MinEvictableIdleTimeMillis
| Minimum idle time before eviction.
Default value is `1800000`.

| PoolPreparedStatements
| Enables pooling of prepared statements.
Default value is `false`.

| MaxOpenPreparedStatements
| Maximum open prepared statements.
Default value is `0`.

| AccessToUnderlyingConnectionAllowed
| Allows access to the raw JDBC connection.
Default value is `false`.
|===

'''

=== ActiveMQResourceAdapter

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Resource?type=ActiveMQResourceAdapter
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| BrokerXmlConfig
| Broker configuration.
Default value is `broker:(tcp://localhost:61616)?useJmx=false`.

| ServerUrl
| Broker address.
Default value is `vm://localhost?async=true`.

| DataSource
| Datasource for message persistence.
Default value is *Default Unmanaged JDBC Database*.
|===

'''

=== jakarta.jms.ConnectionFactory

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Resource?type=jakarta.jms.ConnectionFactory
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| ResourceAdapter
| Default value is *Default JMS Resource Adapter*.

| TransactionSupport
| Transaction support type: `xa`, `local`, or `none`.
Default value is `xa`.

| PoolMaxSize
| Maximum number of physical connections.
Default value is `10`.

| PoolMinSize
| Minimum number of physical connections.
Default value is `0`.

| ConnectionMaxWaitMilliseconds
| Maximum time to wait for a connection.
Default value is `5000`.

| ConnectionMaxIdleMinutes
| Maximum idle time before reclaiming a connection.
Default value is `15`.
|===

'''

=== jakarta.jms.Queue

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Resource?type=jakarta.jms.Queue
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| destination
| Name of the queue.
|===

'''

=== jakarta.jms.Topic

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Resource?type=jakarta.jms.Topic
----

Supports the following properties:

[cols="1,3",options="header"]
|===
| Property Name | Description

| destination
| Name of the topic.
|===

'''

=== jakarta.mail.Session

Declarable in `tomee.xml` via

Declarable in properties via:

----
Foo = new://Resource?type=jakarta.mail.Session
----

No properties.
