The docs show an example where you start listening to new data with the component, but how would you do an initial query before listening for new data?
If your initial query differs from subscription you should probably use <Query /> component and use subscribeToMore function for subscription.
Docs: https://www.apollographql.com/docs/react/advanced/subscriptions.html#subscribe-to-more
Related
Twilio newbie here.
I have a Twilio voice application that collects a bunch of data (international topup sales) - and there is a point where the actual process of purchasing the topup takes place.
This process can last anywhere from 10 to 30 seconds, where most of them are about 15 seconds. Sounds to me like I need to use the Twilio <ENQUEUE> tag (https://www.twilio.com/docs/voice/twiml/enqueue), but it does not work.
I am simply calling it like this (happens to be ColdFusion):
<Enqueue
waitUrl="processtopup.cfm"
method="POST"
action="topupdone.cfm">processTopup</Enqueue>
Within the processtopup.cfm file is the <PLAY> tag (which won't work because that is the page that takes more than 15 seconds.
Sorry - but I'm just confused on ho this should work. Thanks in advance!
Here is a possible solution. I've tested this and it works.
The main idea is to play some message/music in a loop until ColdFusion does the job, then, when ColdFusion is done, instruct the call to execute a different Twilio XML by making a POST request to Twilio's API call resource.
When a call comes in, and Twilio hits your endpoint, capture the call id, it will be used to switch the call to a different XML. The call id it's passed as FORM.CALLSID or URL.CALLSID depending on your webhook configuration at Twilio.
The call id looks something like CAdecbfa7e8e2a9d09336abcd57044cf74.
Pass the call id trough your flow (as url parameter should be fine) so it reaches processtopup.cfm.
Move the long running code from processtopup.cfm to let's say
processtopup-action.cfm
Code in processtopup.cfm should now return immediately XML for playing loop (or you can play some .mp3), I'm showing with a message:
<cfoutput><?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say loop="0">Please wait while we process your request...</Say>
</Response>
</cfoutput>
<cfhttp
url="http://www.yourwebsite.com/processtopup-action.cfm?callsid=#FORM.CALLSID#"
method="get"
timeout="1" />
The code for processtopup-action.cfm
<!--- // place your long running code here --->
<cfset accountSid = '{your account sid}' />
<cfset authToken = '{your auth token}' />
<cfhttp
url="https://api.twilio.com/2010-04-01/Accounts/#variables.accountSid#/Calls/#URL.CALLSID#.json"
method="POST"
username="#variables.accountSid#"
password="#variables.authToken#"
result="http_result">
<cfhttpparam
name="Url"
value="http://www.yourwebsite.com/finish.cfm"
type="formfield" />
</cfhttp>
Code for finish.cfm
<cfoutput><?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>This is the data you're looking for.</Say>
<Say>Thank you. Goodbye!</Say>
<Hangup />
</Response>
</cfoutput>
Of course, you can pass other parameters as you need.
Again, the main idea is that processtopup-action.cfm, after executing your long running code, makes a POST request to Twilio's API and instructs the call to switch to execute new TwiML located at http://www.yourwebsite.com/finish.cfm
Docs:
Call Redirection via the Twilio REST API
(https://www.twilio.com/blog/2009/09/call-queueing-putting-callers-on-hold-calll-redirect-new-url-new-feature.html)
Modifying Live Calls
(https://www.twilio.com/docs/voice/modify-live-calls)
Is there any way by which, I can update local entry from esb service. I have to store a token in global variable and need to update it when it is expired. I want to keep it in local entry. Looks like I can not update it from ESB service/sequence.
<localEntry key="TestLocalEntry" xmlns="http://ws.apache.org/ns/synapse"><![CDATA[TestValue]]></localEntry>
If you requirement is to store a global variable and not really update a local entry, you can use esb registry
Try this js to create / update an entry in governance registry (and store current payload xml in this sample) :
<script language="js"><![CDATA[
importPackage(Packages.org.apache.synapse.config);
mc.getConfiguration().getRegistry().newResource("gov:/trunk/test/MyEntry.xml",false);
mc.getConfiguration().getRegistry().updateResource("gov:/trunk/test/MyEntry.xml",mc.getPayloadXML().toString());
]]></script>
Try this xpath expression in your mediation to read the entry :
get-property('gov:/trunk/test/MyEntry.xml')
I have managed to fix this problem with java script.
To get property value use :
<script language="js"><![CDATA[var Token = mc.getEnvironment().getServerContextInformation().getProperty("TokenVal");
mc.setProperty("TokenVal",Token);]]></script>
<property expression="$ctx:TokenVal" name="TokenValue"
type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
and to update value use:
<script language="js"><![CDATA[var TokenValue = mc.getProperty("TokenValue");
mc.getEnvironment().getServerContextInformation().addProperty("TokenVal",TokenValue);
]]></script>
but even then, I want to use registry resources if we have any in wso2 esb
I have a flow that i want to test as follows:
<flow
name="MyFlow"
processingStrategy="synchronous">
<all>
<processor-chain>
<and-filter>
<filter ref="Filter1" />
<filter ref="Filter2" />
<filter ref="Filter3" />
</and-filter>
<!-- bla bla bla. doesnt matter for this question -->
</processor-chain>
<!-- more stuff that doesnt matter -->
</all>
</flow>
Filters 1, 2 and 3 are all custom filters.
I'm having a problem with filter 2 since it got some integration code that i can't replicate or execute on a unit testing enviroment. It would be great to tell my test just to accept that filter no matter what.
I just tried something like this (my test class is extending FunctionalTestCase):
muleContext.getRegistry().registerObject(
"Filter2",
new FilterThatJustAcceptsEverything());
But, that doesn't work.
Is there a way to mock that filter or some parts of its code just for this specific test?
This is how i'm calling it on my test method:
flow = muleContext.getRegistry().lookupObject(
"MyFlow");
String content = "bananas";
MuleEvent result = flow.process(getTestEvent(content));
Thanks in advance.
For mocking, the best way is to use munit - https://github.com/mulesoft/munit
Where you can mock the filter to just return the same event so it appears it just passes through. Something similar to:
whenMessageProcessor("expression-filter").withAttributes(...).thenReturnSameEvent();
Or alternatively, if you want to use the standard FunctionalTestCase, I would suggest using side-by-side configurations - http://www.mulesoft.org/documentation/display/current/Using+Side-by-Side+Configuration+Files and providing stub configurations.
It already looks like your filters are global. So what you can do is place your filters in a separate configuration "filters.xml" for example and provide a "filters-stubs.xml" in your test case. Where they can just be generic filters that always return true like so:
<expression-filter expression="#[true]" name="Filter1" />
and in your test load the stub config instead:
#Override
protected String getConfigResources()
{
return "main.xml, filters-stubs.xml";
}
I have a web application which uses CAS Ticket for user authentication purpose which is different for every login. I recorded the script in JMeter. Also I correlated the pages by filling up the Regular Expression Extractor as follows:
Recorded script has url: https://foo.com/j_spring_cas_security_check?ticket=ST-3101-QDTyjbbHoOHvgPMdRBIg-cas.
After applying all above I ran the script but got status fail displaying https://foo.com/j_spring_cas_security_check?ticket=Ticket_Not_Found.
It would be very helpful if someone could tell me what did I miss in my script?
There is two ways for this,
if you have multiple username and password and you can use those with Jmeter,
you can use those to generate CAS ST(Service ticket).
Another:
default when CAS create ticket, it can be just used for one time.
you have to change values in ticketExpirationPolicies.xml of your cas server
to use same ticket multiple times.
default location is:
WEB_INF/spring-configuration/ticketExpirationPolicies.xml
change this to if you want 50 users to use same ticket
<!-- This argument is the time a ticket can exist before its considered expired. -->
<constructor-arg
index="1"
value="100000" />
</bean>
<bean id="grantingTicketExpirationPolicy" class="org.jasig.cas.ticket.support.TimeoutExpirationPolicy">
<!-- This argument is the time a ticket can exist before its considered expired. -->
<constructor-arg
index="0"
value="7200000" />
</bean>
Answer given by: VIVEK ADHIKARI
It seems that an error happened when fetching ticket value from url's parameter list. Maybe you can add a hidden field on your page and set its value from this parameter.
<input type="hidden" id="ticket_key" value="ST-3101-QDTyjbbHoOHvgPMdRBIg-cas" />
Then you can get it by Regular Extractor ticket_key=(.+)
Hope it helps.
When I use the Search.asmx web service it won't allow me to search MetaData. Is there a way that I can do this?
Below is what I have come up with so far for my query, but it errors out with an InvalidPropertyException every time I run it.
<?xml version="1.0" encoding="utf-8" ?>
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000">
<Query domain="QDomain">
<SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats>
<Context>
<QueryText language="en-US" type="MSSQLFT">
<![CDATA[ SELECT Title, Rank, Size, Description, Write, Path FROM portal..scope() WHERE "Published" = 'Yes' ORDER BY "Rank" DESC ]]>
</QueryText>
</Context>
<Range><StartAt>1</StartAt><Count>20</Count></Range>
<EnableStemming>false</EnableStemming>
<TrimDuplicates>true</TrimDuplicates>
<IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery>
<ImplicitAndBehavior>true</ImplicitAndBehavior>
<IncludeRelevanceResults>true</IncludeRelevanceResults>
<IncludeSpecialTermResults>true</IncludeSpecialTermResults>
<IncludeHighConfidenceResults>true</IncludeHighConfidenceResults>
</Query></QueryPacket>
You can't just search an arbitrary column of metadata, you need to make sure it gets crawled first and is made available under a sensible name (managed property). See this blog post for an example.
Also, if Published is a boolean, I think you might want to test "Published" = 1, in stead of yes.