Jochen, 

This points me in the right direction. Thanks!

On Sunday, October 25, 2015 at 2:31:26 AM UTC-6, Jochen Schalanda wrote:
>
> Hi Jesse,
>
> there are several possibilities to write plugin-specific data into MongoDB 
> (none of which are documented, sorry for that).
>
>    - If you can live with the overhead, you can simply inject 
>    ClusterConfigService 
>    
> <https://github.com/Graylog2/graylog2-server/blob/1.2.1/graylog2-plugin-interfaces/src/main/java/org/graylog2/plugin/cluster/ClusterConfigService.java>
>  
>    into your plugin and create a simple POJO (don't forget the Jackson 
>    annotations) which will get persisted into MongoDB. See ClusterId 
>    
> <https://github.com/Graylog2/graylog2-server/blob/1.2.1/graylog2-plugin-interfaces/src/main/java/org/graylog2/plugin/cluster/ClusterId.java>
>  
>    and ClusterIdGeneratorPeriodical 
>    
> <https://github.com/Graylog2/graylog2-server/blob/1.2.1/graylog2-server/src/main/java/org/graylog2/periodical/ClusterIdGeneratorPeriodical.java>
>  
>    for an example.
>    - You can inject MongoConnection 
>    
> <https://github.com/Graylog2/graylog2-server/blob/1.2.1/graylog2-server/src/main/java/org/graylog2/database/MongoConnection.java>
>  
>    into your plugin which will give you access to the Mongo 
>    <https://api.mongodb.org/java/2.13/com/mongodb/Mongo.html> and DB 
>    <https://api.mongodb.org/java/2.13/com/mongodb/DB.html> objects of the 
>    MongoDB Java driver (also take a look at PersistedImpl 
>    
> <https://github.com/Graylog2/graylog2-server/blob/1.2.1/graylog2-server/src/main/java/org/graylog2/database/PersistedImpl.java>).
>  
>    This requires you to depend on the graylog2-server artifact instead of 
>    graylog2-plugin.
>    - You can use MongoJack <http://mongojack.org/> to access MongoDB 
>    instead of the plain MongoDB Java driver, see ClusterConfigServiceImpl 
>    
> <https://github.com/Graylog2/graylog2-server/blob/1.2.1/graylog2-server/src/main/java/org/graylog2/cluster/ClusterConfigServiceImpl.java>
>  
>    for an example. Again, you'll need to depend on graylog2-server 
>    instead of graylog2-plugin to make these classes available.
>
> HTH,
> Jochen
>

-- 
You received this message because you are subscribed to the Google Groups 
"Graylog Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/graylog2/5241687c-a05a-4c4e-877f-2c67758ee1ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to