I use grpc cpp, and want to modify the method name in the client, example: path+method, but the ClientInterceptor could not modify method? How can I do
No, you cannot modify the method name by the interceptor. I guess you considered using pre-send initial metadata but it doesn't allow to change the method name. But the intercept allows you to hijack the call, send a new rpc, and return the result from this new rpc as an original result to achieve what you want to do.
Related
I have a meteor method that's supposed to handle file/image uploads by passing a cdn key, which is just a string.
For latency compensation though, I want to add the actual image blob to LocalMongo, that way I can add an image preview.
This is a problem since I want to just pass a string key to my server method, while I want to pass a file blob to my client method stub. Does Meteor support this? I don't want to pass the image blob to my server (as doing so would serialize the blob/make the call costly).
A solution I'm thinking of is to just define two Meteor methods with different names, the first one being for the client and the other for the server, and just calling them both with the proper parameters. Is this the proper way to do this in Meteor?
EDIT: My solution above doesn't actually work because Meteor realizes there is no method on the server (and nukes the local changes of my client method)
Just a suggestion, you can save the file blob in a Session variable and access in the method when the method stub is called from client, like this,
Meteor.methods({
'yourMethod': function (key) {
if (Meteor.isClient) {
var fileBlob = Session.get('my-file-blob'); //set this variable just before calling this method. And don't forget to remove it when template is destroyed.
} else {
}
}
});
Like I said, I didn't test it but just a suggestion. Hope it helps.
I am using redirect to pass the model object from one method to another method in grails. How can I get the values of that model object in another method.
See my code here
redirect(controller:"inquiry", action:"createSSVInvestigation", model: [inquiryInstance:inquiryInstance], params:['inquiry.id':inquiryInstance.id])
So in the action createSSVInvestigation how can I get the values of inquiryInstance object.
redirect(controller:"inquiry", action:"createSSVInvestigation",params:['inquiryId':inquiryInstance.id])
In createSSVInvestigation action,We get the id of inquiryInstance by params.inquiryId.
def createSSVInvestigation(){
def inquiryInstance= InquiryClassname.get(params.inquiryId)
}
You can use params to pass all your objects/variables and access them from your params in createSSVInvestigation action. Also model is not part of redirect parameters here.
redirect(controller:"inquiry", action:"createSSVInvestigation", params: [...])
Use this
flash.chainModel.inquiryInstance
Update:
The original question was to get inquiryInstance which was set in model. In documentation its mentioned that we should use flash memory. So this is a way to access flash variables once you chain controllers.
Disclaimer: I am a complete biztalk newbie.
I need to be able to read and potentially edit 4 nodes in a biztalk message; preferably this needs to be done from a c# helper class as I am making a service call and also have unit tests written for this.
I already have this class wired up and it works with the XLANGMessage class, the problem I am running into is at this point in the orchestration the message is a Schema based type and doesn't seem to have any way for me to modify it.
I've done some reading and found a few ideas but have not been able to confirm if any of these can work from custom code.
1 write a map to transform the incoming message to the desired type
or
2 write something like this in your helper component to transform the message
public XmlDocument TransformMessage(XLANGMessage message)
Then pass the result document to a biztalk message in a message assignment shape.
responseMessage = xmlDocument;
You may get better performance if you pass streams instead of messages around.
You can pass messages into and out of C# helper classes easily. The simplest way is just to treat input parameters and return values as of type System.Xml.XmlDocument. The XLANG/s engine will safely cast back and forth from the XLANGMessage type to XmlDocument.
As you are essentially creating a "new" instance of the message (messages are immutable in BizTalk), the call to your helper class needs to be performed in a Message Assignment shape, with the outer Construct shape constructing the copy of your original message.
public static XmlDocument UpdateMyMessage(XmlDocument sourceMessage)
{
/* Do stuff to your Message here */
return sourceMessage;
}
A best-practice to consider is to declare all your C# helper methods as Static. This will avoid any issues with de/serialisation of your helper class during dehydration.
Are BizTalk messages immutable?
Generally speaking they are however, by creating a “corrective” orchestration and using a pass by reference option on the incoming message parameter, an existing message can be modified.
I want to know if it is possible to modify the value of the parameter of the request.
But i don't know how to do this.
I try with
$requestContent = $this->getRequest()->request->get('tactill_customerbundle_customertype');
Next I use
$request->request->replace()
But I don't how to use this method in my case.
Thanks
The replace method replaces all of the parameters in the request, so you probably do not want to do that.
I would use the set method instead - So you can do:
$request->request->set('tactill_customerbundle_customertype', $newValue)
You can read more in the Symfony2 documentation (http://api.symfony.com/2.0/) - you are looking for Symfony\Component\HttpFoundation\Request (which is the $request variable), which then returns a Symfony\Component\HttpFoundation\ParameterBag when you call the request() method.
Flex3 + Cairngorm. I have my service in Servicis.mxml:
<mx:HTTPService id="docIndex" url="{URL_PREFIX}/jobs/{???}/docs" resultFormat="e4x"/>
And I call it from my generic restful delegate like this:
public function index(params:Object):void {
var call:AsyncToken = services.getHTTPService(resourceName+"Index").send(params);
call.addResponder(responder);
}
I want to know how I can use the params Object I pass inside the url definition (the ??? above). And please tell me how you would go about searching an answer to this in the documentation, I'd like to be a little more independet on these problems...
EDIT: I'll explain myself if you didn't understand my problem:
I have a restful api written in rails to which I'm connecting. Doc is a child resource of Job. If I want to get all docs I have to supply a job_id too. Therefore in the service the url must be changed for each .send() call, with the proper job_id (the ??? part above). I'd like to call it like myDelegate.index({job_id:34}) and insert that job_id field in the Service URL.
Write a class that extends HTTPService and allows you to set parameters into the url. Then, in your index function you can fetch it with services.getHTTPService, and call a function you create that sets the url values for you.
In your service locator create an instance of your class rather than a flat HTTPService.