com.neeve.sma
Class MessageBusDescriptor

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.sma.SmaObject
          extended by com.neeve.sma.MessageBusDescriptor

public final class MessageBusDescriptor
extends SmaObject

A message bus descriptor.

This class contains information used to describe a message bus. It is intended for use by a user when establishing bus bindings. It also contains methods to persist and load descriptors to/from X Platform configuration repositories.

Threading:
This class is safe for concurrent access by multiple threads.

Field Summary
static short CATCH_ALL_CHANNEL_ID
          The channel id that is used to for a binding's single catch all channel.
static String CATCH_ALL_CHANNEL_NAME_DEFAULT
          The default name of the catch all channel to use when "auto_add_catchall_channel=true" is set to true on the binding.
static String PROPNAME_ADDRESS
          Name of property used to specify the bus's address.
static String PROPNAME_AUTO_ADD_CATCHALL_CHANNEL
          Name of the bus descriptor property controlling whether a 'catchall' channel should be auto created If this property is specified in the message bus descriptor, then a catchall channel with name 32767 and id 32767 will automatically be added to the bus descriptor when the binding is created provided another catchall channel is not already present in the bus descriptor.
static boolean PROPNAME_AUTO_ADD_CATCHALL_CHANNEL_DEFAULT
          Default value for PROPNAME_AUTO_ADD_CATCHALL_CHANNEL.
static String PROPNAME_PROVIDER_NAME
          Name of property used to specify provider name.
static String PROPNAME_SET_BUS_AND_CHANNEL_ON_RECEIPT
          Name of the bus descriptor property controlling whether the bus and channel name are set on received messages.
static String PROPNAME_SET_FLOW_ON_RECEIPT
          Name of the bus descriptor property controlling whether the flow is set on received messages.
static String PROPNAME_SET_KEY_ON_RECEIPT
          Name of the bus descriptor property controlling whether the message key is set on received messages.
static String PROPNAME_SET_SNO_ON_RECEIPT
          Name of the bus descriptor property controlling whether the sequence number is set on received messages.
static String PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME
          Name of the bus descriptor property controlling whether topic names start with the channel name for the bus.
static boolean PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME_DEFAULT
          Default value for PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME.
 
Method Summary
 MessageBusDescriptor addChannel(MessageChannelDescriptor channelDescriptor)
          Add a channel descriptor.
static MessageBusDescriptor create(String name)
          Create a default message bus descriptor.
 void delete()
          Delete a message bus descriptor from the default configuration repository.
 void delete(IConfigRepository repo)
          Delete a bus descriptor from the configuration repository.
static boolean exists(IConfigRepository repo, String busName)
          Checks if a message bus is configured in a configuration repository.
static boolean exists(String busName)
          Checks if a message bus is configured in the default configuration repository.
 MessageChannelDescriptor getChannel(String channelName)
          Get a channel descriptor.
 int getChannelCount()
          Get the number of channels in the bus.
 Set<MessageChannelDescriptor> getChannels()
          Get the set of channel descriptors.
 String getName()
          Get the name of the bus that this descriptor describes
 Properties getProviderConfig()
          Get the provider configuration configuration.
 UtlAddressDescriptor getProviderConfigAsAddressDescriptor()
          Get the provider configuration as an address descriptor string
static MessageBusDescriptor load(IConfigRepository repo, String name, String userName)
          Create a message bus descriptor from a configuration respository.
static MessageBusDescriptor load(String name)
          Create a bus descriptor from the default configuration respository.
static MessageBusDescriptor load(String name, String userName)
          Create a bus descriptor from the default configuration respository.
static Set<MessageBusDescriptor> loadAll()
          Create bus descriptors for all buses configured in the default configuration repository.
static Set<MessageBusDescriptor> loadAll(IConfigRepository repo, String userName)
          Create bus descriptors for all buses in a configuration repository.
