An abstract Hyperty is extended by all vertx Hyperties.
Use Verticle Configuration to set:
url
hyperty urlidentity
Identity JSON compliant reTHINK Identity to be associated with the hyperty.streams
json object identifying streams to be published by the Hyperty. Example:
{
"id": "mystream",
"url": "stream://mydomain.com/mystream"
}
DataObjects
Collection of Data Objects handled by the Hyperty:
{
<hypertyUrl>: {
<objectURL>: {
userUrl: <URL>,
type: <reporter|observer>
}
}
}
The Abstract Hyperty set the following Event Bus Message Headers (DeliveryOptions().addHeaders(header-name,header-value)
):
from
with valueconfig().getString("url")
,identity
with valueconfig().getString("identity")
,type
with value set by the Hyperty itself e.g.create
The Verticle start()
where Vertx Event BUS handler at config.url
address to receive messages targeting the Hyperty, is set. Received messages are processed by onMessage(msg)
.
Set from
and identity
headers before calling eb.send(..)
.
Set from
and identity
headers before calling eb.publish(..)
.
Invitations (ie type = create and from has /subscription
) are processed by the callback setup at onNotification
.
Process invitations to be an Observer or notifications that some existing DataObjectObserver was deleted. By default, invitations are accepted and the subscribe()
function is called.
If a different logic is needed this function must be overwritten.
Send a subscription message towards address
with a callback that sets the onChanges()
as an handler at <address>/changes
(ie eventBus.sendMessage( ..)
).
A co
Function to process messages with changes on the observed Data Object subscribed with subscribe()
. To be overwrite by classes extending the AbstractHyperty.
Send the following message to all observers
:
type: "create",
from: "dataObjectUrl/subscription",
body: { source: <hypertyUrl>, schema: <catalogueURL>, value: <initialData> }
Some of these observers may be "Subscription Managers" that are running in P2P Vertx Protostubs, that locally create Data Object Reporters when this message is created.
It returns a Reporter object compliant with Syncher DataObjectReporter i.e. it adds a handler to dataObjectUrl/subscription
that will fire onSubscription events.
When Hyperty handles information to be persisted it should have handlers at each config.streams
to process incoming read
messages that will return the queried data.
If the read message body does not contain any resource
field, all persisted data is returned.