Submit transaction to multiple endorsing peers using composer - hyperledger-composer

I have a business network with 2 Orgs, and each Org have one peer. According to my endorsement policy that I've used to start the network both Orgs must endorse transactions.
According to the Hyperledger Fabric docs here and FAQs here the client should connect to each endorsing peer and submit a transaction to both.
Composer has transaction submit command which allows to submit a transaction to the business network. But referring to docs here there is no parameters to specify the peers to which client should connect. Actually, when I submit the transaction this way using the admin card of one Org, I get ENDORSEMENT_POLICY_FAILURE error. The same situation happens when I submit transaction through the Composer REST server.
Is there any way to submit a transaction using composer to multiple peers for endorsing?

Thanks to Paul O'Mahony for helping to understand what composer transaction submit command does (see the comments below the question):
Composer will send the transaction to all the Peers in your connection.json document.
Initially I made a wrong assumption that the issue was with the endorsement policy. Actually, my problem was with access rules. A participant had no rights to create that transaction. Correcting the ACL file fixed the issue.

Related

how to resolve "EWS could not contact the appropriate CAS server for this request"

I have an application that is creating StreamingSubscription (using EWS managed API) for many hundreds of room resource mailboxes in EXO, and I'm trying to make the code tolerant of a subscription going "bad" and needing to be re-created. Here's the behavior I'm seeing at the moment.
I first divide up the mailboxes into groups according to best practices, and then within each group:
I create a StreamingSubscription for each mailbox
I add all the subscriptions to a connection and open the connection
Some time passes, and the OnSubscriptionError event fires for
one subscription. At this point I find that the subscription in
question is no longer in the connection's CurrentSubscriptions
collection, but I'm able to identify which mailbox it was originally
for.
I then flag that mailbox so that the code will try to re-create its
subscription.
When the code tries to re-create the failed subscription, this error is thrown:
Request failed because EWS could not contact the appropriate CAS server for this request.
Thereafter, my code tries again once per minute to create that subscription, and that same error is thrown each time. This continues for as long as I allow it to run.
If I then stop my Windows service and start it again, all the subscriptions are created successfully, including that failed one.
Here's my question. Why is it able to successfully create the subscription after stopping and re-starting the service, but can't re-create it after the OnSubscriptionError?

how to clear up all entries from solacache and also delete one entry(key) from solcache

We are using solace-cache/solcache in our project. In our dev environment its very difficult for us to go to solace admins to request for a cache refresh.
My question is:
Using the solace java API, is there a way we could clear up our entire solace cache instance and/or is there a way for us to delete specific keys already stored in the cache ?
If not, are there any simple commands that we could use to do this using the SEMP protocol without needing full admin rights to solace appliances?
Thanks,
The easiest option is to actually request for a limited management account with only read/write permission on your message-vpn from your adminstrators.
Then, you can make use of the management tools such as SolAdmin to manage your VPN.
Failing that, this can be done by executing the a SEMP over message bus command.
Publish the following message to topic #SEMP/<router name>/ADMIN/DISTRIBUTED-CACHE
<rpc>
<admin>
<distributed-cache>
<name>myDistributedCacheName</name>
<vpn-name>myVpnName</vpn-name>
<delete-messages>
<topic>my/topic/name</topic>
</delete-messages>
</distributed-cache>
</admin>
</rpc>
Wildcards can be specified in the topic string. For example, using a topic string of ">" will delete all messages in the cache.
Note that your message-vpn must be configured to:
Allow SEMP over Message Bus
Allow Admin Commands
Allow Distributed Cache Commands
Details on enabling these features in your message-vpn can be found here.
Details on Publishing SEMP Requests over the Message Bus can be found here. Alternatively, refer to the SempGetOverMB.java sample that is provided with the Solace Java API.

How to get the identity of a person invoking a transaction inside a transaction in Hyperledger composer?

I want to save the identity of the user invoking a transaction in hyperledger composer. is there a way of getting the user identity inside a transaction without passsing it as a transaction parameter?
Depends on how your users are managed. Typically an organization has a couple of fabric users that invoke transactions on the blockchain. This user can be determined by the ledger. However if you authenticate users at the application level then invoke with the same fabric client there is no way of drilling down to know which user from within an organization invoked the transaction without passing the user as part of the transaction
Answering my question, Hyperledger composer has a global method getCurrentParticipant that can be called inside the transaction to get the participant invoking the transaction. Also it has getCurrentIdentity which can be used to get the identity of the current participant. for more information

Bot Persist state of user during conversation

Every time that I restart my app (bot), conversation states are lost.
Is it possible to persist user state in a storage (like redis or a database) during conversations? How to do that?
This feature is currently in master branch now. There are 2 main classes: DictPersistance and PicklePersistance.
Of course, you can write your own implementation with Redis or Database using BasePersistance class.
See Gihub PR.

simple push notification in spring

I have a project that is related to job postings. Consultants or employers register on my website and then start posting jobs. I want to make push notifications for all users. When a consultant or employer posts a job, all online users must get notified that an employer has posted this job without any page refreshes on jquery setInterval or timeout.
I am using Spring framework. I have searched for the solution but found nothing. I want to know whether Spring provided WebSockets in their latest version. Is this possible to do with WebSockets?
I want a proper resource so that I can implement it on my website.
There are two ways to satisfy your need;
First is polling in which you repeatedly send requests from client to the server. On server side you somehow need have a kind of message queue for each client to deliver the incidents on a request. There also is a different type of polling in which you send a request from client and never end the request on the server-side thus you have a kind of pipe between two ends. This is called long polling.
Disadvantage of polling is that you have to send requests to the server forever from the client and in many cases server sends empty messages as there is no events happened.
The real application of pushing messages is recently avaliable with websockets (thanks to html5). However this requires the application server to be capable of websocket functionality. afaik jetty and tomcat has this ability. Spring 4 has websocket here you can find the tutorial; http://syntx.io/using-websockets-in-java-using-spring-4/
You can find a related stackoverflow post here

Resources