static Set<MessageBusDescriptor> loadAll(String userName)
          Create bus descriptors for all buses configured in the default configuration repository.
 void removeChannel(String channelName)
          Remove a channel descriptor.
 void save()
          Save a message bus descriptor to the default configuration repository.
 void save(IConfigRepository repo, String userName)
          Save a bus descriptor to a configuration repository.
 Properties save(Properties props)
          Save a bus descriptor to a property table.
 void save(String userName)
          Save a message bus descriptor to the default configuration repository.
 MessageBusDescriptor setProviderConfig(Properties props)
          Set the configuration for the provider specific portion of the bus binding that this descriptor describes.
 MessageBusDescriptor setProviderConfig(String descriptorStr)
          Set a provider configuration from a descriptor string
 MessageBusDescriptor setProviderConfigProperty(String propName, String propVal)
          Add a property to the provider configuration
 String toString()
          Returns a string representation of this object
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPNAME_PROVIDER_NAME

public static final String PROPNAME_PROVIDER_NAME
Name of property used to specify provider name.

See Also:
Constant Field Values

PROPNAME_ADDRESS

public static final String PROPNAME_ADDRESS
Name of property used to specify the bus's address.

See Also:
Constant Field Values

PROPNAME_SET_FLOW_ON_RECEIPT

public static final String PROPNAME_SET_FLOW_ON_RECEIPT
Name of the bus descriptor property controlling whether the flow is set on received messages.

Setting the flow on inbound messages incurs performance overhead. Ultra low latency applications should avoid enabling this property.

When not specified, defaults to the global value set via MessageBusBinding.PROP_SET_FLOW_ON_RECEIPT.

Parameter Name: "set_flow_on_receipt"

See Also:
Constant Field Values

PROPNAME_SET_SNO_ON_RECEIPT

public static final String PROPNAME_SET_SNO_ON_RECEIPT
Name of the bus descriptor property controlling whether the sequence number is set on received messages.

Setting the sequence number on inbound messages incurs performance overhead. Ultra low latency applications should avoid enabling this property.

When not specified, defaults to the global value set via MessageBusBinding.PROP_SET_SNO_ON_RECEIPT.

Parameter Name: "set_sno_on_receipt"

See Also:
Constant Field Values

PROPNAME_SET_BUS_AND_CHANNEL_ON_RECEIPT

public static final String PROPNAME_SET_BUS_AND_CHANNEL_ON_RECEIPT
Name of the bus descriptor property controlling whether the bus and channel name are set on received messages.

Setting the channel and bus name on inbound messages incurs performance overhead. Performance sensitive applications should avoid enabling this property.

When not specified, defaults to the global value set via MessageBusBinding.PROP_SET_BUS_AND_CHANNEL_ON_RECEIPT.

Parameter Name: "set_bus_and_channel_on_receipt"

See Also:
Constant Field Values

PROPNAME_SET_KEY_ON_RECEIPT

public static final String PROPNAME_SET_KEY_ON_RECEIPT
Name of the bus descriptor property controlling whether the message key is set on received messages.

Not all binding implementations transport the key on the wire, this property has no effect for binding that don't transport the key.

Setting the key on inbound message incurs a performance overhead. Performance sensitive applications should avoid enabling this property.

When not specified, defaults to the global value set via MessageBusBinding.PROP_SET_KEY_ON_RECEIPT.

Parameter Name: "set_key_on_receipt"

See Also:
Constant Field Values

PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME

public static final String PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME
Name of the bus descriptor property controlling whether topic names start with the channel name for the bus.

For bus bindings that support topic routing this property controls whether or not the resolved key is prefixed with the channel name.

Parameter Name: "topic_starts_with_channel"
Default Value: true

See Also:
Constant Field Values

PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME_DEFAULT

public static final boolean PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME_DEFAULT
Default value for PROPNAME_TOPIC_STARTS_WITH_CHANNEL_PROPNAME.

See Also:
Constant Field Values

PROPNAME_AUTO_ADD_CATCHALL_CHANNEL

public static final String PROPNAME_AUTO_ADD_CATCHALL_CHANNEL
Name of the bus descriptor property controlling whether a 'catchall' channel should be auto created

If this property is specified in the message bus descriptor, then a catchall channel with name 32767 and id 32767 will automatically be added to the bus descriptor when the binding is created provided another catchall channel is not already present in the bus descriptor.

