p2p::RoutingRules¶
-
class
kanzi::connect::p2p
::
RoutingRules
¶ Entity that manages messge routing rules for a single service instance.
Public Functions
-
RoutingRules
(const string &xml, const string interfacename = "", bool verboseLogging = false)¶ Constructor.
- Parameters
xml – The XML document describing the routing.
interfacename – The name of the interface.
-
~RoutingRules
()¶ Destructor.
Inserts an endpoint to list of endpoints.
- Parameters
ep – the endpoint to insert.
-
bool
addRoute
(const string &xml)¶ Add new route.
- Parameters
xml – Contains the route definition in xml
- Returns
True if route was added successfully
-
EndpointIterator
beginEndpoints
()¶ Get iterator to beginning of endpoints.
- Returns
iterator
-
void
clearEndpoints
()¶ Clears all existing endpoints.
-
vector<shared_ptr<RoutingRules::Endpoint>>
collectRequiredEndpoints
(const string &reliableBearer, const string &unreliableBearer)¶ Used on service side where routing rules are analyzed and then a list of required endpoints is collected.
- Parameters
reliableBearer – name of the reliable bearer
unreliableBearer – name of the unreliable bearer
- Returns
vector of endpoints required.
-
EndpointIterator
endEndpoints
()¶ Get iterator to end of endpoints.
- Returns
iterator
-
int
getMetaDataInt
(const string &name, int def = -1)¶ return integer from metadata
- Parameters
name – the name of the meta element to retrieve
def – default value to return if not found
- Returns
retrieved value.
-
string
getMetaDataString
(const string &name)¶ return stringfrom metadata
- Parameters
name – the name of the meta element to retrieve
- Returns
retrieved value. empty string if not found.
-
inline bool
isEmpty
() const¶ Is the object empty i.e.
no routing information included
- Returns
true if empty.
-
bool
removeRouteForRuntimeData
()¶ Remove route for runtime data.
- Returns
True if removed successfully, false if not found
-
bool
removeRouteForSubject
(const string &subjectName)¶ Remove route for given subject.
- Parameters
subjectName – Name of the method or event identifying the route to remove
- Returns
True if removed successfully, false if not found
-
bool
requireDirectLink
() const¶ Does any of the referred routing rules require direct link(s) or is this service server only.
- Returns
true if direct link might be required.
-
RouteSharedPtr
routeForEvent
(const string &eventName)¶ Returns a preferred route for a specific event.
- Parameters
eventName – The name of the event to ask.
- Returns
The route to apply.
-
RouteSharedPtr
routeForEventMessage
(const string &eventMessageName)¶ Returns a preferred route for a specific event.
- Parameters
eventMessageName – The name of the event message to ask.
- Returns
The route to apply.
-
RouteSharedPtr
routeForMethod
(const string &methodName)¶ Returns a preferred route for a specific method.
- Parameters
methodName – The name of the method to ask.
- Returns
The route to apply.
-
RouteSharedPtr
routeForMethodMessage
(const string &methodMessageName)¶ Returns a preferred route for a specific method.
- Parameters
methodMessageName – The name of the method message to ask.
- Returns
The route to apply.
-
RouteSharedPtr
routeForRuntimeData
()¶ Returns a preferred route for a runtime data.
- Returns
The route to apply.
-
string
toXml
(RouteAttributes *metadata = nullptr)¶ Converts the routing information to XML.
- Parameters
metadata – Optional meta information put into the XML document. Name-value pairs.
- Returns
the xml representation of the routing information.
-
class
Endpoint
¶ Endpoint for communication.
Public Types
-
typedef RouteAttributes::iterator
AttributeIterator
¶
Public Functions
-
inline
Endpoint
()¶ Constructor.
-
inline AttributeIterator
beginAttributes
()¶ Return beginning of attributes.
- Returns
iterator to beginning of attributes
-
inline AttributeIterator
endAttributes
()¶ Return end of attributes iterator.
- Returns
iterator to end of attributes
-
inline bool
equals
(const Endpoint &o) const¶ Compares this and passed object by all information.
- Parameters
o – the object to compare to
- Returns
true if equals
-
inline bool
equalsByAddress
(const Endpoint &o) const¶ Compares this and passed object by address information.
- Parameters
o – object to compare to
- Returns
true if equals by address
-
inline bool
equalsByAddressAndReliability
(const Endpoint &o) const¶ Compares this and passed object by address and relialibility information.
- Parameters
o – object to compare to
- Returns
true if equals by address
-
inline const RouteAttributes &
getAttributes
() const¶ Retrieve attribute references.
- Returns
reference to attribute container
-
inline const string &
getBearer
() const¶ Getter for bearer information.
- Returns
the bearer information
-
inline const string &
getConnectIdentifier
() const¶ Retrieve previously set connect identifier.
- Returns
connectIdentifier value.
-
inline const string &
getIdentifier
() const¶ Retrieves then endpoint identifier.
- Returns
endpoint identifier
-
inline const string &
getIP
() const¶ Getter for IP Address.
- Returns
IP Address
-
inline MessageDispatcher *
getMessageDispatcher
() const¶ Getter for message dispatcher.
- Returns
message dispatcher
-
inline const string &
getPort
() const¶ Getter for port information.
- Returns
port number
-
inline bool
getReliable
() const¶ Getter for reliable.
- Returns
true if reliable.
-
inline bool
getUnreliable
() const¶ Getter for unreliable flag.
- Returns
true if unreliable
-
inline void
setAttributes
(const RouteAttributes &attributes)¶ Stores the attributes specific for the route.
- Parameters
attributes – the attributes
-
inline void
setBearer
(const string &bearer)¶ Setter for bearer information.
- Parameters
bearer – the bearer to set
-
inline void
setConnectIdentifier
(const string &connectIdentifier)¶ Sets the connection identifier.
- Parameters
connectIdentifier – some identifier using which the client can reach this service with selected bearer.
-
inline void
setIdentifier
(const string &identifier)¶ sets the endpoint identifier
- Parameters
identifier – the name of the endpoint
-
inline void
setIP
(const string &ip)¶ Setter for IP Address.
For server side IP defines the interface to bind into.
- Parameters
ip – the ip address
-
inline void
setMessageDispatcher
(MessageDispatcher *dsp)¶ Attach message dispatcher.
- Parameters
dsp – the dispatcher to attach
-
inline void
setPort
(const string &port)¶ Setter for port information.
- Parameters
port – the port information to set in string format
-
inline void
setPort
(int port)¶ Setter for port information.
- Parameters
port – the port information
-
inline void
setReliable
(bool reliable)¶ Setter for reliable flag.
- Parameters
reliable – state of the endpoint
-
inline void
setUnreliable
(bool unreliable = true)¶ Setter for unreliable flag.
- Parameters
unreliable – unreliability state of the endpoint
-
string
toString
() const¶ Get stringular representation of the endpoint.
- Returns
stringified representation of the object
-
inline bool
valid
() const¶ Checks is object valid.
- Returns
true if valid.
-
typedef RouteAttributes::iterator
-
class
Route
¶ Defines a route for a single communications element.
Public Types
-
typedef RouteAttributes::iterator
AttributeIterator
¶
Public Functions
-
inline AttributeIterator
beginAttributes
()¶ Return beginning of attributes.
- Returns
iterator to beginning of attributes
-
inline bool
directRouteEnabled
() const¶ Is direct route enabled.
- Returns
true if direct route enabled
-
inline bool
directRoutePossible
() const¶ Determines whether route is direct and it is possible.
- Returns
true if direct route is possible
-
inline AttributeIterator
endAttributes
()¶ Return end of attributes iterator.
- Returns
iterator to end of attributes
-
inline bool
equals
(const RoutingRules::Route &other) const¶ Compares routes.
- Parameters
other – the other route to compare this object to
- Returns
true if routes equal.
-
inline const RouteAttributes &
getAttributes
() const¶ Retrieve attribute references.
- Returns
reference to attribute container
-
inline const string &
getBearer
() const¶ Retrieve bearer information.
- Returns
bearer
-
inline const string &
getLink
() const¶ Getter for link information.
- Returns
link information
-
inline bool
getReliable
() const¶
-
inline const string &
getSubject
() const¶ Getter for subject information.
- Returns
subject information
-
inline bool
serverRouteEnabled
() const¶ Routing via server enabled.
- Returns
true if route via server enabled.
-
inline void
setAttributes
(const RouteAttributes &attributes)¶ Stores the attributes specific for the route.
- Parameters
attributes – the attributes
-
inline void
setBearer
(string bearer)¶ Stores bearer information.
- Parameters
bearer – the bearer information
Setter for endpoint.
- Parameters
ep – endpoint to store
-
inline void
setLink
(const string &link)¶ Setter for link.
- Parameters
link – link informaiton
-
inline void
setReliable
(bool reliable)¶
-
inline void
setSubject
(const string &subject)¶ Setter for subject information.
- Parameters
subject – subject information
-
typedef RouteAttributes::iterator
-