Vinay Vishal | 7c4c4fc | 2019-01-28 12:01:04 +0530 | [diff] [blame] | 1 | type=page |
| 2 | status=published |
| 3 | title=create-jms-resource |
| 4 | next=create-jndi-resource.html |
| 5 | prev=create-jms-host.html |
| 6 | ~~~~~~ |
| 7 | create-jms-resource |
| 8 | =================== |
| 9 | |
| 10 | [[create-jms-resource-1]][[GSRFM00040]][[create-jms-resource]] |
| 11 | |
| 12 | create-jms-resource |
| 13 | ------------------- |
| 14 | |
| 15 | creates a JMS resource |
| 16 | |
| 17 | [[sthref352]] |
| 18 | |
| 19 | Synopsis |
| 20 | |
| 21 | [source,oac_no_warn] |
| 22 | ---- |
| 23 | asadmin [asadmin-options] create-jms-resource [--help] |
| 24 | --restype type |
| 25 | [--target target] |
| 26 | [--enabled={true|false}] |
| 27 | [--description text] |
| 28 | [--property (name=value)[:name=value]*] |
| 29 | [--force={false|true}] |
| 30 | jndi_name |
| 31 | ---- |
| 32 | |
| 33 | [[sthref353]] |
| 34 | |
| 35 | Description |
| 36 | |
| 37 | The `create-jms-resource` subcommand creates a Java Message Service |
| 38 | (JMS) connection factory resource or a JMS destination resource. |
| 39 | |
| 40 | This subcommand is supported in remote mode only. Remote `asadmin` |
| 41 | subcommands require a running domain administration server (DAS). |
| 42 | |
| 43 | [[sthref354]] |
| 44 | |
| 45 | Options |
| 46 | |
| 47 | asadmin-options:: |
| 48 | Options for the `asadmin` utility. For information about these |
| 49 | options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page. |
| 50 | `--help`:: |
| 51 | `-?`:: |
| 52 | Displays the help text for the subcommand. |
| 53 | `--restype`:: |
Gaurav Gupta | 3655507 | 2020-03-26 14:10:23 +0530 | [diff] [blame] | 54 | The JMS resource type, which can be `jakarta.jms.Topic`, |
| 55 | `jakarta.jms.Queue`, `jakarta.jms.ConnectionFactory`, |
| 56 | `jakarta.jms.TopicConnectionFactory`, or |
| 57 | `jakarta.jms.QueueConnectionFactory`. |
Vinay Vishal | 7c4c4fc | 2019-01-28 12:01:04 +0530 | [diff] [blame] | 58 | `--target`:: |
| 59 | Creates the JMS resource only for the specified target. Valid values |
| 60 | are as follows: + |
| 61 | |
| 62 | [width="100%",cols="100%",] |
| 63 | |======================================================================= |
| 64 | a| |
| 65 | Note: |
| 66 | |
| 67 | The resource is always created for the domain as a whole, but the |
| 68 | `<resource-ref>` element for the resource is only created for the |
| 69 | specified `--target`. This means that although the resource is defined |
| 70 | at the domain level, it is only active at the specified `--target`. |
| 71 | |
| 72 | |======================================================================= |
| 73 | |
| 74 | `server`;; |
| 75 | Creates the JMS resource for the default server instance. This is |
| 76 | the default value. |
| 77 | `domain`;; |
| 78 | Creates the JMS resource for the domain. |
| 79 | cluster-name;; |
| 80 | Creates the JMS resource for every server instance in the specified |
| 81 | cluster. |
| 82 | instance-name;; |
| 83 | Creates the JMS resource for the specified server instance. |
| 84 | `--enabled`:: |
| 85 | If set to true (the default), the resource is enabled at runtime. |
| 86 | `--description`:: |
| 87 | Text providing details about the JMS resource. |
| 88 | `--property`:: |
| 89 | Optional attribute name/value pairs for configuring the JMS resource. + |
| 90 | You can specify the following properties for a connection factory |
| 91 | resource: + |
| 92 | `ClientId`;; |
| 93 | A client ID for a connection factory that will be used by a durable |
| 94 | subscriber. |
| 95 | `AddressList`;; |
| 96 | A comma-separated list of message queue addresses that specify the |
| 97 | host names (and, optionally, port numbers) of a message broker |
| 98 | instance or instances with which your application will communicate. |
| 99 | For example, the value could be `earth` or `earth:7677`. Specify the |
| 100 | port number if the message broker is running on a port other than |
| 101 | the default (7676). The default value is an address list composed |
| 102 | from the JMS hosts defined in the server's JMS service |
| 103 | configuration. The default value is `localhost` and the default port |
| 104 | number is 7676. The client will attempt a connection to a broker on |
| 105 | port 7676 of the local host. |
| 106 | `UserName`;; |
| 107 | The user name for the connection factory. The default value is |
| 108 | `guest`. |
| 109 | `Password`;; |
| 110 | The password for the connection factory. The default value is |
| 111 | `guest`. |
| 112 | `ReconnectEnabled`;; |
| 113 | A value of `true` indicates that the client runtime attempts to |
| 114 | reconnect to a message server (or the list of addresses in the |
| 115 | `AddressList`) when a connection is lost. The default value is |
| 116 | `false`. |
| 117 | `ReconnectAttempts`;; |
| 118 | The number of attempts to connect (or reconnect) for each address in |
| 119 | the `AddressList` before the client runtime tries the next address |
| 120 | in the list. A value of -1 indicates that the number of reconnect |
| 121 | attempts is unlimited (the client runtime attempts to connect to the |
| 122 | first address until it succeeds). The default value is 6. |
| 123 | `ReconnectInterval`;; |
| 124 | The interval in milliseconds between reconnect attempts. This |
| 125 | applies to attempts on each address in the `AddressList` and for |
| 126 | successive addresses in the list. If the interval is too short, the |
| 127 | broker does not have time to recover. If it is too long, the |
| 128 | reconnect might represent an unacceptable delay. The default value |
| 129 | is 30,000 milliseconds. |
| 130 | `AddressListBehavior`;; |
| 131 | Specifies whether connection attempts are in the order of addresses |
| 132 | in the `AddressList` (`PRIORITY`) or in a random order (`RANDOM`). |
| 133 | `PRIORITY` means that the reconnect will always try to connect to |
| 134 | the first server address in the `AddressList` and will use another |
| 135 | one only if the first broker is not available. If you have many |
| 136 | clients attempting a connection using the same connection factory, |
| 137 | specify `RANDOM` to prevent them from all being connected to the |
| 138 | same address. The default value is the `AddressListBehavior` value |
| 139 | of the server's JMS service configuration. |
| 140 | `AddressListIterations`;; |
| 141 | The number of times the client runtime iterates through the |
| 142 | `AddressList` in an effort to establish (or re-establish) a |
| 143 | connection). A value of -1 indicates that the number of attempts is |
| 144 | unlimited. The default value is -1. + |
| 145 | Additionally, you can specify `connector-connection-pool` attributes |
| 146 | as connector resource properties. For a list of these attributes, see |
| 147 | "link:../application-deployment-guide/dd-elements.html#GSDPG00124[connector-connection-pool]" in GlassFish Server Open |
| 148 | Source Edition Application Deployment Guide. + |
| 149 | You can specify the following properties for a destination resource: + |
| 150 | `Name`;; |
| 151 | The name of the physical destination to which the resource will |
| 152 | refer. The physical destination is created automatically when you |
| 153 | run an application that uses the destination resource. You can also |
| 154 | create a physical destination with the `create-jmsdest` subcommand. |
| 155 | If you do not specify this property, the JMS service creates a |
| 156 | physical destination with the same name as the destination resource |
| 157 | (replacing any forward slash in the JNDI name with an underscore). |
| 158 | `Description`;; |
| 159 | A description of the physical destination. |
| 160 | `--force`:: |
| 161 | Specifies whether the subcommand overwrites the existing JMS resource |
| 162 | of the same name. The default value is `false`. |
| 163 | |
| 164 | [[sthref355]] |
| 165 | |
| 166 | Operands |
| 167 | |
| 168 | jndi_name:: |
| 169 | The JNDI name of the JMS resource to be created. |
| 170 | |
| 171 | [[sthref356]] |
| 172 | |
| 173 | Examples |
| 174 | |
| 175 | [[GSRFM497]][[sthref357]] |
| 176 | |
| 177 | Example 1 Creating a JMS connection factory resource for durable |
| 178 | subscriptions |
| 179 | |
| 180 | The following subcommand creates a connection factory resource of type |
Gaurav Gupta | 3655507 | 2020-03-26 14:10:23 +0530 | [diff] [blame] | 181 | `jakarta.jms.ConnectionFactory` whose JNDI name is |
Vinay Vishal | 7c4c4fc | 2019-01-28 12:01:04 +0530 | [diff] [blame] | 182 | `jms/DurableConnectionFactory`. The `ClientId` property sets a client ID |
| 183 | on the connection factory so that it can be used for durable |
| 184 | subscriptions. The JNDI name for a JMS resource customarily includes the |
| 185 | `jms/` naming subcontext. |
| 186 | |
| 187 | [source,oac_no_warn] |
| 188 | ---- |
Gaurav Gupta | 3655507 | 2020-03-26 14:10:23 +0530 | [diff] [blame] | 189 | asadmin> create-jms-resource --restype jakarta.jms.ConnectionFactory |
Vinay Vishal | 7c4c4fc | 2019-01-28 12:01:04 +0530 | [diff] [blame] | 190 | --description "connection factory for durable subscriptions" |
| 191 | --property ClientId=MyID jms/DurableConnectionFactory |
| 192 | Connector resource jms/DurableConnectionFactory created. |
| 193 | Command create-jms-resource executed successfully. |
| 194 | ---- |
| 195 | |
| 196 | [[GSRFM498]][[sthref358]] |
| 197 | |
| 198 | Example 2 Creating a JMS destination resource |
| 199 | |
| 200 | The following subcommand creates a destination resource whose JNDI name |
| 201 | is `jms/MyQueue`. The `Name` property specifies the physical destination |
| 202 | to which the resource refers. |
| 203 | |
| 204 | [source,oac_no_warn] |
| 205 | ---- |
Gaurav Gupta | 3655507 | 2020-03-26 14:10:23 +0530 | [diff] [blame] | 206 | asadmin> create-jms-resource --restype jakarta.jms.Queue |
Vinay Vishal | 7c4c4fc | 2019-01-28 12:01:04 +0530 | [diff] [blame] | 207 | --property Name=PhysicalQueue jms/MyQueue |
| 208 | Administered object jms/MyQueue created. |
| 209 | Command create-jms-resource executed successfully. |
| 210 | ---- |
| 211 | |
| 212 | [[sthref359]] |
| 213 | |
| 214 | Exit Status |
| 215 | |
| 216 | 0:: |
| 217 | subcommand executed successfully |
| 218 | 1:: |
| 219 | error in executing the subcommand |
| 220 | |
| 221 | [[sthref360]] |
| 222 | |
| 223 | See Also |
| 224 | |
| 225 | link:asadmin.html#asadmin-1m[`asadmin`(1M)] |
| 226 | |
| 227 | link:delete-jms-resource.html#delete-jms-resource-1[`delete-jms-resource`(1)], |
| 228 | link:list-jms-resources.html#list-jms-resources-1[`list-jms-resources`(1)] |
| 229 | |
| 230 | |