Creating and Configuring JMS Virtual
Providers
Java Message Service (JMS) is a service that runs on a server or on a cluster of servers. It is one of the services that are heterogeneous in the cluster, that is, the instances of the service running on different cluster nodes are not identical. Some cluster nodes host a subset of JMS resources (connection factories and destinations), while others may not host any JMS resources (JMS backup nodes). The minimum set of JMS resources that can be hosted by a cluster node is called a JMS Virtual Provider. In other words, a JMS Virtual Provider is a named set of JMS resources that can be atomically hosted (that is, all of the resources or none of them) by a cluster node. Since JMS Virtual Providers are distributed in the cluster, they are a mechanism for load distribution (balancing).
You can create as many Virtual Providers as you need. You can also use the default Virtual Provider which is present on every installation.

You cannot remove the default Virtual Provider. This guarantees that you have at least one Virtual Provider on the system so that the JMS can work properly.
There are two configurable options for Virtual Provider distribution. The default option allows a cluster node to host more than one Virtual Providers while the second option limits the number of Virtual Providers hosted by a node to one. The default option guarantees that all Virtual Providers configured on a system will be hosted (started), regardless of the number of nodes in the cluster.
In case a cluster node hosting some Virtual Providers is stopped or crashes, there is a failover mechanism that ensures that the respective Virtual Providers will be automatically hosted by one or more of the other nodes in the cluster.
JMS Virtual Providers can be created either via deployment or administratively, using the SAP NetWeaver Administrator.
You can create a new Virtual Provider using the jms-resources.xml deployment descriptor. Under <sap-local-factory-type> and <sap-local-destination-type> there is a <virtual-provider> tag. If you do not specify a name in this tag, you do not create any Virtual Providers and you use the default one.
If you specify a name in the <virtual-provider> tag, for example testVP, this automatically creates the Virtual Provider testVP.
<connection-factory> <name>jms/TopicConnectionFactory</name> <sap-local-factory-type> <type>javax.jms.TopicConnectionFactory</type> <virtual-provider>testVP</virtual-provider> </sap-local-factory-type> </connection-factory> <destination> <name>jms/MyTopic</name> <type>javax.jms.Topic</type> <sap-local-destination-type> <virtual-provider>testVP</virtual-provider> </sap-local-destination-type> </destination> |

In the jms-resources.xml of one application, the name of the Virtual Provider has to be the same for all resources in this application.
If you remove an application that has created a Virtual Provider and there are no other applications that refer to it, you remove not only the application but also its Virtual Provider.
To create a new Virtual Provider you have to:
...
1. Open the SAP NetWeaver Administrator and choose Configuration Management → Infrastructure → JMS Server Configuration.
2. From the Show dropdown menu, choose JMS Virtual Providers.
3. To create a new Virtual Provider, choose the Create button.
4. Enter the name of the new Virtual Provider in the Name field and choose Save.
You have created a new Virtual Provider.
To delete a Virtual Provider, select it and choose the Remove button.

You have to be careful when deleting a Virtual Provider because if its resources are still used by some applications, they will stop working.
To configure the distribution option for the JMS Virtual Providers you have to:
...
1. Open the Config Tool and expand the nodes cluster-data → template-CE_JAVA_EE_development_full → services → jms_provider.
2. Set the value of hostMultipleVPs key to true if you want to allow hosting of several Virtual Providers on a single cluster node. If the value is set to false, each cluster node will host zero or one Virtual Provider. In the second case if the number of Virtual Providers is larger than the number nodes in the cluster, some of the Virtual Providers will not be hosted (started) and thus some of the applications may stop working.