Created On: 26 January 2011
Problem:
- Product Name: VisiBroker
- Product Version: All
- Product Componet; VisiNotify
- Platform/OS Version: all
- JDK/Compiler Version: all
Is there a way to set the maximum number of consumers and the maximum number of suppliers?
Resolution:
The MaxConsumers and MaxSuppliers admin properties can be set to limit the maximum number of consumers and suppliers.
The admin properties are defined by the org.omg.CosNotification.AdminPropertiesAdmin interface. Below is the list of valid properties and their default values:
The admin properties are defined by the org.omg.CosNotification.AdminPropertiesAdmin interface. Below is the list of valid properties and their default values:
MaxQueueLength=4160
MaxConsumers=256
MaxSuppliers=256
RejectNewEvents=false
VBPersistentStorageSize=1024
MaxConsumers=256
MaxSuppliers=256
RejectNewEvents=false
VBPersistentStorageSize=1024
The above properties can be changed programmatically.
org.omg.CosNotifyChannelAdmin.EventChannel inherits org.omg.CosNotification.AdminPropertiesAdmin and can therefore access these properties through set_admin() method. Inversely, the get_admin() method retrieves these properties.
To set these properties, refer to the explanation below:
To set these properties, refer to the explanation below:
- Define the Property's.
Property maxConsumers = new Property( "MaxConsumers", maxConsumersValue );
Property maxSuppliers = new Property( "MaxSuppliers", maxSuppliersValue );
// and so on...
// (The "maxConsumersValue" and "maxSuppliersValue" should be of type org.omg.CORBA.Any) - Set Property Array
Property[] adminProps = new Property[] { maxConsumers,
maxSuppliers,
// and so on...
}; - set it through channel's Admin
channel.set_admin( adminProps );
Property maxConsumers = new Property( "MaxConsumers", maxConsumersValue );
Property[] adminProps = new Property[] { maxConsumers };
channel.set_admin( adminProps );
Property[] adminProps = new Property[] { maxConsumers };
channel.set_admin( adminProps );
Note 2: To prevent typographical errors, instead of spelling out "MaxConsumers", one may import and use org.omg.CosNotification.MaxConsumers. Its value attribute contains the string MaxConsumers. This also applies for "MaxSuppliers", "MaxQueueLength", "RejectNewEvents", "VBPersistentStorageSize".
Property maxConsumers = new Property( org.omg.CosNotification.MaxConsumers.value, maxConsumersValue );
Property[] adminProps = new Property[] { maxConsumers };
channel.set_admin( adminProps );
Property[] adminProps = new Property[] { maxConsumers };
channel.set_admin( adminProps );
Incident #2490000
Old KB# 33087
#Security
#VisiNotify
#VisiBroker