Пример #1
0
def instance_hook(self, input, instance, attrs):

    # Validate if broker hook actually exists
    ensure_pubsub_hook_is_valid(self, input, instance, attrs)

    # Populate a field that ODB requires even if it is reserved for future use
    if attrs.is_create_edit:
        instance.pub_buffer_size_gd = 0
Пример #2
0
def instance_hook(self, input, instance, attrs):
    # type: (Service, Bunch, PubSubTopic, Bunch)

    if attrs.is_create_edit:

        # Populate a field that ODB requires even if it is reserved for future use
        instance.pub_buffer_size_gd = 0

        # Validate if broker hook actually exists
        ensure_pubsub_hook_is_valid(self, input, instance, attrs)

        # If input hook service is provided by its name,
        # turn it into a service ID and assign it to instance.
        hook_service_name = input.get('hook_service_name')
        if hook_service_name:
            hook_service_id = self.server.service_store.get_service_id_by_name(
                hook_service_name)
            instance.hook_service_id = hook_service_id