Return-Path: X-Original-To: apmail-storm-user-archive@minotaur.apache.org Delivered-To: apmail-storm-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 37193109AC for ; Mon, 6 Jan 2014 12:23:29 +0000 (UTC) Received: (qmail 64820 invoked by uid 500); 6 Jan 2014 12:23:25 -0000 Delivered-To: apmail-storm-user-archive@storm.apache.org Received: (qmail 64221 invoked by uid 500); 6 Jan 2014 12:23:17 -0000 Mailing-List: contact user-help@storm.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@storm.incubator.apache.org Delivered-To: mailing list user@storm.incubator.apache.org Received: (qmail 64103 invoked by uid 99); 6 Jan 2014 12:23:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jan 2014 12:23:11 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.220.169] (HELO mail-vc0-f169.google.com) (209.85.220.169) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jan 2014 12:23:08 +0000 Received: by mail-vc0-f169.google.com with SMTP id hu19so9199263vcb.28 for ; Mon, 06 Jan 2014 04:22:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=o9KqhLfElZvFSKkiWfGCVyl21ljJAzi9X+yyzPCYxEY=; b=TuRkxwR6/3+e8IdulcdsZOPphrGQcr4ywH5yPf/EH0Kn21GcfY+QHcZabyupDNwcdn K/iUdvgVKG0/ZWXjYwQeG2+bzYTvNSDEdDZRlbre34TZe0uvp6WLS/V1P+2dm4RNcH2h GnPx99hiUN/zErwTw5IdvMXR5KrL7exoLTcJIhJewjGMW6Xvgr+VxKeIT92fFvs2h6iO AWqstzOr8zQgciLd0jaZM3YIW4Ca94RCpfvTtdXvlY9dmQhx7H9osWrehic441JowF3H wotVsKgrQ7cOC+ggIoow0mymsnC2SrgGwmX3EVPcjF2YXuwrBNtq9v2q76oH1eiu78xX 9xQw== X-Gm-Message-State: ALoCoQnuGPlfipmkrAXC3HE5fJlGwfJVNu4xySGbyFagaLVrSTFHcLq20FPAmKmorTZC3AXnsoVz MIME-Version: 1.0 X-Received: by 10.220.252.137 with SMTP id mw9mr2291682vcb.23.1389010966558; Mon, 06 Jan 2014 04:22:46 -0800 (PST) Received: by 10.58.168.143 with HTTP; Mon, 6 Jan 2014 04:22:46 -0800 (PST) In-Reply-To: References: <23efc490fbc3fe6b2da21cce9f2f3d07@mail.gmail.com> <8662639b80dc1b0a46b3887191490ec4@mail.gmail.com> Date: Mon, 6 Jan 2014 13:22:46 +0100 Message-ID: Subject: Re: Spring bolts From: "Bakker, Jethro" To: user@storm.incubator.apache.org Content-Type: multipart/alternative; boundary=089e01176a2340508f04ef4c5180 X-Virus-Checked: Checked by ClamAV on apache.org --089e01176a2340508f04ef4c5180 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, can you explain why it won't work? We use Breeze to read messages from a Redis queue and have completely defined our beans in Spring. Please create an issue in the github repo so we can help you further. 2014/1/5 Michal Singer > Hi, I checked this out. this project does give a way to run spring beans > inside a bolt or a spout. > > But if I want for example to define a spout which is a JMS listener of > activemq and is configured in spring it won=92t work. > > I will need to define a regular spout which reads from a spring bean whic= h > is a jms listener. > > This will be problematic as to a point of failure since I will not read > directly from jms queue (Activemq) but instead from an internal queue whi= ch > will be somhow loaded from the AMQ. > > Thanks > > > > *From:* Eugene [mailto:edvorkin@gmail.com] > *Sent:* Wednesday, December 25, 2013 10:11 PM > > *To:* user@storm.incubator.apache.org > *Subject:* Re: Spring bolts > > > > Did you look into this project: > > https://github.com/internet-research-network/breeze/ > > I did not try it yet, but it may give you what are you looking for. > > Merry Christmas! > > > > On Wed, Dec 25, 2013 at 10:54 AM, Michal Singer > wrote: > > Thanks, Merry Christmas to you! > > > > *From:* Michael Rose [mailto:michael@fullcontact.com] > *Sent:* Wednesday, December 25, 2013 5:48 PM > *To:* user@storm.incubator.apache.org > *Subject:* RE: Spring bolts > > > > Yes, you'll need a Spring context in prepare. Given you have multiple > bolts per JVM, its worth ensuring only one creates it in prepare then > shares that context. > > We do this with Guice injectors and double checked locks. > > Each bolt uses the singleton injector to inject its members. I imagine > Spring has a similar concept once you have a context. > > Life cycle of bolts is quite strange in Storm given they're made before > deployment and serialized. There's quite a few gotchas. Bolt constructors > can't be trusted, thus prepare. > > There may be a spring storm example out there somewhere. > > Merry Christmas! > > On Dec 25, 2013 8:17 AM, "Michal Singer" wrote: > > I am not sure I understand. > > Spring beans are defined in the spring configuration files. How can I > inject them in the members. > > What I thought to do is that the bolts will not be spring beans and in th= e > prepare method I will initialize the spring context. > > This way, the bolts will call other spring beans which are not bolts and > initialized in spring. But of course this is a very limited solution. > > > > > > *From:* Michael Rose [mailto:michael@fullcontact.com] > *Sent:* Wednesday, December 25, 2013 5:06 PM > *To:* user@storm.incubator.apache.org > *Subject:* Re: Spring bolts > > > > Make a base spring bolt, in your prepare method inject the members. That'= s > the best I've come up with, as prepare happens server side whereas topolo= gy > config and static initializers happen at deploy time client side. > > On Dec 25, 2013 7:51 AM, "Michal Singer" wrote: > > Hi, I am trying to understand how to use beans in spring as bolts/spouts. > > If I have the definition in spring which is initialized once the bolt or > spout is initialized. > > But when creating a topology I need to do: new Bolt()=85. > > And cannot get it from spring. > > So what is the right way to do this? > > > > Thanks, Michal > > > > > > -- > Eugene Dvorkin > > Software Engineer > > WebMD > > email: edvorkin@gmail.com > > phone: 646-250-9649 > > eugenedvorkin.com > > Connect with me on: > > LinkedIn Twitter > --089e01176a2340508f04ef4c5180 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
Hi, can you explain why it won't work?=A0
We use B= reeze to read messages from a Redis queue and have completely defined our b= eans in Spring.=A0
Please create an issue in the github repo so w= e can help you further.


