Startup service

Hi,

Can we use the output of a startup service for other services,say test:testService. if so how can we get the output of a start up service in the input pipeline of test:testService.

Or is there any way to set a variable in JVM which contains the output of a java service so that the variable can be used across the services with out invoking the java service again and again when required.

Regards,
Sat

Can you describe what you’re trying to accomplish? With that info perhaps we suggest one or more workable solutions.

Probably you can use Input Specification signature and then these (variables) can be accessed globally in ur flow pipeline.Just check it…

HTH,
RMG

This suggestion seems way off base…

Isn’t it Specification used for?? In the past If i remember correctly we used this mechanism for accessing global vars for errorhandling purposes in downstream package/flows.

Sorry if it was very off base and may ignore this.

-RMG

A specification is used to define a service signature that can be used by one or more service definitions. The closest analogy is a Java interface. A Java interface defines methods, their parameters and return types, but do not provide an implementation.

A service specification does the same thing. It defines the inputs and outputs. Then a service can use that specification as its own signature. Thus if a specification declares inputs A and C and outputs X and Z and then service M is defined to use that specification, it will automatically have A and C and X and Z in its respective input and output panes.

Use of a specification has no impact on pipeline scope or lifecycle. There really is no such thing as “global var” in IS.

Sat appears to be asking for a way to create a var in a startup service (which will be executed in some thread) and have that var available to all services that are subsequently executed (which will be executed in other threads). Using a specification will not accomplish this.

Well said Rob.BTW i do know what the Specification does underlying things and usage,but may be i understood differently from what Sat asked.

Thanks for your quick points though.

-RMG

Sat,

There is a service in PSUtilities PSUtilities.memory.persistence:saveDataToMemory which does exactly what you require. Input is a
Key : with which you will access your values later
MemoryData: Value (has a string,StringList,Record,RecordList for flexibility)
Create a service “yourService” which invokes this service and sets a value for Key, and MemoryData. Add your service to the startupservice list in your Package.

Access your memory values anytime anywhere later using the key you set by calling “PSUtilities.memory.persistence:getDataFromMemory”

Also you can clear the memory values by using PSUtilities.memory.persistence:removeDataFromMemory.

Hope that helps

Cheers.

Sat,

There is a service in PSUtilities PSUtilities.memory.persistence:saveDataToMemory which does exactly what you require. Input is a
Key : with which you will access your values later
MemoryData: Value (has a string,StringList,Record,RecordList for flexibility)
Create a service “yourService” which invokes this service and sets a value for Key, and MemoryData. Add your service to the startupservice list in your Package.

Access your memory values anytime anywhere later using the key you set by calling “PSUtilities.memory.persistence:getDataFromMemory”

Also you can clear the memory values by using PSUtilities.memory.persistence:removeDataFromMemory.

Hope that helps

Cheers.

Sat,

One way to do this is to create a static variable. Your startup service should populate that variable with its output when it’s done. You could then create a little Java service that simply returns that variable so other services could call it.

If your startup service is not a Java service, you will need to create a Java service that your startup service can call to populate the variable. You should create the variable in the Source area of the Shared tab.

  • Percio

Sorry for late as i fell sick…

Hi Austin,

I hope the solution provided by you might work perfectly but it could occupy the run time memory for entilre life cycle,correct me if i am wrong…

The actual problem is, i have a java service x, which extracts data from database. in my solution i am forced to invoke this service several times because i dont want to occupy runtime memory for long runs which might become added reason to fail in large file handling. So i just want to set use the output of this java service for entire life cycle.

Rgds,
Sat

Several points that I’d like to ask about:

  • Why are you using a Java service to read database data? Are the services you can create using the JDBC adapter insufficient?

  • What is the concern with invoking the service multiple times?

  • “So i just want to set use the output of this java service for entire life cycle.” What life-cycle are you referring to? Of Integration Server? Of a given service execution?

  • You say you don’t want to call the service multiple times. But you don’t want to consume memory either. You going to need to do one or the other. Where do you think the output of a service resides? How much memory does the retrieved data occupy? Are you retrieving 1 record? 10 records? 100? How many fields does each record have?

  • You might consider service caching. Refer to the Developer’s Guide for more info.

Hi Rob,

Good Shoot outs…

Actually am not coding in java to refer database but my values in the tables are encrypted and there is need of JAVA to decrypt them.

concern to invoke this service is to mainly to get the system property ( project specific) and logging as well.

Lifecycle means one complete integration solution, file transfer in my case. and the same service is getting invoked for all the requests(it can be on different protocols). So to just avoid multiple invocations for same set of results is there any way like setting a static variable by which i can set that variable to some values and extract them where ever rquired.

To make sure I understand, you’re looking to keep the value read from the database for the entire processing of just 1 file? Or are you looking to hold that value in memory for every file that is processed?

For the former, just keep the variable in the pipeline and don’t drop it. It will be available for the life of the top-level service invocation.

If the latter, I’d strongly encourage using service caching. In this, you’d set the cache time-to-live value on the service you need to call. Then throughout your services that process the files, call your “system property” service. IS will manage the caching and will return the same values (without running the service) for each call. Using this approach will allow you to purge the cache (using Administrator) if needed if/when the data changes and should be reloaded.

Yes, exactly am looking to to hold the values for all the file transfers which can happen on different protocols. But just i wnat reference of values rather keeping them in pipeline because already we are facing problems if the files are bit large. i know large files can be handled in TN but in my case am not processing the files so we dont use TN otherthan extracting the partner profiles.

Thats the reason y am looking to set a static variable…

Whether you keep “just a reference” or keep a var in the pipeline, you’ll be consuming memory. There is no way you’re going to avoid consuming memory if you don’t want to constantly read the DB.

I think the caching option is the way to go. Just call the service whenever you need the properties and let IS manage keeping them cached in memory for effiiciency.

BTW, large file handling is possible without using TN.

If i can handle tha large file with out using TN then that would be great. Could yo please brief out the possibilities.

The large file handling of TN was “promoted” to IS in general. I don’t remember exactly the version that introduced it at the IS level. A search of Advantage should yield the answer.