Module broen_core

broen_core turns HTTP requests/responses into AMQP RPC messaging.

Description

broen_core turns HTTP requests/responses into AMQP RPC messaging. Given a HTTP Request, this module will first authenticate it using the provided authentication plugin and the publish the message serialized with the serializer plug over AMQP. Upon receiving a response, the module will respond back over HTTP.

Data Types

broen_cookies()

broen_cookies() = #{cookie_name() => cookie_value()}

The cookies object maps cookie names to the properties.

broen_nullable_string()

broen_nullable_string() = unicode:unicode_binary() | null

A binary string that can be null

broen_object()

broen_object() = #{broen_string() => broen_string()}

An generic sub-object that is a map mapping a string to a string. Used for e.g. HTTP headers

broen_request()

broen_request() = #{appmoddata := broen_string(), protocol := http | https, cookies := broen_object(), http_headers := broen_object(), request := broen_string(), method := broen_string(), referer := broen_nullable_string(), fullpath := broen_string(), useragent := broen_nullable_string(), client_data := binary() | null, client_ip := broen_string(), routing_key := broen_string(), queryobj := broen_object(), auth_data := term(), querydata => broen_string(), postobj => broen_object(), multipartobj => term()}

}. The format of a broen request that is sent to the serializer plugin.
cookies - Cookies attached to the HTTP request
http_headers - HTTP request headers
request - The HTTP method
method - Same as above
client_data - Client information
fullpath - Full path of the request as provided by Yaws
appmoddata - The URL that is turned into the routing key (i.e. what follows /call)
referer - The referer URL
useragent - User agent data
client_ip - IP of the client
routing_key - The routing key the request will be sent to
queryobj - The query object containing the query parameters
auth_data - Data returned by the authentication module
querydata - Same as queryobj, but in a string format
postobj- Data attached to a POST request
multipartobj - Data for the multipart request

broen_response()

broen_response() = #{payload := term(), status_code => integer(), media_type => content_type(), cookies => broen_cookies(), cookie_path => broen_string(), headers => broen_object()} | #{redirect := unicode:unicode_binary()}

The format of a broen response that should be returned by the serializer plugin
payload - The payload of the response
status_code - Status code of the response
media_type - The MIME content type of the payload
cookies - Additional cookies to be sent to user
cookie_path - The cookie path
headers - Additional headers for the HTTP response
Alternatively the response can also be a redirect.

broen_string()

broen_string() = unicode:unicode_binary()

A binary string

content_type()

content_type() = unicode:unicode_binary()

The MIME content type

cookie_name()

cookie_name() = broen_string()

The name of a cookie

cookie_value()

cookie_value() = #{value := broen_string(), domain => broen_string(), path => broen_string(), http_only => boolean(), secure => boolean(), expires => broen_string()}

The cookie properties. Each cookie must define a value and may optionally define the domain it applies to and the expiration date

Function Index

handle/3
register_metrics/0Registers metrics with folsom.

Function Details

handle/3

handle(Req0, Conf, CookiePath) -> any()

register_metrics/0

register_metrics() -> ok

Registers metrics with folsom


Generated by EDoc