# Handler

The `Handler` interface of the **pps** package is very simple and consists only of one method. When starting a new policy service on your [Server](/api/server.md) instance, the `Run()` method requires a type that satisfies the `Handler` interface.&#x20;

This provides and easy way for your program to handle the dataset provided by the Postfix server. Once the dataset has been provided and processed by the pps server, it will hand the [PolicySet](/api/policyset.md) to the `Handle()` method of the `Handler` interface type you provided. All it expects back is a proper response of the type [PostfixResp](/api/postfixresp.md) that it can write back to Postfix. What you do with the [PolicySet](/api/policyset.md) in your `Handle()` method is totally up to you.

{% tabs %}
{% tab title="Signature" %}

```go
type Handler interface {
	Handle(*PolicySet) PostfixResp
}
```

{% endtab %}

{% tab title="Example" %}

```go
// Empty struct to act the Handler interface
type Hi struct {
	r PostfixResp
}

// Handle is the function required by the Handler Interface
func (h Hi) Handle(*pps.PolicySet) pps.PostfixResp {
	if h.r == "" {
		h.r = pps.RespDunno
	}
	return h.r
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pps-docs.pebcak.de/api/handler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