Parameter Name: "auto_add_catchall_channel"
Default Value: false

See Also:
Constant Field Values

PROPNAME_AUTO_ADD_CATCHALL_CHANNEL_DEFAULT

public static final boolean PROPNAME_AUTO_ADD_CATCHALL_CHANNEL_DEFAULT
Default value for PROPNAME_AUTO_ADD_CATCHALL_CHANNEL.

See Also:
Constant Field Values

CATCH_ALL_CHANNEL_NAME_DEFAULT

public static final String CATCH_ALL_CHANNEL_NAME_DEFAULT
The default name of the catch all channel to use when "auto_add_catchall_channel=true" is set to true on the binding. channel with an id of 32767

See Also:
Constant Field Values

CATCH_ALL_CHANNEL_ID

public static final short CATCH_ALL_CHANNEL_ID
The channel id that is used to for a binding's single catch all channel.

When a MessageBusBinding is configured with a catch all channel, messages received without a channel or on an unknown or unjoined channel are dispatched on this channel.

A binding can be configured with the property "auto_add_catchall_channel=true" automatically add a catch all channel named "_CATCHALL_".

See Also:
Constant Field Values
Method Detail

getName

public final String getName()
Get the name of the bus that this descriptor describes


setProviderConfig

public final MessageBusDescriptor setProviderConfig(Properties props)
Set the configuration for the provider specific portion of the bus binding that this descriptor describes.

Parameters:
props - The properties table that describes the provider configuration. This parameter cannot be null.
Returns:
Returns this bus descriptor for invocation chaining.

This method sets the configuration for the provider specific portion of a bus binding using a property table.


setProviderConfigProperty

public final MessageBusDescriptor setProviderConfigProperty(String propName,
                                                            String propVal)
                                                     throws SmaException
Add a property to the provider configuration

Parameters:
propName - The name of the property
propVal - The value of the property
Returns:
Returns this bus descriptor for invocation chaining.
Throws:
SmaException

setProviderConfig

public final MessageBusDescriptor setProviderConfig(String descriptorStr)
                                             throws SmaException
Set a provider configuration from a descriptor string

Parameters:
descriptorStr - The provider configuration specified as an address descriptor string.
Returns:
Returns this bus descriptor for invocation chaining.
Throws:
SmaException

getProviderConfigAsAddressDescriptor

public final UtlAddressDescriptor getProviderConfigAsAddressDescriptor()
                                                                throws SmaException
Get the provider configuration as an address descriptor string

Throws:
SmaException - Thrown in case the PROPNAME_PROVIDER_NAME and/or the PROPNAME_ADDRESS properties are missing from the provider config.

getProviderConfig

public final Properties getProviderConfig()
Get the provider configuration configuration.


addChannel

public final MessageBusDescriptor addChannel(MessageChannelDescriptor channelDescriptor)
Add a channel descriptor.

Parameters:
channelDescriptor - The channel descriptor to add.
Returns:
Returns the bus descriptor for invocation chaining.

This method added a channel descriptor to the set of channel descriptors maintained by the bus descriptor. The added descriptor will replace a descriptor of the same channel name if present.


getChannel

public final MessageChannelDescriptor getChannel(String channelName)
Get a channel descriptor.

Parameters:
channelName - The name of the channel whose descriptor to get.
Returns:
Returns null in case no descriptor of the supplied name is present in the bus descriptor.

getChannels

public final Set<MessageChannelDescriptor> getChannels()
Get the set of channel descriptors.


getChannelCount

public final int getChannelCount()
Get the number of channels in the bus.


removeChannel

public final void removeChannel(String channelName)
Remove a channel descriptor.

Parameters:
channelName - The name of the channel whose descriptor to remove.

save

public final Properties save(Properties props)
Save a bus descriptor to a property table.

Parameters:
props - The property table.
Threading:
This method is notsafe for concurrent access by multiple threads.

save

public final void save(IConfigRepository repo,
                       String userName)
                throws SmaException
Save a bus descriptor to a configuration repository.

