Given that the each request message spawns a separate thread, and separate instances of the Web module and its contents are created dynamically for each thread, I added a FDConnection and FDQuery to the webmodule so that I can send a personnel profile from the database to the requester upon request.
How can I access a web module instance?
In the web module there is only one variable of the web module metaclass :
var
WebModuleClass: TComponentClass = TWebModule1;
for example:
WebModule.FDQuery.Close;
The CountryImpl unit is implementation of CountryIntf service
unit CountryImpl;
interface
uses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns, uCountry, CountryIntf,
WebModuleUnit1;
type
TCountryManager = class(TInvokableClass, ICountryManager)
public
function GetCountry(ACountryId: integer): TCountry;
end;
implementation
{ TCountry }
function TCountryManager.GetCountry(ACountryId: integer): TCountry;
begin
WebModule.FDQuery.Close;
WebModule.FDQuery.ParamByName('Id').Value := ACountryId;
WebModule.FDQuery.Open;
end;
initialization
InvRegistry.RegisterInvokableClass(TCountryManager);
end.
Your assumption is incorrect: Only 1 instance of the webmodule is created in the SOAP server application. You should not add thread-specific functionality to the webmodule, you must add it to the CountryImp.pas. Since there is no design-surface there, you have to do runtime instantiation of FDConnection(s) and FDQueries in the functions in that unit.
Related
I am refactoring my Flink Statefuns for embedded service deployment, but I cannot find the way to register statefun's ValueSpec in EmbeddedModule
When I was using remote http service deployment on k8s, I was building StatefulFunctionSpec with statefun's all value specs inside, and was registering it by StatefulFunctions.withStatefulFunction(spec):
Build static spec in MyStatefun:
static StatefulFunctionSpec SPEC = StatefulFunctionSpec.builder(MY_TYPE)
.withValueSpecs(MY_VALUE_SPEC)
.withSupplier(MyStatefun::new)
.build();
Register it in StatefulFunctions:
StatefulFunctions functions = new StatefulFunctions();
functions.withStatefulFunction(MyStatefun.SPEC);
And finally use functions.requestReplyHandler() as a handler in http server.
What's the way of doing that in EmbeddedModule?
In examples that I found so far, I only see that statefun is registered as this, but does this also register ValueSpecs?
binder.bindFunctionProvider(MyStatefun.FUNCTION_TYPE, x -> (StatefulFunction) new MyStatefun());
UPD. It seems that .bindFunctionProvider(...) cannot bind sdk.java.StatefulFunction, it can only bind sdk.StatefulFunction, which implements .invoke(sdk.Context, Object o) instead of .apply(sdk.java.Context, Message msg). And sdk.Context does not have .storage() method for accessing ValueSpecs.
UPD2. Found page about PersistedValue that could be used for state management and could possibly be the answer to my question: https://nightlies.apache.org/flink/flink-statefun-docs-master/docs/sdk/flink-datastream/
With module gaurds, is it possible to insert to a table but not add a read function within that defined module that sits on a public chain (chainweb)...then subsequently define a module on scalableBFT (private chain) that allows an account defined on the permissioned network to read from the table sitting on the public chain? Possibly a privacy preserving method?
I am trying to model an event-based gateway that waits for several messages, and optionally for a timer. Before using this in a real model I tried it in a unit test, and it seems in the camunda engine the condition is completely ignored. Now I'm wondering if this is supposed to be supported by bpmn, if not if there is an easy alternative way to model this.
The code for the unit test, based on the camunda-engine-unit-test project is as following:
Map<String, Object> variables = singletonMap("isTimerActive", (Object) false);
ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", variables);
assertFalse("Process instance should not be ended", pi.isEnded());
String id = pi.getProcessInstanceId();
Job timer = managementService.createJobQuery().processInstanceId(id).timers().active().singleResult();
assertNull(timer);
This is not allowed.
The outgoing Sequence Flows of the Event Gateway MUST NOT have a conditionExpression
BPMN 2.0 Specification Section 10.5.6, page 297
edit: source: http://www.omg.org/spec/BPMN/2.0/PDF
I am using Objectify for retrieving data From datastore in GWT,But i get the Following Error :
[ERROR] No source code is available for type
com.logins.entity.experts; did you forget to inherit a required
module?
I have Client->entity->Server and i did define the RPC properly with RemoteServicePath.
i intiaized the Rpc in client side
final findexpertAsync
finexp=(findexpertAsync)GWT.create(findexpert.class);
GWT compiler throws Error at the method i call,
finexp.expert(expnam, new AsyncCallback<ArrayList<experts>>()
Note:
1) findexpert and FindexpertAsync are the RPC interface which has a method for retriving data from datastore
2)com.logins.entity.experts:experts is a server class.
Any guesses where i am going wrong ?
All classes directly or indirectly referenced from the client must be part of the client source path. You can't access server-only code from GWT. In this case, class "experts" needs to be part of the GWT-compiled client code.
Also: You should capitalize Java class names.
I learnt how can we configure transactions in Entity Framework using TransactionScope in one other question of mine. However it still confuses me! I mean how does RIA services execute transactions and how can we specify transaction options? I mean, suppose on the client in Silverlight we specify something like this :-
someContext.Add(someEntity1);
someContext.Add(someEntity2);
someContext.Add(someEntity3);
Now when i call someContext.SubmitChanges() this is going to call InsertSomeEntity() on the server in my domain service class. What is the guarantee that all three records will be inserted into the database and if one fails all of them fails? And how can we change these options?
Chand's link has a good example. WCF RIA will submit a ChangeSet for the SubmitChanges containing all 3 Add's. In your DomainService, you can override the PersistChanges method to complete the transaction.
public class SomeEntityDomainService : DomainService
{
SomeEFContext _someEFContext;
public SomeEntityDomainService()
{
_someEFContext = new SomeEFContext();
}
public void InsertSomeEntity(SomeEntity someEntity)
{
// Called 3 times in your example
_someEFContext.SomeEntities.Add(someEntity);
}
protected override bool PersistChangeSet()
{
// Called exactly once per SubmitChanges() in Silverlight
_someEFContext.SaveChanges();
}
}
All of this happens in one request from the client to the server, not 3 requests.