2.19.2 create-jms-resource
Creates a JMS resource.
Synopsis
asadmin [asadmin-options] create-jms-resource [--help] --restype type [--target target] [--enabled={true|false}] [--property name=value[:name=value]...] [--force={false|true}] jndi_name
Storage location
Application Server installation directory/javaee/glassfish/bin
Function
The create-jms-resource subcommand creates a Java Message Service (JMS) connection factory resource or a JMS destination resource.
This subcommand is supported in remote mode only.
To specify the addresslist property (in the format host:mqport,host2:mqport,host3:mqport) for the asadmin create-jms-resource command, escape the : character using the characters \\.
For example, host1\\:mqport,host2\\:mqport,host3\\:mpqport.
Precondition
DAS has to be in a running state.
Arguments
- --help | -?
-
Displays the help text for the subcommand.
- --restype type
-
Specifies the type of JMS resource.
Type: String
The following values can be specified:
-
javax.jms.Topic
-
javax.jms.Queue
-
javax.jms.ConnectionFactory
-
javax.jms.TopicConnectionFactory
-
javax.jms.QueueConnectionFactory
Default value: N/A
-
- --target target
-
Creates a JMS resource only for the specified target.
The resource is always created for the domain as a whole but the resource-ref element for the resource is only created for the specified --target. This means that although the resource is defined at the domain level, it is only active at the specified --target.
Type: String
The following values can be specified:
-
server
Creates a JMS resource for the default server instance. This is the default value.
-
domain
Creates a JMS resource for the domain.
-
cluster_name
Creates a JMS resource for every server instance in the specified cluster.
-
instance_name
Creates a JMS resource for the specified server instance.
Default value: server
-
- --enabled={true|false}
-
Specifies whether the resource is enabled at runtime or not.
Type: Boolean
The following values can be specified:
-
true
-
false
Default value: true
-
- --property name=value[:name=value]...
-
Specifies the optional attribute name/value pairs for configuring the JMS resource. The specification format is name=value. Use a colon (:) to separate property names. If you specify the same property name more than once, the property value specified last is valid.
Type: String
The following values can be specified:
-
ClientId=value
A client ID for a connection factory that will be used by a durable subscriber.
Type: String
Default value: N/A
Range Value: ID of the JMS resource
-
AddressList=value
A comma-separated list of message queue addresses that specify the host names (and, optionally, port numbers) of a message broker instance, or instances with which the application will communicate. For example, the value could be earth or earth:7677. Specify the port number if the message broker is running on a port other than the default (7676). composed from the JMS hosts defined in the server's JMS service configuration. The default value is localhost and the default port number is 7676. The client will attempt a connection to a broker on port 7676 of the local host.
Type: String
Default value: N/A
Range Value: Comma separated Host names and optional port numbers
-
UserName=value
The user name for the connection factory. The default value is guest.
Type: String
Default value: guest
Range Value: String (User name)
-
Password=value
The password for the connection factory. The default value is guest.
Type: String
Default value: guest
Range Value: String (User name)
-
ReconnectEnabled=value
A value of true indicates that the client runtime attempts to reconnect to a message server (or the list of addresses in the AddressList) when a connection is lost. The default value is false.
Type: Boolean
Default value: false
Range Value: true/false
-
ReconnectAttempts=value
The number of attempts to connect (or reconnect) for each address in the AddressList before the client runtime tries the next address in the list. A value of -1 indicates that the number of reconnect attempts is unlimited (the client runtime attempts to connect to the first address until it succeeds). The default value is 6.
Type: Integer
Default value: 6
Range Value: -1 to 2147483647
-
ReconnectInterval=value
The interval in milliseconds between reconnect attempts. This applies to attempts on each address in the AddressList and for successive addresses in the list. If the interval is too short, the broker does not have time to recover. If it is too long, the reconnect might represent an unacceptable delay. The default value is 30000 milliseconds.
Type: Long
Default value: 30000 (milli seconds)
Range Value: 1 to 9223372036854775807L
-
AddressListIterations=value
The number of times the client runtime iterates through the AddressList in an effort to establish (or re-establish) a connection). A value of -1 indicates that the number of attempts is unlimited. The default value is -1. Additionally, you can specify connector-connection-pool attributes as connector resource properties.
Type: Integer
Default value: -1
Range Value: -1 to 2147483647
You can specify the following properties for a destination resource:
-
Name=value
The name of the physical destination to which the resource will refer. The physical destination is created automatically when you run an application that uses the destination resource. You can also create a physical destination with the create-jmsdest subcommand. If you do not specify this property, the JMS service creates a physical destination with the same name as the destination resource (replacing any forward slash in the JNDI name with an underscore).
Type: String
Default value: JNDI name of the destination resource with _ replacing /.
Range Value: String (Name of the Physical destination)
-
Description=value
A description of the physical destination.
Type: String
Default value: N/A
Range Value: String (Description of the physical destination).
Default value: N/A
Specify the following properties for a connection factory resource:
-
- --force={false|true}
-
Specifies whether the subcommand overwrites the existing JMS resource of the same name.
Type: Boolean
The following values can be specified:
-
true
-
false
Default value: false
-
- jndi_name
-
Specifies the JNDI name of the JMS resource to be created.
Type: String
The following values can be specified:
-
JNDI name
Default value: N/A
-
Examples
The following example creates a connection factory resource of the type javax.jms.ConnectionFactory whose JNDI name is jms/DurableConnectionFactory on the server instance instance1. The ClientId property sets a client ID on the connection factory so that it can be used for durable subscriptions. The JNDI name for a JMS resource customarily includes the jms/ naming subcontext.
asadmin create-jms-resource --restype javax.jms.ConnectionFactory --target instance1 --property ClientId=MyID jms/DurableConnectionFactory
Exit Status
Exit Status |
Explanation |
---|---|
0 |
command executed successfully. |
1 |
error in executing the command. |