2014/1/= 5 Michal Singer <michal@leadspace.com>

Hi, I checked this out. this project does gi= ve a way to run spring beans inside a bolt or a spout.

But if I want for example= to define a spout which is a JMS listener of activemq and is configured in= spring it won=92t work.

I will need to define a r= egular spout which reads from a spring bean which is a jms listener.=

This will be problematic = as to a point of failure since I will not read directly from jms queue (Act= ivemq) but instead from an internal queue which will be somhow loaded from = the AMQ.

Thanks

=A0

From: Eugene [= mailto:edvorkin@gma= il.com]
Sent: Wednesday, December 25, 2013 10:11 PM


To: user@storm.incubator.apache.org
Subject: Re= : Spring bolts

=A0

Did you look into this project:

I did not try it yet, but it may give you what are y= ou looking for.

Merry Christmas!

=A0

On Wed, Dec 25, 2013 at 10:54 AM, Michal Singer <= michal@leadspace.= com> wrote:

Thanks, Merry Christmas to you!

=A0

From: Michael Rose [mailt= o:michael@full= contact.com]
Sent: Wednesday, December 25, 2013 5:48 PM
To: user@storm.incuba= tor.apache.org
Subject: RE: Spring bolts

=A0

Yes, you'll need a Spring context in p= repare. Given you have multiple bolts per JVM, its worth ensuring only one = creates it in prepare then shares that context.

We do this with Guice= injectors and double checked locks.

Each bolt uses the singleton injector to inject its members. I imagine S= pring has a similar concept once you have a context.

Life cycle of bo= lts is quite strange in Storm given they're made before deployment and = serialized. There's quite a few gotchas. Bolt constructors can't be= trusted, thus prepare.

There may be a spring storm example out there somewhere.

Merry Chr= istmas!

On Dec 25, 2013 8:17 AM, "Micha= l Singer" <michal@leadspace.com> wrote:

I am not sure I= understand.

Sp= ring beans are defined in the spring configuration files. How can I inject = them in the members.

What I thought to do is t= hat the bolts will not be spring beans and in the prepare method I will ini= tialize the spring context.

This way, the bolts will = call other spring beans which are not bolts and initialized in spring. But = of course this is a very limited solution.

=A0

=A0

From: Michael = Rose [mailto:m= ichael@fullcontact.com]
Sent: Wednesday, December 25, 2013 5:06 PM
To: user@storm.incuba= tor.apache.org
Subject: Re: Spring bolts

=A0

Make a base spring bolt, in your prepare method inject the member= s. That's the best I've come up with, as prepare happens server sid= e whereas topology config and static initializers happen at deploy time cli= ent side.

On Dec 25, 2013 7:51 AM, "Michal Singer&qu= ot; <michal@le= adspace.com> wrote:

Hi, I am try= ing to understand how to use beans in spring as bolts/spouts.

If I have the definition in spring which is initiali= zed once the bolt or spout is initialized.

But wh= en creating a topology I need to do: new Bolt()=85.

And cannot get it from spring.

So what is the rig= ht way to do this?

=A0

= Thanks, Michal



=A0

--
Eugene Dvorkin

Software Engineer

WebMD

phone: = 646-250-9= 649

Connect with me on:=A0


--089e01176a2340508f04ef4c5180--