Parameters:
repo - The root directory of the configuration respository.
userName - The name of the user on whose behalf this descriptor should be saved. This can be null in case no user specific information is to be written
Throws:
SmaException - Thrown in case an error in encountered during the saving of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a bus descriptor to a configuration repository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered by this class.


save

public final void save(String userName)
                throws SmaException
Save a message bus descriptor to the default configuration repository.

Parameters:
userName - The name of the user on whose behalf this descriptor should be saved. This can be null in case no user specific information is to be written
Throws:
SmaException
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a message bus descriptor to the default configuration respository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered in this class.


save

public final void save()
                throws SmaException
Save a message bus descriptor to the default configuration repository.

Throws:
SmaException
Threading:
This method is notsafe for concurrent access by multiple threads.

This method invokes save((String)null)


delete

public final void delete(IConfigRepository repo)
                  throws SmaException
Delete a bus descriptor from the configuration repository.

Parameters:
repo - The configuration respository to delete the descriptor from.
Throws:
SmaException - Thrown in case an error in encountered during the deletion of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method deletes a bus descriptor from a configuration repository.


delete

public final void delete()
                  throws SmaException
Delete a message bus descriptor from the default configuration repository.

Throws:
SmaException - Thrown in case an error in encountered during the deletion of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method permanently deletes a message bus descriptor from the default configuration repository.


toString

public final String toString()
Returns a string representation of this object

Overrides:
toString in class Object

exists

public static boolean exists(IConfigRepository repo,
                             String busName)
Checks if a message bus is configured in a configuration repository.

Parameters:
repo - The configuration respository to check in.
busName - The name of the bus in which to check for.
Threading:
This method is safe for concurrent access by multiple threads.

exists

public static boolean exists(String busName)
Checks if a message bus is configured in the default configuration repository.

Parameters:
busName - The name of the bus in which to check for.
Threading:
This method is safe for concurrent access by multiple threads.

create

public static MessageBusDescriptor create(String name)
Create a default message bus descriptor.

Parameters:
name - The name of the bus whose descriptor is to be prepared.
Threading:
This method is safe for concurrent access by multiple threads.

load

public static MessageBusDescriptor load(IConfigRepository repo,
                                        String name,
                                        String userName)
                                 throws SmaException
Create a message bus descriptor from a configuration respository.

Parameters:
repo - The configuration repository from where to load the descriptor.
name - The name of the bus whose descriptor is to be prepared.
userName - The user for whom to create the descriptor. This can be null in case user specific information is not to be loaded.
Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

load

public static MessageBusDescriptor load(String name,
                                        String userName)
                                 throws SmaException
Create a bus descriptor from the default configuration respository.

Parameters:
name - The name of the bus whose descriptor is to be prepared.
userName - The user for whom to create the descriptor. A null value will result in no user specific information is to be loaded.
Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

load

public static MessageBusDescriptor load(String name)
                                 throws SmaException
Create a bus descriptor from the default configuration respository.

Parameters:
name - The name of the bus whose descriptor is to be prepared.
Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

This method invokes load(name, null)


loadAll

public static Set<MessageBusDescriptor> loadAll(IConfigRepository repo,
                                                String userName)
                                         throws SmaException
Create bus descriptors for all buses in a configuration repository.

Parameters:
repo - The configuration respository from where to create the buses.
userName - The user for whom to create the descriptors. This can be null in case no user specific information is to be loaded.
Returns:
Returns the set of bus descriptors.

This method creates and initializes bus descriptors for each of the buses configured in a configuration repository.

Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

loadAll

public static Set<MessageBusDescriptor> loadAll(String userName)
                                         throws SmaException
Create bus descriptors for all buses configured in the default configuration repository.

Parameters:
userName - The user for whom to return the descriptors. This can be null in case no user specific information is to be loaded.
Returns:
Returns the set of bus descriptors.

This method creates and initializes buses descriptors for all the buses configured in the default configuration repository.

Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

loadAll

public static Set<MessageBusDescriptor> loadAll()
                                         throws SmaException
Create bus descriptors for all buses configured in the default configuration repository.

Returns:
Returns the set of bus descriptors.

This method invokes loadAll(null)

Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.