Hi Jeremiah, If you would like to continue to use the low-level API (i.e. StreamTask), then you actually will want to use TaskApplication, not StreamApplication. Sorry for the confusion regarding the naming of the classes. Take a look at https://samza.apache.org/learn/documentation/latest/api/low-level-api.html for some more information about using the low-level API. You will still pass your TaskApplication to the LocalApplicationRunner. You do not need to explicitly call any "init" method in your code. That method will get called for you, as long as you implement InitableTask.init(...). If you would like, as Yi suggested, you can use ApplicationContainerContext/ApplicationTaskContext to manage your LocalCacheManager. However, your existing "init" code should also continue to work when you start to use TaskApplication.
If you would actually like to also migrate to using the high-level API, then take a look at https://samza.apache.org/learn/documentation/latest/api/high-level-api.html. Cameron On Wed, Apr 3, 2019 at 2:52 PM Yi Pan <nickpa...@gmail.com> wrote: > Hi, Jeremiah, > > In the new apis, you should be using ApplicationContainerContextFactory and > ApplicationTaskContextFactory to instantiate context objects used in the > whole container or in a task instance, respectively. The context factories > should be implemented as dependencies injected to your implementation of > StreamApplication. In your example, you should add the context factories in > the InquirySubmissionApp: > public InquirySubmissionApp implements StreamApplication { > @Override > public void describe(StreamApplicationDescriptor appDescriptor) { > appDescriptor.withApplicationContainerContextFactory(new > MyContainerContextFactory(...)); > appDescriptor.withApplicationTaskContextFactory(new > MyTaskContextFactory(...)); > // user processing logic using MessageStream and the transform > operators... > } > } > > Best, > > -Yi > > On Wed, Apr 3, 2019 at 12:05 PM Jeremiah Adams <jad...@helixeducation.com> > wrote: > > > ?I am working to move our code from Yarn based StreamTask to standalone > > StreamApplication via LocalTaskRunner. > > > > > > I'm having some trouble understanding how to create/fetch a Context for > > use in the IntiableFunction.init() interface. My old code used context to > > get the store for LocalCacheManager initialization so I need this > context. > > I see no interesting methods in StreamAplicationDescriptor. > > > > > > I am launching my StreamApplication via a TaskRunner: > > > > > > Where/how do i get a Samza.context.Context? > > > > > > public static void main( String[] args ) > > { > > > > CommandLine cmdLine = new CommandLine(); > > OptionSet options = cmdLine.parser().parse(args); > > Config config = cmdLine.loadConfig(options); > > > > InquirySubmissionApp app= new InquirySubmissionApp(config); > > // Need to get a context here? > > app.init(); > > LocalApplicationRunner localApplicationRunner = new > > LocalApplicationRunner(app, config); > > localApplicationRunner.run(); > > localApplicationRunner.waitForFinish(); > > }? > > > > > > > > > > > > > > > > > > Jeremiah Adams > > Software Engineer > > www.helixeducation.com<http://www.helixeducation.com/> > > Blog<http://www.helixeducation.com/blog/> | Twitter< > > https://twitter.com/HelixEducation> | Facebook< > > https://www.facebook.com/HelixEducation> | LinkedIn< > > http://www.linkedin.com/company/3609946> > > >