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 <[email protected]>
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>
>