React to given (AMQP) message. `message` is expected to be
    :py:func:`collections.namedtuple` structure from :mod:`.structures` filled
    with all necessary data.

    Args:
        message (object): One of the request objects defined in
                          :mod:`.structures`.
        send_back (fn reference): Reference to function for responding. This is
                  useful for progress monitoring for example. Function takes
                  one parameter, which may be response structure/namedtuple, or
                  string or whatever would be normally returned.

    Returns:
        object: Response class from :mod:`structures`.

    Raises:
        ValueError: if bad type of `message` structure is given.

def reactToAMQPMessage(message, send_back):
    """
    React to given (AMQP) message. `message` is expected to be
    :py:func:`collections.namedtuple` structure from :mod:`.structures` filled
    with all necessary data.

    Args:
        message (object): One of the request objects defined in
                          :mod:`.structures`.
        send_back (fn reference): Reference to function for responding. This is
                  useful for progress monitoring for example. Function takes
                  one parameter, which may be response structure/namedtuple, or
                  string or whatever would be normally returned.

    Returns:
        object: Response class from :mod:`structures`.

    Raises:
        ValueError: if bad type of `message` structure is given.
    """
    _hnas_protection()

    if _instanceof(message, SaveRequest):
        # Tree
        if _instanceof(message.record, Tree):
            tree_handler().add_tree(message.record)

            return TreeInfo(
                path=message.record.path,
                url_by_path=_compose_tree_url(message.record),
                url_by_issn=_compose_tree_url(message.record, issn_url=True),
            )

        # Publication
        save_fn = save_publication
        class_ref = DBPublication

        # Archive
        if _instanceof(message.record, Archive):
            save_fn = save_archive
            class_ref = DBArchive

        return save_fn(
            class_ref.from_comm(message.record)
        )

    elif _instanceof(message, SearchRequest):
        # Publication
        search_fn = search_publications
        class_ref = DBPublication

        # Archive
        if _instanceof(message.query, Archive):
            search_fn = search_archives
            class_ref = DBArchive

        results = search_fn(
            class_ref.from_comm(message.query)
        )

        return SearchResult(
            records=[
                record.to_comm(light_request=message.light_request)
                for record in results
            ]
        )

    raise ValueError("'%s' is unknown type of request!" % str(type(message)))