Agree with the README comments.  Another great reference is the Simple 
WebService example which has payloads.

 - 
https://github.com/apache/tomee/tree/master/examples/simple-webservice#inspecting-the-messages

I think people new to MicroProfile metrics will want to see what the metrics 
look like, so similarly showing payloads would be great.

Often when I'm starting an bunch of examples, I try to plan a few in advance so 
I can come up with a forward-thinking naming convention should be adjusted.  
There's an informal naming convention in there already which is basically:

 - simple-<topic>              // introduction
 - <topic>-<subtopic1>         // very specific lesson
 - <topic>-<subtopic2>         // very specific lesson
 - <topic>-<subtopic3>         // very specific lesson

For example:

 - simple-webservice              // introduction
 - webservice-attachments
 - webservice-handlerchain
 - webservice-holder

 - cdi-basic                      // slightly bucks convention
 - cdi-application-scope
 - cdi-session-scope
 - cdi-request-scope
 - cdi-events
 - cdi-interceptors
 - cdi-decorators                 // this one doesn't actually exist!!! 
contribution opportunity! :)

My gut says "rest" is not the topic and shouldn't be first in the directory 
name and probably doesn't need to be mentioned at all.  The second thought is 
there are very specific annotations and metric types, so each of these could be 
an example.  This might give you:

 - mp-metrics-basic || simple-mp-metrics      // whichever convention we think 
is best
 - mp-metrics-counted
 - mp-metrics-guague
 - mp-metrics-timed

We've generally had a policy to attempt to keep examples as simple and trivial 
as possible.  For CDI we have one example for each scope annotation.  Doing the 
same with the metrics annotation would allow you to focus on the nuances of 
that annotation. A few advantages would be:

 - search engine optimization. having the annotation in the page title will put 
your content first when someone searches "mp metrics guague"
 - people can send the links to each other with "this is the metric type you 
want for X task.  Here's the simplest example. The other types are ignorable 
for X"
 - people don't have to digest all of MP Metrics at once.  we typically shoot 
for 5 minutes of "presentation time" per example.

I vividly remember a presentation I did at JAX London where I talked about 
OpenEJB for the first half, then just started showing examples for the second 
half.  Each five minutes.  I showed what the room wanted to see.  30 minutes go 
by and the session is technically over and it's lunch break, but people aren't 
leaving.  So I'm like, "do you want to see more?" and people stay glued to 
their seat and keep asking for stuff.  I showed another 20-30 minutes of 5 
minute examples before I basically told everyone to go eat as the conference 
organizer who was standing in the back of the room the entire time gave me the 
nod to force everyone get out of their seats.  It was the biggest room and all 
the food and staff were just sitting there.

Anyway, that's the power of bite-sized examples.  You can put them together 
like legos and make any shape presentation you want.

If you want to do a MicroProfile general introduction, you grab the "simple 
foo" of each topic.  If you want to do a dedicated MicroProfile Metrics talk, 
you pick your favorite 5 or 8 mp-metrics-* examples.

Doing it like that you can easily bang out a bunch of examples in a few days or 
a week. Then have the ability to walk into almost any room and give an ad-hoc 
MicroProfile presentation tailored to the people in front of you.


-- 
David Blevins
http://twitter.com/dblevins
http://www.tomitribe.com

> On Nov 19, 2018, at 12:24 PM, Jonathan Gallimore 
> <jonathan.gallim...@gmail.com> wrote:
> 
> Great stuff! Do checkout these - they're a pretty good format to follow:
> https://github.com/apache/tomee/blob/master/examples/simple-stateless/README.md
> .
> 
> I've merged your PR, and we can continue to iterate on it. Thanks for the
> contribution, I think its great to see some MicroProfile examples. I found
> the examples really helpful when getting started with TomEE/OpenEJB myself,
> and I'm sure folks will love seeing new examples for MicroProfile!
> 
> Jon
> 
> On Mon, Nov 19, 2018 at 8:12 PM Ivan Junckes Filho <ivanjunc...@gmail.com>
> wrote:
> 
>> Done Jon, I will keep improving it.
>> 
>> On Mon, Nov 19, 2018 at 6:01 PM Jonathan Gallimore <
>> jonathan.gallim...@gmail.com> wrote:
>> 
>>> Very cool. I'd suggest adding a README like the other examples have, as
>>> that can be linked from the website, and they usually provide great
>>> documentation.
>>> 
>>> Jon
>>> 
>>> On Mon, 19 Nov 2018, 19:51 Ivan Junckes Filho <ivanjunc...@gmail.com
>>> wrote:
>>> 
>>>> Hey guys, just to let you know that I created a Microprofile Metrics
>>>> Example under Tomee.
>>>> 
>>>> I am still working on that and I will provide more test scenarios.
>>>> 
>>>> Here is the PR if you want to review the work so far:
>>>> https://github.com/apache/tomee/pull/203
>>>> 
>>>> Feel free to merge if you think this can be done incrementally.
>>>> 
>>> 
>> 

Reply via email to