<p>I am exploring the <a href="https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/KubernetesClient.java#L104" rel="nofollow noreferrer">(undocumented?) <code>events()</code> API</a> in <a href="https://github.com/fabric8io/kubernetes-client" rel="nofollow noreferrer">Fabric8's Kubernetes client project</a>.</p>

<p>Specifically, I see that I can do something like the following:</p>

<pre><code>client.events().inAnyNamespace().watch(new Watcher&lt;Something&gt;() {
    @Override
    public final void eventReceived(final Action action, final Something something) {

    }

    @Override
    public final void onClose(final KubernetesClientException kubernetesClientException) {
      if (kubernetesClientException != null) {
        // log? throw?
      }
    }
});
</code></pre>

<p>What are the permitted values of <code>something</code> and <code>Something</code> for something useful to happen?  I'm assuming they are <em>supposed</em> to be things like Pods, Services, etc. but I'm not sure.</p>

<p><a href="https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Watcher.java#L20" rel="nofollow noreferrer"><code>Watcher</code>'s sole type parameter is declared as <code>&lt;T&gt;</code></a>, so it would appear I could create a new <code>Watcher&lt;Integer&gt;</code>, but I'm willing to bet money that will never be called.  This suggests that there is actually a bound in practice on <code>&lt;T&gt;</code>, but I don't know what it is, or why it would have been omitted if so.</p>

<p>If I had to guess, I'd guess from the parameter name, <code>resource</code>, that it would be something like <code>T extends</code><a href="https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Resource.java" rel="nofollow noreferrer"><code>Resource</code></a><code>&lt;?, ?&gt;</code> but again, that's only a guess.</p>

<p>Thanks for any pointers, particularly to other documentation I'm sure I've missed.</p>

<p><strong>Update #1</strong>: From banging around in the source code, I can see that the only place that a <code>Watcher.Action</code>'s <code>eventReceived()</code> method is called <a href="https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java#L207-L217" rel="nofollow noreferrer">forces the payload to be considered to be a <code>HasMetadata</code> object</a>.  Maybe that's my answer?</p>

<p>You can watch a particular pod or particular job for example. The T type in that case is Pod or Job respectively. Try </p>

<pre><code>kube.extensions().jobs().createNew()...done().watch(new Watcher&lt;Job&gt;(){...})
</code></pre>
